From owner-freebsd-current@FreeBSD.ORG Wed Jan 14 05:08:59 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D0FC16A4CE for ; Wed, 14 Jan 2004 05:08:59 -0800 (PST) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BDD443D31 for ; Wed, 14 Jan 2004 05:08:58 -0800 (PST) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.9p2/8.12.9) with ESMTP id i0ED8p7E039161 for ; Wed, 14 Jan 2004 05:08:55 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <200401141308.i0ED8p7E039161@gw.catspoiler.org> Date: Wed, 14 Jan 2004 05:08:51 -0800 (PST) From: Don Lewis To: current@FreeBSD.org MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Subject: simplifying linux_emul_convpath() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2004 13:08:59 -0000 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; }