Module Name:    src
Committed By:   bouyer
Date:           Sun Feb 14 13:55:29 UTC 2010

Modified Files:
        src/sys/ufs/ufs [netbsd-5]: ufs_lookup.c

Log Message:
Pull up following revision(s) (requested by dholland in ticket #1300):
        sys/ufs/ufs/ufs_lookup.c: revision 1.102
Avoid nasal demons. Code of the form
   vput(vp);
   error = VFS_VGET(vp->v_mount, ...);
just isn't right. Because of vnode caching this *probably* never bit
anyone, except maybe under very heavy load, but still.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.99.4.1 src/sys/ufs/ufs/ufs_lookup.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ufs/ufs_lookup.c
diff -u src/sys/ufs/ufs/ufs_lookup.c:1.99 src/sys/ufs/ufs/ufs_lookup.c:1.99.4.1
--- src/sys/ufs/ufs/ufs_lookup.c:1.99	Thu Jul 31 05:38:06 2008
+++ src/sys/ufs/ufs/ufs_lookup.c	Sun Feb 14 13:55:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_lookup.c,v 1.99 2008/07/31 05:38:06 simonb Exp $	*/
+/*	$NetBSD: ufs_lookup.c,v 1.99.4.1 2010/02/14 13:55:29 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.99 2008/07/31 05:38:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.99.4.1 2010/02/14 13:55:29 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ffs.h"
@@ -1256,7 +1256,7 @@
 int
 ufs_checkpath(struct inode *source, struct inode *target, kauth_cred_t cred)
 {
-	struct vnode *vp = ITOV(target);
+	struct vnode *nextvp, *vp;
 	int error, rootino, namlen;
 	struct dirtemplate dirbuf;
 	const int needswap = UFS_MPNEEDSWAP(target->i_ump);
@@ -1304,13 +1304,15 @@
 		}
 		if (ufs_rw32(dirbuf.dotdot_ino, needswap) == rootino)
 			break;
-		vput(vp);
+		VOP_UNLOCK(vp, 0);
 		error = VFS_VGET(vp->v_mount,
-		    ufs_rw32(dirbuf.dotdot_ino, needswap), &vp);
+		    ufs_rw32(dirbuf.dotdot_ino, needswap), &nextvp);
+		vrele(vp);
 		if (error) {
 			vp = NULL;
 			break;
 		}
+		vp = nextvp;
 	}
 
 out:

Reply via email to