Module Name: src Committed By: riz Date: Thu Apr 12 17:15:23 UTC 2012
Modified Files: src/sys/kern [netbsd-6]: vfs_vnops.c Log Message: Pull up following revision(s) (requested by hannken in ticket #179): sys/kern/vfs_vnops.c: revision 1.184 Fix vn_lock() to return an invalid (dead, clean) vnode only if the caller requested it by setting LK_RETRY. Should fix PR #46221: Kernel panic in NFS server code To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.183.8.1 src/sys/kern/vfs_vnops.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/kern/vfs_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.183 src/sys/kern/vfs_vnops.c:1.183.8.1 --- src/sys/kern/vfs_vnops.c:1.183 Fri Oct 14 09:23:31 2011 +++ src/sys/kern/vfs_vnops.c Thu Apr 12 17:15:23 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.183 2011/10/14 09:23:31 hannken Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.183.8.1 2012/04/12 17:15:23 riz Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.183 2011/10/14 09:23:31 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.183.8.1 2012/04/12 17:15:23 riz Exp $"); #include "veriexec.h" @@ -805,6 +805,15 @@ vn_lock(struct vnode *vp, int flags) } else { mutex_exit(vp->v_interlock); error = VOP_LOCK(vp, (flags & ~LK_RETRY)); + if (error == 0 && (flags & LK_RETRY) == 0) { + mutex_enter(vp->v_interlock); + if ((vp->v_iflag & VI_CLEAN)) { + mutex_exit(vp->v_interlock); + VOP_UNLOCK(vp); + return ENOENT; + } + mutex_exit(vp->v_interlock); + } if (error == 0 || error == EDEADLK || error == EBUSY) return (error); }