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/90e77cb021f0
branches:  trunk
changeset: 764072:90e77cb021f0
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:16:07 2011 +0000

description:
description:
In the test where we check if searchdir is NULL and fail if we needed
to return ni_dvp, also check if searchdir is on a different volume
from foundobj. I believe the NULL test was meant to encompass this
situation, but it definitely doesn't in some cases related to
emulroots. This appears to be a bug, and I'm pretty sure it's not one
I introduced.

(The search directory and result are on different volumes if we
crossed a mount point.)

diffstat:

 sys/kern/vfs_lookup.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r 15386575c325 -r 90e77cb021f0 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:15:54 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:16:07 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.157 2011/04/11 02:15:54 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 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.157 2011/04/11 02:15:54 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.158 2011/04/11 02:16:07 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1246,12 +1246,14 @@
                }
 
                /*
-                * If the caller requested the parent node
-                * (i.e.  it's a CREATE, DELETE, or RENAME),
-                * and we don't have one (because this is the
-                * root directory), then we must fail.
+                * If the caller requested the parent node (i.e. it's
+                * a CREATE, DELETE, or RENAME), and we don't have one
+                * (because this is the root directory, or we crossed
+                * a mount point), then we must fail.
                 */
-               if (searchdir == NULL && cnp->cn_nameiop != LOOKUP) {
+               if (cnp->cn_nameiop != LOOKUP &&
+                   (searchdir == NULL ||
+                    searchdir->v_mount != foundobj->v_mount)) {
                        switch (cnp->cn_nameiop) {
                            case CREATE:
                                error = EEXIST;
@@ -1263,6 +1265,9 @@
                            default:
                                KASSERT(0);
                        }
+                       if (searchdir) {
+                               vput(searchdir);
+                       }
                        vput(foundobj);
                        foundobj = NULL;
                        KASSERT(ndp->ni_dvp == NULL);



Home | Main Index | Thread Index | Old Index