Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/union Fix the DOT and DOTDOT case for union_lookup1().



details:   https://anonhg.NetBSD.org/src/rev/1e71d8e19ccc
branches:  trunk
changeset: 793428:1e71d8e19ccc
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Feb 13 09:50:31 2014 +0000

description:
Fix the DOT and DOTDOT case for union_lookup1().

diffstat:

 sys/fs/union/union_vnops.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (44 lines):

diff -r 8a8c705e19d2 -r 1e71d8e19ccc sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c        Thu Feb 13 03:34:40 2014 +0000
+++ b/sys/fs/union/union_vnops.c        Thu Feb 13 09:50:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vnops.c,v 1.52 2014/02/07 15:29:22 hannken Exp $ */
+/*     $NetBSD: union_vnops.c,v 1.53 2014/02/13 09:50:31 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.52 2014/02/07 15:29:22 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.53 2014/02/13 09:50:31 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -228,14 +228,19 @@
         error = VOP_LOOKUP(dvp, &tdvp, cnp);
        if (error)
                return (error);
-       error = vn_lock(tdvp, LK_EXCLUSIVE);
-       if (error) {
-               vrele(tdvp);
-               return error;
+       if (dvp != tdvp) {
+               if (cnp->cn_flags & ISDOTDOT)
+                       VOP_UNLOCK(dvp);
+               error = vn_lock(tdvp, LK_EXCLUSIVE);
+               if (cnp->cn_flags & ISDOTDOT)
+                       vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
+               if (error) {
+                       vrele(tdvp);
+                       return error;
+               }
+               dvp = tdvp;
        }
 
-       dvp = tdvp;
-
        /*
         * Lastly check if the current node is a mount point in
         * which case walk up the mount hierarchy making sure not to



Home | Main Index | Thread Index | Old Index