socsvn commit: r237689 - soc2012/gpf/pefs_kmod/sys/fs/pefs

gpf at FreeBSD.org gpf at FreeBSD.org
Thu Jun 14 13:52:53 UTC 2012


Author: gpf
Date: Thu Jun 14 13:52:50 2012
New Revision: 237689
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237689

Log:
  - remove IO_NODELOCKED from VOP_READ calls
  
  - fixed bug where mount operationg seemed to 'hang' if an error was
  encountered. I needed to vrele vp instead of lowerrootvp in case of error
  during pefs_checksum_load(). Before fix, vfs_mount_destroy() slept for ever
  while waiting mnt_ref to drop to 0.
  

Modified:
  soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c
  soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c

Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c
==============================================================================
--- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c	Thu Jun 14 12:43:37 2012	(r237688)
+++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c	Thu Jun 14 13:52:50 2012	(r237689)
@@ -126,6 +126,8 @@
 static void
 pefs_dbg_vnode(struct vnode *vp, char *str)
 {
+	if (vp == NULL)
+		return;
 	printf("%s is locked: %d\n", str, VOP_ISLOCKED(vp));
 	printf("%s usecount: %d\n", str, vp->v_usecount);
 	printf("%s holdcnt: %d\n", str, vp->v_holdcnt);
@@ -214,14 +216,11 @@
 	pathlen = MAXPATHLEN + 1;
 	path = malloc(pathlen, M_TEMP, M_WAITOK);
 	snprintf(path, pathlen, "%s/%s", mp->mnt_stat.f_mntfromname, PEFS_FILE_CHECKSUM);
-	printf("path = %s\n", path);
 
 	/* grab a vp for our checksum file */
-	pefs_dbg_vnode(pm->pm_rootvp, "start rootvp");
 	NDINIT(ndp, LOOKUP, LOCKLEAF, UIO_SYSSPACE, path, curthread);
 	error = namei(ndp);
 	free(path, M_TEMP);
-	pefs_dbg_vnode(pm->pm_rootvp, "after namei rootvp");
 	if (error != 0) {
 		printf("pefs_checksum_load: namei error %d\n", error);
 		return (error);
@@ -235,7 +234,8 @@
 	pefs_chunk_create(&pc, NULL, buflen);
 	puio = pefs_chunk_uio(&pc, 0, UIO_READ);
 
-	error = VOP_READ(checksumvp, puio, IO_UNIT | IO_NODELOCKED, cred);
+	/* XXXgpf: gleb says  I should use vn_rdwr instead of VOP_READ */
+	error = VOP_READ(checksumvp, puio, IO_UNIT, cred);
 	if (error != 0) {
 		printf("pefs_checksum_load: vop_read1 error %d\n", error);
 		pefs_chunk_free(&pc, NULL);
@@ -266,7 +266,7 @@
 	pefs_chunk_create(&pc, NULL, buflen);
 	puio = pefs_chunk_uio(&pc, pcs->pcs_offset_to_hash_table, UIO_READ);
 
-	error = VOP_READ(checksumvp, puio, IO_UNIT | IO_NODELOCKED, cred);
+	error = VOP_READ(checksumvp, puio, IO_UNIT, cred);
 	if (error != 0) {
 		printf("pefs_checksum_load: vop_read2 error %d\n", error);
 		pefs_chunk_free(&pc, NULL);
@@ -281,7 +281,7 @@
 	pefs_chunk_create(&pc, NULL, buflen);
 	puio = pefs_chunk_uio(&pc, pcs->pcs_offset_to_hash_table + buflen, UIO_READ);
 
-	error = VOP_READ(checksumvp, puio, IO_UNIT | IO_NODELOCKED, cred);
+	error = VOP_READ(checksumvp, puio, IO_UNIT, cred);
 	if (error != 0) {
 		printf("pefs_checksum_load: vop_read3 error %d\n", error);
 		pefs_chunk_free(&pc, NULL);
@@ -301,7 +301,6 @@
 	/* keep the reference for checksumvp */
 	VOP_UNLOCK(checksumvp, 0);
 	pefs_dbg_vnode(checksumvp, "after VOP_UNLOCK checksumvp");
-	pefs_dbg_vnode(pm->pm_rootvp, "end rootvp");
 	pcs->pcs_checksumvp = checksumvp;
 
 	return (0);
@@ -505,15 +504,7 @@
 		error = pefs_checksum_load(mp);
 		pefs_dbg_vnode(lowerrootvp, "AFTER lowerrootvp");
 		if (error != 0) {
-			/*
-			 * XXXgpf: what should be done for lowerrootvp? vput?
-			 * pefs_dbg_vnode shows that at this point lowerootvp
-			 * is not locked, therefore just a vrele?
-			 * Whatever we do, if error occurs during pefs_checksum_load,
-			 * mount seems to 'hang'
-			 */
-			vrele(lowerrootvp);
-			pefs_dbg_vnode(lowerrootvp, "AFTER vrele lowerrootvp");
+			vrele(vp);
 			free(pm, M_PEFSMNT);
 			return (error);
 		}

Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c
==============================================================================
--- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c	Thu Jun 14 12:43:37 2012	(r237688)
+++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c	Thu Jun 14 13:52:50 2012	(r237689)
@@ -2512,7 +2512,7 @@
 		pefs_chunk_create(&pc, pn, xsct->pxsct_ctext_len);
 		puio = pefs_chunk_uio(&pc, xsct->pxsct_offset, UIO_READ);
 
-		error = VOP_READ(lvp, puio, IO_UNIT | IO_NODELOCKED, cred);
+		error = VOP_READ(lvp, puio, IO_UNIT, cred);
 
 		if (error == 0)
 			memcpy(xsct->pxsct_ctext, pc.pc_base, xsct->pxsct_ctext_len);


More information about the svn-soc-all mailing list