Module Name:    src
Committed By:   rmind
Date:           Sat May 21 03:38:25 UTC 2011

Modified Files:
        src/sys/fs/union [rmind-uvmplock]: union_subr.c
        src/sys/fs/unionfs [rmind-uvmplock]: unionfs_subr.c

Log Message:
Finish v_interlock sharing bits for union/unionfs.


To generate a diff of this commit:
cvs rdiff -u -r1.35.4.3 -r1.35.4.4 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.5.4.4 -r1.5.4.5 src/sys/fs/unionfs/unionfs_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.35.4.3 src/sys/fs/union/union_subr.c:1.35.4.4
--- src/sys/fs/union/union_subr.c:1.35.4.3	Thu May 19 03:43:02 2011
+++ src/sys/fs/union/union_subr.c	Sat May 21 03:38:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_subr.c,v 1.35.4.3 2011/05/19 03:43:02 rmind Exp $	*/
+/*	$NetBSD: union_subr.c,v 1.35.4.4 2011/05/21 03:38:24 rmind Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.35.4.3 2011/05/19 03:43:02 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.35.4.4 2011/05/21 03:38:24 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -507,7 +507,12 @@
 			lowersz = va.va_size;
 	hash = UNION_HASH(uppervp, lowervp);
 
-	error = getnewvnode(VT_UNION, mp, union_vnodeop_p, NULL, vpp); /* TODO */
+	/*
+	 * Get a new vnode and share the lock with upper layer vnode,
+	 * unless layers are inverted.
+	 */
+	error = getnewvnode(VT_UNION, mp, union_vnodeop_p,
+	    (uppervp != NULLVP ? uppervp : lowervp), vpp);
 	if (error) {
 		if (uppervp) {
 			if (dvp == uppervp)

Index: src/sys/fs/unionfs/unionfs_subr.c
diff -u src/sys/fs/unionfs/unionfs_subr.c:1.5.4.4 src/sys/fs/unionfs/unionfs_subr.c:1.5.4.5
--- src/sys/fs/unionfs/unionfs_subr.c:1.5.4.4	Thu May 19 03:43:02 2011
+++ src/sys/fs/unionfs/unionfs_subr.c	Sat May 21 03:38:25 2011
@@ -91,12 +91,13 @@
 			return (EINVAL);
 	}
 
-	unp = kmem_zalloc(sizeof(*unp), KM_SLEEP);
-	if (unp == NULL)
-		return (ENOMEM);
-	error = getnewvnode(VT_UNION, mp, unionfs_vnodeop_p, NULL, &vp); /* TODO */
+	/*
+	 * Get a new vnode and share the lock with upper layer vnode,
+	 * unless layers are inverted.
+	 */
+	error = getnewvnode(VT_UNION, mp, unionfs_vnodeop_p,
+	    (uppervp != NULLVP ? uppervp : lowervp), &vp);
 	if (error != 0) {
-		kmem_free(unp, sizeof(*unp));
 		return (error);
 	}
 	if (dvp != NULLVP)
@@ -106,6 +107,7 @@
 	if (lowervp != NULLVP)
 		vref(lowervp);
 
+	unp = kmem_zalloc(sizeof(*unp), KM_SLEEP);
 	unp->un_vnode = vp;
 	unp->un_uppervp = uppervp;
 	unp->un_lowervp = lowervp;

Reply via email to