Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix vn_lock() to return an invalid (dead, clean) vnode
details: https://anonhg.NetBSD.org/src/rev/0c93cd720606
branches: trunk
changeset: 778567:0c93cd720606
user: hannken <hannken%NetBSD.org@localhost>
date: Thu Apr 05 07:26:36 2012 +0000
description:
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
diffstat:
sys/kern/vfs_vnops.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 61043a36f84e -r 0c93cd720606 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c Thu Apr 05 04:04:05 2012 +0000
+++ b/sys/kern/vfs_vnops.c Thu Apr 05 07:26:36 2012 +0000
@@ -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.184 2012/04/05 07:26:36 hannken 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.184 2012/04/05 07:26:36 hannken Exp $");
#include "veriexec.h"
@@ -805,6 +805,15 @@
} 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);
}
Home |
Main Index |
Thread Index |
Old Index