Provide vfs suspension support only for filesystems which need it, take

two.

nullfs and unionfs need to request suspension if underlying filesystem(s)
use it. Utilize mnt_kern_flag for this purpose.

This is a fixup for 273271.

No strong objections from: kib
Pointy hat to: mjg
MFC after:	2 weeks
This commit is contained in:
Mateusz Guzik 2014-10-20 18:00:50 +00:00
parent a8a07fd613
commit 4fce16e4c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273336
6 changed files with 18 additions and 16 deletions

View File

@ -198,6 +198,8 @@ nullfs_mount(struct mount *mp)
MNTK_EXTENDED_SHARED);
}
mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT;
mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag &
MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
mp->mnt_data = xmp;
vfs_getnewfsid(mp);

View File

@ -255,6 +255,7 @@ tmpfs_mount(struct mount *mp)
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
mp->mnt_kern_flag |= MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
mp->mnt_data = tmp;
@ -426,14 +427,6 @@ tmpfs_sync(struct mount *mp, int waitfor)
return (0);
}
/*
* A stub created so that vfs does vn_start_write for this filesystem
*/
static void
tmpfs_susp_clean(struct mount *mp)
{
}
/*
* tmpfs vfs operations.
*/
@ -445,6 +438,5 @@ struct vfsops tmpfs_vfsops = {
.vfs_statfs = tmpfs_statfs,
.vfs_fhtovp = tmpfs_fhtovp,
.vfs_sync = tmpfs_sync,
.vfs_susp_clean = tmpfs_susp_clean,
};
VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL);

View File

@ -297,6 +297,13 @@ unionfs_domount(struct mount *mp)
if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) &&
(ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL))
mp->mnt_flag |= MNT_LOCAL;
/*
* Check mnt_kern_flag
*/
if ((ump->um_lowervp->v_mount->mnt_flag & MNTK_SUSPENDABLE) ||
(ump->um_uppervp->v_mount->mnt_flag & MNTK_SUSPENDABLE))
mp->mnt_kern_flag |= MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
/*

View File

@ -1576,7 +1576,7 @@ static bool
vn_suspendable_mp(struct mount *mp)
{
return (mp->mnt_op->vfs_susp_clean != NULL);
return ((mp->mnt_kern_flag & MNTK_SUSPENDABLE) != 0);
}
static bool

View File

@ -361,7 +361,7 @@ void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *);
#define MNTK_SUSPEND 0x08000000 /* request write suspension */
#define MNTK_SUSPEND2 0x04000000 /* block secondary writes */
#define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */
#define MNTK_UNUSED25 0x20000000 /* --available-- */
#define MNTK_SUSPENDABLE 0x20000000 /* writes can be suspended */
#define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */
#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */
@ -754,10 +754,11 @@ vfs_statfs_t __vfs_statfs;
_rc; })
#define VFS_SUSP_CLEAN(MP) do { \
MPASS(*(MP)->mnt_op->vfs_susp_clean != NULL); \
VFS_PROLOGUE(MP); \
(*(MP)->mnt_op->vfs_susp_clean)(MP); \
VFS_EPILOGUE(MP); \
if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \
VFS_PROLOGUE(MP); \
(*(MP)->mnt_op->vfs_susp_clean)(MP); \
VFS_EPILOGUE(MP); \
} \
} while (0)
#define VFS_RECLAIM_LOWERVP(MP, VP) do { \

View File

@ -1055,7 +1055,7 @@ ffs_mountfs(devvp, mp, td)
*/
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS;
MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS | MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
#ifdef UFS_EXTATTR
#ifdef UFS_EXTATTR_AUTOSTART