Source-Changes-HG archive

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

[src/trunk]: src When union_lookup() creates a shadow directory and nameiop i...



details:   https://anonhg.NetBSD.org/src/rev/7cc0a96b1bc4
branches:  trunk
changeset: 767978:7cc0a96b1bc4
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Aug 05 08:17:47 2011 +0000

description:
When union_lookup() creates a shadow directory and nameiop is not LOOKUP
it has to restart the lookup to get the componentname right.

Fixes PR #44383 (an endless stream of whiteout and opaque dir problems ...)

diffstat:

 sys/fs/union/union_vnops.c |  14 ++++++++++++--
 tests/fs/vfs/t_union.c     |   3 +--
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (66 lines):

diff -r e219b6cc457e -r 7cc0a96b1bc4 sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c        Fri Aug 05 08:13:59 2011 +0000
+++ b/sys/fs/union/union_vnops.c        Fri Aug 05 08:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vnops.c,v 1.40 2011/06/12 03:35:55 rmind Exp $   */
+/*     $NetBSD: union_vnops.c,v 1.41 2011/08/05 08:17:47 hannken Exp $ */
 
 /*
  * Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.40 2011/06/12 03:35:55 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.41 2011/08/05 08:17:47 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -304,6 +304,7 @@
            (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
                return (EROFS);
 
+start:
        upperdvp = dun->un_uppervp;
        lowerdvp = dun->un_lowervp;
        uppervp = NULLVP;
@@ -483,6 +484,9 @@
                         * We may be racing another process to make the
                         * upper-level shadow directory.  Be careful with
                         * locks/etc!
+                        * If we have to create a shadow directory and want
+                        * to commit the node we have to restart the lookup
+                        * to get the componentname right.
                         */
                        if (upperdvp) {
                                dun->un_flags &= ~UN_ULOCK;
@@ -491,6 +495,12 @@
                                    &uppervp);
                                vn_lock(upperdvp, LK_EXCLUSIVE | LK_RETRY);
                                dun->un_flags |= UN_ULOCK;
+                               if (uerror == 0 && cnp->cn_nameiop != LOOKUP) {
+                                       vput(uppervp);
+                                       if (lowervp != NULLVP)
+                                               vput(lowervp);
+                                       goto start;
+                               }
                        }
                        if (uerror) {
                                if (lowervp != NULLVP) {
diff -r e219b6cc457e -r 7cc0a96b1bc4 tests/fs/vfs/t_union.c
--- a/tests/fs/vfs/t_union.c    Fri Aug 05 08:13:59 2011 +0000
+++ b/tests/fs/vfs/t_union.c    Fri Aug 05 08:17:47 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_union.c,v 1.6 2011/08/03 10:03:51 hannken Exp $      */
+/*     $NetBSD: t_union.c,v 1.7 2011/08/05 08:17:47 hannken Exp $      */
 
 #include <sys/types.h>
 #include <sys/mount.h>
@@ -177,7 +177,6 @@
        mountunion(mp, lower);
 
        /* all file systems fail sooner or later */
-       atf_tc_expect_fail("PR kern/44383");
        FSTEST_ENTER();
        RL(rump_sys_rmdir(TDIR));
        ATF_REQUIRE_ERRNO(ENOENT, rump_sys_stat(TDFILE, &sb) == -1);



Home | Main Index | Thread Index | Old Index