Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Feb 2012 15:15:36 +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: r232303 - head/sys/fs/nullfs
Message-ID:  <201202291515.q1TFFaiT032469@svn.freebsd.org>

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

Log:
  In null_reclaim(), assert that reclaimed vnode is fully constructed,
  instead of accepting half-constructed vnode. Previous code cannot decide
  what to do with such vnode anyway, and although processing it for hash
  removal, paniced later when getting rid of nullfs reference on lowervp.
  
  While there, remove initializations from the declaration block.
  
  Tested by:	pho
  MFC after:	1 week

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

Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c	Wed Feb 29 15:10:34 2012	(r232302)
+++ head/sys/fs/nullfs/null_vnops.c	Wed Feb 29 15:15:36 2012	(r232303)
@@ -697,12 +697,18 @@ null_inactive(struct vop_inactive_args *
 static int
 null_reclaim(struct vop_reclaim_args *ap)
 {
-	struct vnode *vp = ap->a_vp;
-	struct null_node *xp = VTONULL(vp);
-	struct vnode *lowervp = xp->null_lowervp;
+	struct vnode *vp;
+	struct null_node *xp;
+	struct vnode *lowervp;
+
+	vp = ap->a_vp;
+	xp = VTONULL(vp);
+	lowervp = xp->null_lowervp;
+
+	KASSERT(lowervp != NULL && vp->v_vnlock != &vp->v_lock,
+	    ("Reclaiming inclomplete null vnode %p", vp));
 
-	if (lowervp)
-		null_hashrem(xp);
+	null_hashrem(xp);
 	/*
 	 * Use the interlock to protect the clearing of v_data to
 	 * prevent faults in null_lock().
@@ -713,10 +719,7 @@ null_reclaim(struct vop_reclaim_args *ap
 	vp->v_object = NULL;
 	vp->v_vnlock = &vp->v_lock;
 	VI_UNLOCK(vp);
-	if (lowervp)
-		vput(lowervp);
-	else
-		panic("null_reclaim: reclaiming a node with no lowervp");
+	vput(lowervp);
 	free(xp, M_NULLFSNODE);
 
 	return (0);



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