Source-Changes-HG archive

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

[src/trunk]: src Add an INRELOOKUP namei flag. Sigh. (We don't need more name...



details:   https://anonhg.NetBSD.org/src/rev/650df4a7f172
branches:  trunk
changeset: 760274:650df4a7f172
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jan 02 05:04:58 2011 +0000

description:
Add an INRELOOKUP namei flag. Sigh. (We don't need more namei flags.)

However, because of a protocol deficiency puffs relies on being able
to keep track of VOP_LOOKUP calls by inspecting their contents, and
this at least allows it to use something vaguely principled instead of
making wild guesses based on whether SAVESTART is set.

Update libp2k to use INRELOOKUP instead of SAVESTART.

diffstat:

 lib/libp2k/p2k.c      |   8 ++++----
 sys/kern/vfs_lookup.c |  10 +++++++---
 sys/sys/namei.src     |   5 +++--
 3 files changed, 14 insertions(+), 9 deletions(-)

diffs (86 lines):

diff -r 7801bff0d015 -r 650df4a7f172 lib/libp2k/p2k.c
--- a/lib/libp2k/p2k.c  Sun Jan 02 05:02:04 2011 +0000
+++ b/lib/libp2k/p2k.c  Sun Jan 02 05:04:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p2k.c,v 1.47 2010/11/30 15:42:11 pooka Exp $   */
+/*     $NetBSD: p2k.c,v 1.48 2011/01/02 05:04:59 dholland Exp $        */
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -680,8 +680,8 @@
 
        /*
         * XXX the rename lookup protocol is currently horribly
-        * broken.  We get 1) DELETE with SAVESTART 2) DELETE
-        * without SAVESTART 3) RENAME.  Hold on to this like
+        * broken.  We get 1) DELETE 2) DELETE with INRELOOKUP
+        * 3) RENAME.  Hold on to this like
         * it were the absolute truth for now.  However, do
         * not sprinkle asserts based on this due to abovementioned
         * brokenness -- some file system drivers might not
@@ -691,7 +691,7 @@
        if (pcn->pcn_flags & RUMP_NAMEI_INRENAME) {
                if (pcn->pcn_nameiop == RUMP_NAMEI_DELETE) {
                        /* save path from the first lookup */
-                       if (pcn->pcn_flags & RUMP_NAMEI_SAVESTART) {
+                       if ((pcn->pcn_flags & RUMP_NAMEI_INRELOOKUP) == 0) {
                                if (p2n_dir->p2n_cn_ren_src)
                                        freecn(p2n_dir->p2n_cn_ren_src);
                                p2n_dir->p2n_cn_ren_src = cn;
diff -r 7801bff0d015 -r 650df4a7f172 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Sun Jan 02 05:02:04 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Sun Jan 02 05:04:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.128 2011/01/02 05:01:20 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.129 2011/01/02 05:04:58 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.128 2011/01/02 05:01:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.129 2011/01/02 05:04:58 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -399,6 +399,7 @@
 {
        state->ndp = ndp;
        state->cnp = &ndp->ni_cnd;
+       KASSERT((state->cnp->cn_flags & INRELOOKUP) == 0);
 
        state->namei_startdir = NULL;
 
@@ -1513,7 +1514,10 @@
        /*
         * We now have a segment name to search for, and a directory to search.
         */
-       if ((error = VOP_LOOKUP(dvp, vpp, cnp)) != 0) {
+       cnp->cn_flags |= INRELOOKUP;
+       error = VOP_LOOKUP(dvp, vpp, cnp);
+       cnp->cn_flags &= ~INRELOOKUP;
+       if ((error) != 0) {
 #ifdef DIAGNOSTIC
                if (*vpp != NULL)
                        panic("leaf `%s' should be empty", cnp->cn_nameptr);
diff -r 7801bff0d015 -r 650df4a7f172 sys/sys/namei.src
--- a/sys/sys/namei.src Sun Jan 02 05:02:04 2011 +0000
+++ b/sys/sys/namei.src Sun Jan 02 05:04:58 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namei.src,v 1.18 2011/01/02 05:01:20 dholland Exp $    */
+/*     $NetBSD: namei.src,v 1.19 2011/01/02 05:04:58 dholland Exp $    */
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -166,7 +166,8 @@
 NAMEIFL        REQUIREDIR      0x0080000       /* must be a directory */
 NAMEIFL        CREATEDIR       0x0200000       /* trailing slashes are ok */
 NAMEIFL        INRENAME        0x0400000       /* operation is a part of ``rename'' */
-NAMEIFL        PARAMASK        0x06fff00       /* mask of parameter descriptors */
+NAMEIFL        INRELOOKUP      0x0800000       /* set while inside relookup() */
+NAMEIFL        PARAMASK        0x0efff00       /* mask of parameter descriptors */
 
 /*
  * Initialization of an nameidata structure.



Home | Main Index | Thread Index | Old Index