msdosfs: Add trivial support for suspension.

Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D27269
This commit is contained in:
Konstantin Belousov 2020-11-20 12:31:02 +00:00
parent c17b2a79bd
commit 1b3cb4dc04
2 changed files with 8 additions and 2 deletions

View File

@ -950,6 +950,12 @@ msdosfs_sync(struct mount *mp, int waitfor)
error = msdosfs_fsiflush(pmp, waitfor); error = msdosfs_fsiflush(pmp, waitfor);
if (error != 0) if (error != 0)
allerror = error; allerror = error;
if (allerror == 0 && waitfor == MNT_SUSPEND) {
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED;
MNT_IUNLOCK(mp);
}
return (allerror); return (allerror);
} }

View File

@ -848,7 +848,7 @@ msdosfs_fsync(struct vop_fsync_args *ap)
* Non-critical metadata for associated directory entries only * Non-critical metadata for associated directory entries only
* gets synced accidentally, as in most file systems. * gets synced accidentally, as in most file systems.
*/ */
if (ap->a_waitfor == MNT_WAIT) { if (ap->a_waitfor != MNT_NOWAIT) {
devvp = VTODE(ap->a_vp)->de_pmp->pm_devvp; devvp = VTODE(ap->a_vp)->de_pmp->pm_devvp;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
allerror = VOP_FSYNC(devvp, MNT_WAIT, ap->a_td); allerror = VOP_FSYNC(devvp, MNT_WAIT, ap->a_td);
@ -856,7 +856,7 @@ msdosfs_fsync(struct vop_fsync_args *ap)
} else } else
allerror = 0; allerror = 0;
error = deupdat(VTODE(ap->a_vp), ap->a_waitfor == MNT_WAIT); error = deupdat(VTODE(ap->a_vp), ap->a_waitfor != MNT_NOWAIT);
if (allerror == 0) if (allerror == 0)
allerror = error; allerror = error;
return (allerror); return (allerror);