Date: Wed, 14 Jan 2004 05:08:51 -0800 (PST) From: Don Lewis <truckman@FreeBSD.org> To: current@FreeBSD.org Subject: simplifying linux_emul_convpath() Message-ID: <200401141308.i0ED8p7E039161@gw.catspoiler.org>
next in thread | raw e-mail | index | archive | help
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;
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401141308.i0ED8p7E039161>
