Project

General

Profile

Bug #11679

Updated by Dan McDonald 11 months ago

vn_rele() and its friends frends have an antipattern:

<pre><code class="c">
void
vn_rele(vnode_t *vp)
{
VERIFY(vp->v_count > 0); /* XXX KEBE ASKS WHY HERE? */
mutex_enter(&vp->v_lock);
/* XXX KEBE ASKS AND NOT HERE? */
if (vp->v_count == 1) {
mutex_exit(&vp->v_lock);
VOP_INACTIVE(vp, CRED(), NULL);
return;
}
VN_RELE_LOCKED(vp);
mutex_exit(&vp->v_lock);
}
</code></pre>

Before commit b5fca8f855 put this as a VERIFY, it's predecessors had an if v_count check also outside the vp mutex. These should be checked AFTER the mutex gets held. In general the v_count should never be 0 at this point, but the more accurate measurement can only happen post-mutex-hold.

Back