De-commision the MNTK_NOINSMNTQ kernel mount flag.

After all the changes, its dynamic scope is same as for MNTK_UNMOUNT,
but to allow the syncer vnode to be re-installed on unmount failure.
But the case of syncer was already handled by using the VV_FORCEINSMQ
flag for quite some time.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2019-08-23 19:40:10 +00:00
parent 95f5211e9a
commit e671edac06
4 changed files with 8 additions and 16 deletions

View File

@ -1387,14 +1387,13 @@ dounmount(struct mount *mp, int flags, struct thread *td)
dounmount_cleanup(mp, coveredvp, 0);
return (EBUSY);
}
mp->mnt_kern_flag |= MNTK_UNMOUNT | MNTK_NOINSMNTQ;
mp->mnt_kern_flag |= MNTK_UNMOUNT;
if (flags & MNT_NONBUSY) {
MNT_IUNLOCK(mp);
error = vfs_check_usecounts(mp);
MNT_ILOCK(mp);
if (error != 0) {
dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT |
MNTK_NOINSMNTQ);
dounmount_cleanup(mp, coveredvp, MNTK_UNMOUNT);
return (error);
}
}
@ -1456,7 +1455,6 @@ dounmount(struct mount *mp, int flags, struct thread *td)
*/
if (error && error != ENXIO) {
MNT_ILOCK(mp);
mp->mnt_kern_flag &= ~MNTK_NOINSMNTQ;
if ((mp->mnt_flag & MNT_RDONLY) == 0) {
MNT_IUNLOCK(mp);
vfs_allocate_syncvnode(mp);

View File

@ -1698,7 +1698,7 @@ insmntque1(struct vnode *vp, struct mount *mp,
*/
MNT_ILOCK(mp);
VI_LOCK(vp);
if (((mp->mnt_kern_flag & MNTK_NOINSMNTQ) != 0 &&
if (((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 &&
((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0 ||
mp->mnt_nvnodelistsize == 0)) &&
(vp->v_vflag & VV_FORCEINSMQ) == 0) {
@ -3818,7 +3818,6 @@ DB_SHOW_COMMAND(mount, db_show_mount)
MNT_KERN_FLAG(MNTK_UNMOUNTF);
MNT_KERN_FLAG(MNTK_ASYNC);
MNT_KERN_FLAG(MNTK_SOFTDEP);
MNT_KERN_FLAG(MNTK_NOINSMNTQ);
MNT_KERN_FLAG(MNTK_DRAINING);
MNT_KERN_FLAG(MNTK_REFEXPIRE);
MNT_KERN_FLAG(MNTK_EXTENDED_SHARED);

View File

@ -368,23 +368,20 @@ void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *);
/*
* Internal filesystem control flags stored in mnt_kern_flag.
*
* MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed
* past the mount point. This keeps the subtree stable during mounts
* and unmounts.
* MNTK_UNMOUNT locks the mount entry so that name lookup cannot
* proceed past the mount point. This keeps the subtree stable during
* mounts and unmounts. When non-forced unmount flushes all vnodes
* from the mp queue, the MNTK_UNMOUNT flag prevents insmntque() from
* queueing new vnodes.
*
* MNTK_UNMOUNTF permits filesystems to detect a forced unmount while
* dounmount() is still waiting to lock the mountpoint. This allows
* the filesystem to cancel operations that might otherwise deadlock
* with the unmount attempt (used by NFS).
*
* MNTK_NOINSMNTQ is strict subset of MNTK_UNMOUNT. They are separated
* to allow for failed unmount attempt to restore the syncer vnode for
* the mount.
*/
#define MNTK_UNMOUNTF 0x00000001 /* forced unmount in progress */
#define MNTK_ASYNC 0x00000002 /* filtered async flag */
#define MNTK_SOFTDEP 0x00000004 /* async disabled by softdep */
#define MNTK_NOINSMNTQ 0x00000008 /* insmntque is not allowed */
#define MNTK_DRAINING 0x00000010 /* lock draining is happening */
#define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */
#define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */

View File

@ -2028,8 +2028,6 @@ softdep_flushfiles(oldmnt, flags, td)
if (oldmnt->mnt_kern_flag & MNTK_UNMOUNT) {
retry = 0;
MNT_ILOCK(oldmnt);
KASSERT((oldmnt->mnt_kern_flag & MNTK_NOINSMNTQ) != 0,
("softdep_flushfiles: !MNTK_NOINSMNTQ"));
morework = oldmnt->mnt_nvnodelistsize > 0;
#ifdef QUOTA
ump = VFSTOUFS(oldmnt);