diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2008-12-29 13:25:58 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2008-12-29 13:25:58 +0000 |
commit | 78e4cea909843cdab562cf4b542dfd11c1f56da5 (patch) | |
tree | 5cd3d5d9ed06ee1895073bb9c722780923946890 /sys/fs/pseudofs | |
parent | ddf9d243492455fad85a9816252375a38041f23b (diff) | |
download | src-78e4cea909843cdab562cf4b542dfd11c1f56da5.tar.gz src-78e4cea909843cdab562cf4b542dfd11c1f56da5.zip |
When the insmntque() in the pfs_vncache_alloc() fails, vop_reclaim calls
pfs_vncache_free() that removes pvd from the list, while it is not yet
put on the list.
Prevent the invalid removal from the list by clearing pvd_next and
pvd_prev for the newly allocated pvd, and only move pfs_vncache list
head when the pvd was at the head.
Suggested and approved by: des
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=186565
Diffstat (limited to 'sys/fs/pseudofs')
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vncache.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index fd2bce1933ca..0bacc03adc8d 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -149,6 +149,7 @@ retry: /* nope, get a new one */ pvd = malloc(sizeof *pvd, M_PFSVNCACHE, M_WAITOK); + pvd->pvd_next = pvd->pvd_prev = NULL; error = getnewvnode("pseudofs", mp, &pfs_vnodeops, vpp); if (error) { free(pvd, M_PFSVNCACHE); @@ -245,7 +246,7 @@ pfs_vncache_free(struct vnode *vp) pvd->pvd_next->pvd_prev = pvd->pvd_prev; if (pvd->pvd_prev) pvd->pvd_prev->pvd_next = pvd->pvd_next; - else + else if (pfs_vncache == pvd) pfs_vncache = pvd->pvd_next; --pfs_vncache_entries; mtx_unlock(&pfs_vncache_mutex); |