Module Name: src
Committed By: dholland
Date: Tue Aug 9 23:46:05 UTC 2011
Modified Files:
src/sys/kern: vfs_lookup.c
Log Message:
Fail namei immediately if searchdir is unlinked / has been rmdir'd.
Do this by checking if v_size == 0. Should fix PR 44658 (and PR 32661).
To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/kern/vfs_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/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.186 src/sys/kern/vfs_lookup.c:1.187
--- src/sys/kern/vfs_lookup.c:1.186 Tue Aug 9 23:16:17 2011
+++ src/sys/kern/vfs_lookup.c Tue Aug 9 23:46:05 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.186 2011/08/09 23:16:17 dholland Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.187 2011/08/09 23:46:05 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.186 2011/08/09 23:16:17 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.187 2011/08/09 23:46:05 dholland Exp $");
#include "opt_magiclinks.h"
@@ -1123,11 +1123,10 @@
for (;;) {
/*
- * If the directory we're on is unmounted, bail out.
- * XXX: should this also check if it's unlinked?
- * XXX: yes it should... but how?
+ * If the directory we're on is unmounted, or has been
+ * rmdir'd, bail out.
*/
- if (searchdir->v_mount == NULL) {
+ if (searchdir->v_mount == NULL || searchdir->v_size == 0) {
vput(searchdir);
ndp->ni_dvp = NULL;
ndp->ni_vp = NULL;