Index: sys/kern/vfs_mount.c =================================================================== --- sys/kern/vfs_mount.c +++ sys/kern/vfs_mount.c @@ -1703,6 +1703,7 @@ vdrop(coveredvp); } vn_finished_write(mp); + vfs_rel(mp); } /* @@ -2127,7 +2128,7 @@ vfs_op_enter(mp); - vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); + vn_start_write(NULL, &mp, V_WAIT); MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || (mp->mnt_flag & MNT_UPDATE) != 0 || @@ -2200,6 +2201,7 @@ vfs_deallocate_syncvnode(mp); error = VFS_UNMOUNT(mp, flags); vn_finished_write(mp); + vfs_rel(mp); /* * If we failed to flush the dirty blocks for this mount point, * undo all the cdir/rdir and rootvnode changes we made above. Index: sys/kern/vfs_vnops.c =================================================================== --- sys/kern/vfs_vnops.c +++ sys/kern/vfs_vnops.c @@ -1904,9 +1904,6 @@ struct mount *mp; int error; - KASSERT((flags & V_MNTREF) == 0 || (*mpp != NULL && vp == NULL), - ("V_MNTREF requires mp")); - error = 0; /* * If a vnode is provided, get and return the mount point that @@ -1930,7 +1927,7 @@ * refcount for the provided mountpoint too, in order to * emulate a vfs_ref(). */ - if (vp == NULL && (flags & V_MNTREF) == 0) + if (vp == NULL) vfs_ref(mp); return (vn_start_write_refed(mp, flags, false)); @@ -1949,9 +1946,6 @@ struct mount *mp; int error; - KASSERT((flags & V_MNTREF) == 0 || (*mpp != NULL && vp == NULL), - ("V_MNTREF requires mp")); - retry: if (vp != NULL) { if ((error = VOP_GETWRITEMOUNT(vp, mpp)) != 0) { @@ -1976,7 +1970,7 @@ * emulate a vfs_ref(). */ MNT_ILOCK(mp); - if (vp == NULL && (flags & V_MNTREF) == 0) + if (vp == NULL) MNT_REF(mp); if ((mp->mnt_kern_flag & (MNTK_SUSPENDED | MNTK_SUSPEND2)) == 0) { mp->mnt_secondary_writes++; Index: sys/sys/vnode.h =================================================================== --- sys/sys/vnode.h +++ sys/sys/vnode.h @@ -431,7 +431,6 @@ #define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ #define V_XSLEEP 0x0004 /* vn_start_write: just return after sleep */ -#define V_MNTREF 0x0010 /* vn_start_write: mp is already ref-ed */ #define VR_START_WRITE 0x0001 /* vfs_write_resume: start write atomically */ #define VR_NO_SUSPCLR 0x0002 /* vfs_write_resume: do not clear suspension */ Index: sys/ufs/ufs/ufs_vfsops.c =================================================================== --- sys/ufs/ufs/ufs_vfsops.c +++ sys/ufs/ufs/ufs_vfsops.c @@ -121,11 +121,12 @@ vfs_ref(mp); KASSERT(*mp_busy, ("%s called without busied mount", __func__)); - vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); + vn_start_write(NULL, &mp, V_WAIT); vfs_unbusy(mp); *mp_busy = false; error = quotaoff(td, mp, type); vn_finished_write(mp); + vfs_rel(mp); break; case Q_SETQUOTA32: