diff --git a/sys/fs/union/union_vnops.c b/sys/fs/union/union_vnops.c index 839ba0b18bab..4cddac9ad790 100644 --- a/sys/fs/union/union_vnops.c +++ b/sys/fs/union/union_vnops.c @@ -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 -__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 #include @@ -304,6 +304,7 @@ union_lookup(void *v) (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 @@ union_lookup(void *v) * 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 @@ union_lookup(void *v) &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 --git a/tests/fs/vfs/t_union.c b/tests/fs/vfs/t_union.c index 99ca1ed38ed2..eb30546fa3f1 100644 --- a/tests/fs/vfs/t_union.c +++ b/tests/fs/vfs/t_union.c @@ -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 #include @@ -177,7 +177,6 @@ whiteout(const atf_tc_t *tc, const char *mp) 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);