Index: sys/fs/tmpfs/tmpfs_vfsops.c =================================================================== --- sys/fs/tmpfs/tmpfs_vfsops.c +++ sys/fs/tmpfs/tmpfs_vfsops.c @@ -438,4 +438,4 @@ .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, }; -VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); +VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL | VFCF_SUSPEND); Index: sys/kern/vfs_vnops.c =================================================================== --- sys/kern/vfs_vnops.c +++ sys/kern/vfs_vnops.c @@ -1572,6 +1572,25 @@ return (error); } +static bool +vn_has_suspend_mp(struct mount *mp) +{ + + return ((mp->mnt_vfc->vfc_flags & VFCF_SUSPEND) != 0); +} + +static bool +vn_has_suspend(struct vnode *vp, struct mount **mpp) +{ + + if (vp != NULL) + *mpp = vp->v_mount; + if (*mpp == NULL) + return (false); + + return (vn_has_suspend_mp(*mpp)); +} + /* * Preparing to start a filesystem write operation. If the operation is * permitted, then we bump the count of operations in progress and @@ -1621,6 +1640,9 @@ struct mount *mp; int error; + if (!vn_has_suspend(vp, mpp)) + return (0); + error = 0; /* * If a vnode is provided, get and return the mount point that @@ -1683,6 +1705,7 @@ if ((mp = *mpp) == NULL) return (0); + MPASS(vn_has_suspend_mp(mp)); /* * VOP_GETWRITEMOUNT() returns with the mp refcount held through * a vfs_ref(). @@ -1724,7 +1747,7 @@ vn_finished_write(mp) struct mount *mp; { - if (mp == NULL) + if (mp == NULL || !vn_has_suspend_mp(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1749,6 +1772,7 @@ { if (mp == NULL) return; + MPASS(vn_has_suspend_mp(mp)); MNT_ILOCK(mp); MNT_REL(mp); mp->mnt_secondary_writes--; @@ -1770,6 +1794,8 @@ { int error; + MPASS(vn_has_suspend_mp(mp)); + MNT_ILOCK(mp); if (mp->mnt_susp_owner == curthread) { MNT_IUNLOCK(mp); @@ -1811,6 +1837,8 @@ vfs_write_resume(struct mount *mp, int flags) { + MPASS(vn_has_suspend_mp(mp)); + MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { KASSERT(mp->mnt_susp_owner == curthread, ("mnt_susp_owner")); @@ -1844,6 +1872,7 @@ { int error; + MPASS(vn_has_suspend_mp(mp)); KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0, ("vfs_write_suspend_umnt: recursed")); Index: sys/sys/mount.h =================================================================== --- sys/sys/mount.h +++ sys/sys/mount.h @@ -511,6 +511,7 @@ #define VFCF_JAIL 0x00400000 /* can be mounted from within a jail */ #define VFCF_DELEGADMIN 0x00800000 /* supports delegated administration */ #define VFCF_SBDRY 0x01000000 /* defer stop requests */ +#define VFCF_SUSPEND 0x02000000 /* rely on VFS to provide suspension */ typedef uint32_t fsctlop_t; Index: sys/ufs/ffs/ffs_vfsops.c =================================================================== --- sys/ufs/ffs/ffs_vfsops.c +++ sys/ufs/ffs/ffs_vfsops.c @@ -109,7 +109,7 @@ .vfs_susp_clean = process_deferred_inactive, }; -VFS_SET(ufs_vfsops, ufs, 0); +VFS_SET(ufs_vfsops, ufs, VFCF_SUSPEND); MODULE_VERSION(ufs, 1); static b_strategy_t ffs_geom_strategy;