gfs_file_inactive: replace bad code with ugly code

Also, make it explicit that V_XATTRDIR is not properly supported in gfs
code yet.

The bad code was plain incorrect: (a) it spoiled handling of v_usecount
reaching zero and (b) it leaked v_holdcnt.

The ugly code employs potentially unsafe locking tricks.

Ideally we should separate vnode lifecycle and gfs node lifecycle.
A gfs node should have its own reference count where its child nodes
should be accounted.

PR:		kern/151111
Reviewed by:	kib
MFC after:	13 days
This commit is contained in:
Andriy Gapon 2012-12-01 18:12:55 +00:00
parent 30bf6110b5
commit 992ffc58ae

View File

@ -665,8 +665,10 @@ gfs_file_inactive(vnode_t *vp)
ge = NULL;
found:
#ifdef TODO
if (vp->v_flag & V_XATTRDIR)
VI_LOCK(fp->gfs_parent);
#endif
VI_LOCK(vp);
/*
* Really remove this vnode
@ -687,16 +689,17 @@ gfs_file_inactive(vnode_t *vp)
if (fp->gfs_parent) {
if (dp)
gfs_dir_unlock(dp);
VI_LOCK(fp->gfs_parent);
fp->gfs_parent->v_usecount--;
VI_UNLOCK(fp->gfs_parent);
VOP_UNLOCK(vp, 0);
VN_RELE(fp->gfs_parent);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
} else {
ASSERT(vp->v_vfsp != NULL);
VFS_RELE(vp->v_vfsp);
}
#ifdef TODO
if (vp->v_flag & V_XATTRDIR)
VI_UNLOCK(fp->gfs_parent);
#endif
return (data);
}