simplifying linux_emul_convpath()

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Wed, 14 Jan 2004 05:08:51 -0800 (PST)
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
_at__at_ -96,8 +96,6 _at__at_
 {
 	struct nameidata	 nd;
 	struct nameidata	 ndroot;
-	struct vattr		 vat;
-	struct vattr		 vatroot;
 	int			 error;
 	const char		*prefix;
 	char			*ptr, *buf, *cp;
_at__at_ -169,17 +167,7 _at__at_
 			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;
 		}
Received on Wed Jan 14 2004 - 04:08:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:38 UTC