diff options
author | mckusick <mckusick@FreeBSD.org> | 2002-10-14 19:54:39 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2002-10-14 19:54:39 +0000 |
commit | 9d00a4a781eb15e7fa43415462c01f82087ded69 (patch) | |
tree | 0e7d91ba0d6fc1e8d0e5c4ccd42436c79f8cd94e /sys | |
parent | d2fd70cb7659674bc3ddcff83526377d4e7c3bb8 (diff) | |
download | FreeBSD-src-9d00a4a781eb15e7fa43415462c01f82087ded69.zip FreeBSD-src-9d00a4a781eb15e7fa43415462c01f82087ded69.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_subr.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 579f08d..101dffd 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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) { |