summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2014-10-20 18:00:50 +0000
committermjg <mjg@FreeBSD.org>2014-10-20 18:00:50 +0000
commit12e0034dd069b0f2d2b0cf11d216afbe99094438 (patch)
treee51e6a7989eefd8dc56ac47c5d0db6b3380c4a81
parentd6c735be7798e52e8a242ae20504aa525caf1b00 (diff)
downloadFreeBSD-src-12e0034dd069b0f2d2b0cf11d216afbe99094438.zip
FreeBSD-src-12e0034dd069b0f2d2b0cf11d216afbe99094438.tar.gz
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
-rw-r--r--sys/fs/nullfs/null_vfsops.c2
-rw-r--r--sys/fs/tmpfs/tmpfs_vfsops.c10
-rw-r--r--sys/fs/unionfs/union_vfsops.c7
-rw-r--r--sys/kern/vfs_vnops.c2
-rw-r--r--sys/sys/mount.h11
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c2
6 files changed, 18 insertions, 16 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 80824a5..fd3d385 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -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);
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c
index f0bb96b..4777234 100644
--- a/sys/fs/tmpfs/tmpfs_vfsops.c
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c
@@ -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;
@@ -427,14 +428,6 @@ tmpfs_sync(struct mount *mp, int waitfor)
}
/*
- * 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);
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index c60b02c..e4b9fb5 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -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);
/*
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 7a72137..b3e1c3b 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -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
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 633c6db..c4e1145 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -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 { \
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index d532e1b3..a047ef4 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -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
OpenPOWER on IntegriCloud