summaryrefslogtreecommitdiffstats
path: root/sys/fs/umapfs
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-05-16 18:04:37 +0000
committeriedowse <iedowse@FreeBSD.org>2001-05-16 18:04:37 +0000
commitdafd513732df8c8fa7b8c5069ae3af2203853494 (patch)
tree57e0aeed936a6069b4a1048d66e40c879871f601 /sys/fs/umapfs
parent7faffe08a53e9fd2e664451fb6634f6377a33a46 (diff)
downloadFreeBSD-src-dafd513732df8c8fa7b8c5069ae3af2203853494.zip
FreeBSD-src-dafd513732df8c8fa7b8c5069ae3af2203853494.tar.gz
Change the second argument of vflush() to an integer that specifies
the number of references on the filesystem root vnode to be both expected and released. Many filesystems hold an extra reference on the filesystem root vnode, which must be accounted for when determining if the filesystem is busy and then released if it isn't busy. The old `skipvp' approach required individual filesystem xxx_unmount functions to re-implement much of vflush()'s logic to deal with the root vnode. All 9 filesystems that hold an extra reference on the root vnode got the logic wrong in the case of forced unmounts, so `umount -f' would always fail if there were any extra root vnode references. Fix this issue centrally in vflush(), now that we can. This commit also fixes a vnode reference leak in devfs, which could result in idle devfs filesystems that refuse to unmount. Reviewed by: phk, bp
Diffstat (limited to 'sys/fs/umapfs')
-rw-r--r--sys/fs/umapfs/umap_vfsops.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c
index e86467d..280ded9 100644
--- a/sys/fs/umapfs/umap_vfsops.c
+++ b/sys/fs/umapfs/umap_vfsops.c
@@ -260,7 +260,6 @@ umapfs_unmount(mp, mntflags, p)
int mntflags;
struct proc *p;
{
- struct vnode *umapm_rootvp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
int error;
int flags = 0;
@@ -281,23 +280,11 @@ umapfs_unmount(mp, mntflags, p)
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
- if (umapm_rootvp->v_usecount > 1)
- return (EBUSY);
- error = vflush(mp, umapm_rootvp, flags);
+ /* There is 1 extra root vnode reference (umapm_rootvp). */
+ error = vflush(mp, 1, flags);
if (error)
return (error);
-#ifdef DEBUG
- vprint("alias root of lower", umapm_rootvp);
-#endif
- /*
- * Release reference on underlying root vnode
- */
- vrele(umapm_rootvp);
- /*
- * And blow it away for future re-use
- */
- vgone(umapm_rootvp);
/*
* Finally, throw away the umap_mount structure
*/
OpenPOWER on IntegriCloud