Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern description:
details: https://anonhg.NetBSD.org/src/rev/65639f6dfe32
branches: trunk
changeset: 764074:65639f6dfe32
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Apr 11 02:17:01 2011 +0000
description:
description:
Fix lookup_for_nfsd_index() -- it wasn't locking the directory it was
searching. I'm not sure if this is something I introduced or if it's
just been wrong for ages; the code path is used only for serving
index.html in WebNFS and probably just ought to be removed.
diffstat:
sys/kern/vfs_lookup.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (51 lines):
diff -r 5cd43b255dc9 -r 65639f6dfe32 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Mon Apr 11 02:16:27 2011 +0000
+++ b/sys/kern/vfs_lookup.c Mon Apr 11 02:17:01 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.159 2011/04/11 02:16:27 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.160 2011/04/11 02:17:01 dholland Exp $");
#include "opt_magiclinks.h"
@@ -1458,7 +1458,14 @@
else
cnp->cn_flags &= ~ISDOTDOT;
- error = lookup_once(state, startdir, &ndp->ni_dvp, &foundobj);
+ /*
+ * Because lookup_once can change the startdir, we need our
+ * own reference to it to avoid consuming the caller's.
+ */
+ vref(startdir);
+ vn_lock(startdir, LK_EXCLUSIVE | LK_RETRY);
+ error = lookup_once(state, startdir, &startdir, &foundobj);
+ vput(startdir);
if (error) {
goto bad;
}
@@ -1469,6 +1476,7 @@
return 0;
}
+ KASSERT((cnp->cn_flags & LOCKPARENT) == 0);
if ((cnp->cn_flags & LOCKLEAF) == 0) {
VOP_UNLOCK(foundobj);
}
@@ -1500,8 +1508,6 @@
ndp->ni_pnbuf = NULL;
ndp->ni_cnd.cn_nameptr = NULL;
- vref(startdir);
-
namei_init(&state, ndp);
error = do_lookup_for_nfsd_index(&state, startdir);
namei_cleanup(&state);
Home |
Main Index |
Thread Index |
Old Index