aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2015-07-05 22:37:33 +0000
committerMark Johnston <markj@FreeBSD.org>2015-07-05 22:37:33 +0000
commit5f34e93c58c81382a7620bdfa69e47380a9615d4 (patch)
tree2b584c1ebc21d09c5c4b2fe8539dd7d22e9cbd7c /sys/kern/vfs_vnops.c
parent010ba3842c6933428a3fecd3695901bbf8707e4d (diff)
downloadsrc-5f34e93c58c81382a7620bdfa69e47380a9615d4.tar.gz
src-5f34e93c58c81382a7620bdfa69e47380a9615d4.zip
Check suspendability on the mountpoint returned by VOP_GETWRITEMOUNT.
This obviates the need for a MNTK_SUSPENDABLE flag, since passthrough filesystems like nullfs and unionfs no longer need to inherit this information from their lower layer(s). This change also restores the pre-r273336 behaviour of using the presence of a susp_clean VFS method to request suspension support. Reviewed by: kib, mjg Differential Revision: https://reviews.freebsd.org/D2937
Notes
Notes: svn path=/head/; revision=285182
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c48
1 files changed, 19 insertions, 29 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 0b073b9cf110..c8c49810b503 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1589,22 +1589,10 @@ vn_closefile(fp, td)
}
static bool
-vn_suspendable_mp(struct mount *mp)
+vn_suspendable(struct mount *mp)
{
- return ((mp->mnt_kern_flag & MNTK_SUSPENDABLE) != 0);
-}
-
-static bool
-vn_suspendable(struct vnode *vp, struct mount **mpp)
-{
-
- if (vp != NULL)
- *mpp = vp->v_mount;
- if (*mpp == NULL)
- return (false);
-
- return (vn_suspendable_mp(*mpp));
+ return (mp->mnt_op->vfs_susp_clean != NULL);
}
/*
@@ -1657,11 +1645,6 @@ vn_start_write(struct vnode *vp, struct mount **mpp, int flags)
KASSERT((flags & V_MNTREF) == 0 || (*mpp != NULL && vp == NULL),
("V_MNTREF requires mp"));
- if (!vn_suspendable(vp, mpp)) {
- if ((flags & V_MNTREF) != 0)
- vfs_rel(*mpp);
- return (0);
- }
error = 0;
/*
@@ -1679,6 +1662,12 @@ vn_start_write(struct vnode *vp, struct mount **mpp, int flags)
if ((mp = *mpp) == NULL)
return (0);
+ if (!vn_suspendable(mp)) {
+ if (vp != NULL || (flags & V_MNTREF) != 0)
+ vfs_rel(mp);
+ return (0);
+ }
+
/*
* VOP_GETWRITEMOUNT() returns with the mp refcount held through
* a vfs_ref().
@@ -1708,11 +1697,6 @@ vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags)
KASSERT((flags & V_MNTREF) == 0 || (*mpp != NULL && vp == NULL),
("V_MNTREF requires mp"));
- if (!vn_suspendable(vp, mpp)) {
- if ((flags & V_MNTREF) != 0)
- vfs_rel(*mpp);
- return (0);
- }
retry:
if (vp != NULL) {
@@ -1730,6 +1714,12 @@ vn_start_secondary_write(struct vnode *vp, struct mount **mpp, int flags)
if ((mp = *mpp) == NULL)
return (0);
+ if (!vn_suspendable(mp)) {
+ if (vp != NULL || (flags & V_MNTREF) != 0)
+ vfs_rel(mp);
+ return (0);
+ }
+
/*
* VOP_GETWRITEMOUNT() returns with the mp refcount held through
* a vfs_ref().
@@ -1772,7 +1762,7 @@ void
vn_finished_write(mp)
struct mount *mp;
{
- if (mp == NULL || !vn_suspendable_mp(mp))
+ if (mp == NULL || !vn_suspendable(mp))
return;
MNT_ILOCK(mp);
MNT_REL(mp);
@@ -1795,7 +1785,7 @@ void
vn_finished_secondary_write(mp)
struct mount *mp;
{
- if (mp == NULL || !vn_suspendable_mp(mp))
+ if (mp == NULL || !vn_suspendable(mp))
return;
MNT_ILOCK(mp);
MNT_REL(mp);
@@ -1818,7 +1808,7 @@ vfs_write_suspend(struct mount *mp, int flags)
{
int error;
- MPASS(vn_suspendable_mp(mp));
+ MPASS(vn_suspendable(mp));
MNT_ILOCK(mp);
if (mp->mnt_susp_owner == curthread) {
@@ -1861,7 +1851,7 @@ void
vfs_write_resume(struct mount *mp, int flags)
{
- MPASS(vn_suspendable_mp(mp));
+ MPASS(vn_suspendable(mp));
MNT_ILOCK(mp);
if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) {
@@ -1896,7 +1886,7 @@ vfs_write_suspend_umnt(struct mount *mp)
{
int error;
- MPASS(vn_suspendable_mp(mp));
+ MPASS(vn_suspendable(mp));
KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0,
("vfs_write_suspend_umnt: recursed"));