summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-02-29 15:15:36 +0000
committerkib <kib@FreeBSD.org>2012-02-29 15:15:36 +0000
commitebc5c1c3cce3dd42ce0b712c8d0d1d2e88c5e730 (patch)
tree3712b075bfbe2aacf256f4e76e8ef24ace856c74 /sys/fs
parenta51474db9378c81bf6a6f6a4399829ee32a53b68 (diff)
downloadFreeBSD-src-ebc5c1c3cce3dd42ce0b712c8d0d1d2e88c5e730.zip
FreeBSD-src-ebc5c1c3cce3dd42ce0b712c8d0d1d2e88c5e730.tar.gz
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
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nullfs/null_vnops.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index e0645bd..b607666 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -697,12 +697,18 @@ null_inactive(struct vop_inactive_args *ap)
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);
OpenPOWER on IntegriCloud