Subject: null/umap/unionfs: small cleanup
To: None <wrstuden@netbsd.org, tech-kern@netbsd.org>
From: Assar Westerlund <assar@netbsd.org>
List: tech-kern
Date: 08/02/2001 17:06:37
--=-=-=

It looks like all of these three filesystems call namei with
WANTPARENT to just discard it immediately.  Is there any reason for
this?  If not, I propose applying the appended patch.  Any comments?

/assar


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=wantparent.diff

Index: nullfs/null_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/nullfs/null_vfsops.c,v
retrieving revision 1.30
diff -u -w -r1.30 null_vfsops.c
--- nullfs/null_vfsops.c	2001/06/07 13:44:46	1.30
+++ nullfs/null_vfsops.c	2001/08/02 15:04:16
@@ -139,7 +139,7 @@
 	/*
 	 * Find lower node
 	 */
-	NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT|LOCKLEAF,
+	NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF,
 		UIO_USERSPACE, args.la.target, p);
 	if ((error = namei(ndp)) != 0)
 		return (error);
@@ -148,9 +148,6 @@
 	 * Sanity check on lower vnode
 	 */
 	lowerrootvp = ndp->ni_vp;
-
-	vrele(ndp->ni_dvp);
-	ndp->ni_dvp = NULL;
 
 	/*
 	 * First cut at fixing up upper mount point
Index: umapfs/umap_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/umapfs/umap_vfsops.c,v
retrieving revision 1.27
diff -u -w -r1.27 umap_vfsops.c
--- umapfs/umap_vfsops.c	2001/01/22 12:17:40	1.27
+++ umapfs/umap_vfsops.c	2001/08/02 15:04:17
@@ -110,7 +110,7 @@
 	/*
 	 * Find lower node
 	 */
-	NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT|LOCKLEAF,
+	NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF,
 		UIO_USERSPACE, args.umap_target, p);
 	if ((error = namei(ndp)) != 0)
 		return (error);
@@ -122,8 +122,6 @@
 #ifdef UMAPFS_DIAGNOSTIC
 	printf("vp = %p, check for VDIR...\n", lowerrootvp);
 #endif
-	vrele(ndp->ni_dvp);
-	ndp->ni_dvp = 0;
 
 	if (lowerrootvp->v_type != VDIR) {
 		vput(lowerrootvp);
Index: union/union_vfsops.c
===================================================================
RCS file: /cvsroot/syssrc/sys/miscfs/union/union_vfsops.c,v
retrieving revision 1.26
diff -u -w -r1.26 union_vfsops.c
--- union/union_vfsops.c	2001/01/22 12:17:40	1.26
+++ union/union_vfsops.c	2001/08/02 15:04:17
@@ -125,15 +125,13 @@
 	/*
 	 * Find upper node.
 	 */
-	NDINIT(ndp, LOOKUP, FOLLOW|WANTPARENT,
+	NDINIT(ndp, LOOKUP, FOLLOW,
 	       UIO_USERSPACE, args.target, p);
 
 	if ((error = namei(ndp)) != 0)
 		goto bad;
 
 	upperrootvp = ndp->ni_vp;
-	vrele(ndp->ni_dvp);
-	ndp->ni_dvp = NULL;
 
 	if (upperrootvp->v_type != VDIR) {
 		error = EINVAL;

--=-=-=--