Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Feb 2012 15:06:00 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232299 - head/sys/fs/nullfs
Message-ID:  <201202291506.q1TF60xx031984@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Feb 29 15:06:00 2012
New Revision: 232299
URL: http://svn.freebsd.org/changeset/base/232299

Log:
  Move the code to destroy half-contructed nullfs vnode into helper
  function null_destroy_proto() from null_insmntque_dtr(). Also
  apply null_destroy_proto() in null_nodeget() when we raced and a vnode
  is found in the hash, so the currently allocated protonode shall be
  destroyed.
  
  Lock the vnode interlock around reassigning the v_vnlock.
  
  In fact, this path will not be exercised after several later commits,
  since null_nodeget() cannot take shared-locked lowervp at all due to
  insmntque() requirements.
  
  Reported by:	rea
  Tested by:	pho
  MFC after:	1 week

Modified:
  head/sys/fs/nullfs/null_subr.c

Modified: head/sys/fs/nullfs/null_subr.c
==============================================================================
--- head/sys/fs/nullfs/null_subr.c	Wed Feb 29 14:50:17 2012	(r232298)
+++ head/sys/fs/nullfs/null_subr.c	Wed Feb 29 15:06:00 2012	(r232299)
@@ -169,17 +169,26 @@ null_hashins(mp, xp)
 }
 
 static void
-null_insmntque_dtr(struct vnode *vp, void *xp)
+null_destroy_proto(struct vnode *vp, void *xp)
 {
 
-	vput(((struct null_node *)xp)->null_lowervp);
+	VI_LOCK(vp);
 	vp->v_data = NULL;
 	vp->v_vnlock = &vp->v_lock;
-	free(xp, M_NULLFSNODE);
 	vp->v_op = &dead_vnodeops;
+	VI_UNLOCK(vp);
 	(void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	vgone(vp);
 	vput(vp);
+	free(xp, M_NULLFSNODE);
+}
+
+static void
+null_insmntque_dtr(struct vnode *vp, void *xp)
+{
+
+	vput(((struct null_node *)xp)->null_lowervp);
+	null_destroy_proto(vp, xp);
 }
 
 /*
@@ -247,9 +256,7 @@ null_nodeget(mp, lowervp, vpp)
 	*vpp = null_hashins(mp, xp);
 	if (*vpp != NULL) {
 		vrele(lowervp);
-		vp->v_vnlock = &vp->v_lock;
-		xp->null_lowervp = NULL;
-		vrele(vp);
+		null_destroy_proto(vp, xp);
 		return (0);
 	}
 	*vpp = vp;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202291506.q1TF60xx031984>