simplifying linux_emul_convpath()

Don Lewis truckman at FreeBSD.org
Wed Jan 14 05:08:59 PST 2004


I just stumbled across a vnode locking violation in
linux_emul_convpath().  Rather than locking and unlocking each vnode for
the VOP_GETATTR() calls, is there any reason that this code should not
be simplified to just compare the vnode pointers rather than fetching
the vnode attributes and comparing the attributes for equality.

Index: sys/compat/linux/linux_util.c
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_util.c,v
retrieving revision 1.23
diff -u -r1.23 linux_util.c
--- sys/compat/linux/linux_util.c	10 Jun 2003 21:27:40 -0000	1.23
+++ sys/compat/linux/linux_util.c	14 Jan 2004 12:11:26 -0000
@@ -96,8 +96,6 @@
 {
 	struct nameidata	 nd;
 	struct nameidata	 ndroot;
-	struct vattr		 vat;
-	struct vattr		 vatroot;
 	int			 error;
 	const char		*prefix;
 	char			*ptr, *buf, *cp;
@@ -169,17 +167,7 @@
 			goto keeporig;
 		}
 
-		if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_ucred, td)) != 0) {
-			goto bad;
-		}
-
-		if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_ucred, td))
-		    != 0) {
-			goto bad;
-		}
-
-		if (vat.va_fsid == vatroot.va_fsid &&
-		    vat.va_fileid == vatroot.va_fileid) {
+		if (nd.ni_vp == ndroot.ni_vp) {
 			error = ENOENT;
 			goto bad;
 		}



More information about the freebsd-current mailing list