summaryrefslogtreecommitdiffstats
path: root/sys/fs/unionfs/union_vfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/unionfs/union_vfsops.c')
-rw-r--r--sys/fs/unionfs/union_vfsops.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index 5018f09..d38f31e 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/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