Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Fail namei immediately if searchdir is unlinked / h...



details:   https://anonhg.NetBSD.org/src/rev/730627d92d20
branches:  trunk
changeset: 768160:730627d92d20
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue Aug 09 23:46:05 2011 +0000

description:
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).

diffstat:

 sys/kern/vfs_lookup.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (33 lines):

diff -r 45d1acfe4ddb -r 730627d92d20 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Tue Aug 09 23:16:17 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Tue Aug 09 23:46:05 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index