summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/fdesc/fdesc_vfsops.c16
-rw-r--r--sys/miscfs/nullfs/null_vfsops.c25
-rw-r--r--sys/miscfs/portal/portal_vfsops.c14
-rw-r--r--sys/miscfs/umapfs/umap_vfsops.c17
-rw-r--r--sys/miscfs/union/union_vfsops.c30
5 files changed, 16 insertions, 86 deletions
diff --git a/sys/miscfs/fdesc/fdesc_vfsops.c b/sys/miscfs/fdesc/fdesc_vfsops.c
index 900e1de..a758bb8 100644
--- a/sys/miscfs/fdesc/fdesc_vfsops.c
+++ b/sys/miscfs/fdesc/fdesc_vfsops.c
@@ -114,7 +114,6 @@ fdesc_unmount(mp, mntflags, p)
{
int error;
int flags = 0;
- struct vnode *rootvp = VFSTOFDESC(mp)->f_root;
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
@@ -123,21 +122,14 @@ fdesc_unmount(mp, mntflags, p)
* Clear out buffer cache. I don't think we
* ever get anything cached at this level at the
* moment, but who knows...
+ *
+ * There is 1 extra root vnode reference corresponding
+ * to f_root.
*/
- if (rootvp->v_usecount > 1)
- return (EBUSY);
- if ((error = vflush(mp, rootvp, flags)) != 0)
+ if ((error = vflush(mp, 1, flags)) != 0)
return (error);
/*
- * Release reference on underlying root vnode
- */
- vrele(rootvp);
- /*
- * And blow it away for future re-use
- */
- vgone(rootvp);
- /*
* Finally, throw away the fdescmount structure
*/
free(mp->mnt_data, M_FDESCMNT); /* XXX */
diff --git a/sys/miscfs/nullfs/null_vfsops.c b/sys/miscfs/nullfs/null_vfsops.c
index dfaefe3..8573398 100644
--- a/sys/miscfs/nullfs/null_vfsops.c
+++ b/sys/miscfs/nullfs/null_vfsops.c
@@ -229,7 +229,6 @@ nullfs_unmount(mp, mntflags, p)
int mntflags;
struct proc *p;
{
- struct vnode *vp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
void *mntdata;
int error;
int flags = 0;
@@ -239,31 +238,11 @@ nullfs_unmount(mp, mntflags, p)
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
- error = VFS_ROOT(mp, &vp);
- if (error)
- return (error);
- if (vp->v_usecount > 2) {
- NULLFSDEBUG("nullfs_unmount: rootvp is busy(%d)\n",
- vp->v_usecount);
- vput(vp);
- return (EBUSY);
- }
- error = vflush(mp, vp, flags);
+ /* There is 1 extra root vnode reference (nullm_rootvp). */
+ error = vflush(mp, 1, flags);
if (error)
return (error);
-#ifdef NULLFS_DEBUG
- vprint("alias root of lower", vp);
-#endif
- vput(vp);
- /*
- * Release reference on underlying root vnode
- */
- vrele(vp);
- /*
- * And blow it away for future re-use
- */
- vgone(vp);
/*
* Finally, throw away the null_mount structure
*/
diff --git a/sys/miscfs/portal/portal_vfsops.c b/sys/miscfs/portal/portal_vfsops.c
index 5146456..423cd38 100644
--- a/sys/miscfs/portal/portal_vfsops.c
+++ b/sys/miscfs/portal/portal_vfsops.c
@@ -155,7 +155,6 @@ portal_unmount(mp, mntflags, p)
int mntflags;
struct proc *p;
{
- struct vnode *rootvp = VFSTOPORTAL(mp)->pm_root;
int error, flags = 0;
@@ -172,21 +171,12 @@ portal_unmount(mp, mntflags, p)
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
- if (rootvp->v_usecount > 1)
- return (EBUSY);
- error = vflush(mp, rootvp, flags);
+ /* There is 1 extra root vnode reference (pm_root). */
+ error = vflush(mp, 1, flags);
if (error)
return (error);
/*
- * Release reference on underlying root vnode
- */
- vrele(rootvp);
- /*
- * And blow it away for future re-use
- */
- vgone(rootvp);
- /*
* Shutdown the socket. This will cause the select in the
* daemon to wake up, and then the accept will get ECONNABORTED
* which it interprets as a request to go and bury itself.
diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c
index e86467d..280ded9 100644
--- a/sys/miscfs/umapfs/umap_vfsops.c
+++ b/sys/miscfs/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
*/
diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c
index 5018f09..d38f31e 100644
--- a/sys/miscfs/union/union_vfsops.c
+++ b/sys/miscfs/union/union_vfsops.c
@@ -307,7 +307,6 @@ union_unmount(mp, mntflags, p)
struct proc *p;
{
struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
- struct vnode *um_rootvp;
int error;
int freeing;
int flags = 0;
@@ -317,9 +316,6 @@ union_unmount(mp, mntflags, p)
if (mntflags & MNT_FORCE)
flags |= FORCECLOSE;
- if ((error = union_root(mp, &um_rootvp)) != 0)
- return (error);
-
/*
* Keep flushing vnodes from the mount list.
* This is needed because of the un_pvp held
@@ -329,14 +325,13 @@ union_unmount(mp, mntflags, p)
* (d) times, where (d) is the maximum tree depth
* in the filesystem.
*/
- for (freeing = 0; vflush(mp, um_rootvp, flags) != 0;) {
+ for (freeing = 0; (error = vflush(mp, 0, flags)) != 0;) {
struct vnode *vp;
int n;
/* count #vnodes held on mount list */
- for (n = 0, vp = LIST_FIRST(&mp->mnt_vnodelist);
- vp != NULLVP;
- vp = LIST_NEXT(vp, v_mntvnodes))
+ n = 0;
+ LIST_FOREACH(vp, &mp->mnt_vnodelist, v_mntvnodes)
n++;
/* if this is unchanged then stop */
@@ -347,15 +342,10 @@ union_unmount(mp, mntflags, p)
freeing = n;
}
- /* At this point the root vnode should have a single reference */
- if (um_rootvp->v_usecount > 1) {
- vput(um_rootvp);
- return (EBUSY);
- }
+ /* If the most recent vflush failed, the filesystem is still busy. */
+ if (error)
+ return (error);
-#ifdef DEBUG
- vprint("union root", um_rootvp);
-#endif
/*
* Discard references to upper and lower target vnodes.
*/
@@ -364,14 +354,6 @@ union_unmount(mp, mntflags, p)
vrele(um->um_uppervp);
crfree(um->um_cred);
/*
- * Release reference on underlying root vnode
- */
- vput(um_rootvp);
- /*
- * And blow it away for future re-use
- */
- vgone(um_rootvp);
- /*
* Finally, throw away the union_mount structure
*/
free(mp->mnt_data, M_UNIONFSMNT); /* XXX */
OpenPOWER on IntegriCloud