When scanning the freelist looking for candidate vnodes to recycle,

be sure to exit the loop with vp == NULL if no candidates are found.
Formerly, this bug would cause the last vnode inspected to be used,
even if it was not available. The result was a panic "vn_finished_write:
neg cnt".

Sponsored by:	DARPA & NAI Labs.
This commit is contained in:
Kirk McKusick 2002-10-14 19:54:39 +00:00
parent 289e09ee73
commit a6b9f47b31

View File

@ -925,11 +925,10 @@ getnewvnode(tag, mp, vops, vpp)
mtx_unlock(&vnode_free_list_mtx);
error = vcanrecycle(vp, &vnmp);
mtx_lock(&vnode_free_list_mtx);
if (error != 0)
TAILQ_INSERT_TAIL(&vnode_free_list, vp,
v_freelist);
else
if (error == 0)
break;
TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
vp = NULL;
}
}
if (vp) {