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

gpf at FreeBSD.org gpf at FreeBSD.org
Thu Jun 7 11:30:21 UTC 2012


Author: gpf
Date: Thu Jun  7 11:30:17 2012
New Revision: 237258
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237258

Log:
  - avoid messing with lower vp locks.
  - use vput to node acquired from lookup() to get rid of that reference counter as well
  

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

Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c
==============================================================================
--- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c	Thu Jun  7 10:53:42 2012	(r237257)
+++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c	Thu Jun  7 11:30:17 2012	(r237258)
@@ -2362,7 +2362,7 @@
 	u_quad_t fsize;
 	struct vnode *vp = ap->a_vp;
 	struct vnode *lvp = PEFS_LOWERVP(vp);
-	struct vnode *svp;
+	struct vnode *svp, *slvp;
 	struct pefs_xkey *xk = ap->a_data;
 	struct pefs_xnamecsum *xncs = ap->a_data;
 	struct pefs_xsector_ctext *xsct = ap->a_data;
@@ -2512,10 +2512,8 @@
 		pefs_chunk_create(&pc, pn, xsct->pxsct_ctext_len);
 		puio = pefs_chunk_uio(&pc, xsct->pxsct_offset, UIO_READ);
 
-		/* XXXgpf: is this lock really necessary? */
-		vn_lock(lvp, LK_EXCLUSIVE);
+
 		error = VOP_READ(lvp, puio, IO_UNIT | IO_NODELOCKED, cred);
-		VOP_UNLOCK(lvp, 0);
 
 		if (error == 0)
 			memcpy(xsct->pxsct_ctext, pc.pc_base, xsct->pxsct_ctext_len);
@@ -2633,28 +2631,25 @@
 
 		if (svp->v_type != VLNK) {
 			printf("pefs_ioctl: PEFS_GETSLINKCTEXT svp is not a symlink '/'\n");
-			VOP_UNLOCK(svp, 0);
+			vput(svp);
 			VOP_UNLOCK(vp, 0);
 			return (EINVAL);
 		}
 
 		/* VOP_READLINK our lvp */
-		lvp = PEFS_LOWERVP(svp);
+		slvp = PEFS_LOWERVP(svp);
 		pn = VP_TO_PN(svp);
 		pefs_chunk_create(&pc, pn, MAXPATHLEN);
 		puio = pefs_chunk_uio(&pc, 0, UIO_READ);
 
-		/* XXXgpf: is this lock really necessary? */
-		vn_lock(lvp, LK_EXCLUSIVE);
-		error = VOP_READLINK(lvp, puio, cred);
-		VOP_UNLOCK(lvp, 0);
+		error = VOP_READLINK(slvp, puio, cred);
 
 		xsl->pxsl_slink_len = pc.pc_size - pc.pc_uio.uio_resid;
 		if (error == 0)
 			memcpy(xsl->pxsl_slink, pc.pc_base, xsl->pxsl_slink_len);
 
 		pefs_chunk_free(&pc, pn);
-		VOP_UNLOCK(svp, 0);
+		vput(svp);
 		VOP_UNLOCK(vp, 0);
 		break;
 	default:


More information about the svn-soc-all mailing list