summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-12-09 10:00:47 +0000
committerkib <kib@FreeBSD.org>2014-12-09 10:00:47 +0000
commitc1b643c449f1877c49204939eaffb647358e2398 (patch)
treee49dab37d91311625d47672e5c6152a01c2b1c60 /sys/fs
parent86353785aa22b50719f7e109c7714ffd5c1482b8 (diff)
downloadFreeBSD-src-c1b643c449f1877c49204939eaffb647358e2398.zip
FreeBSD-src-c1b643c449f1877c49204939eaffb647358e2398.tar.gz
Do not call VFS_SYNC() before VFS_UNMOUNT() for forced unmount.
Since VFS does not/cannot stop writes, sync might run indefinitely, or be a wrong thing to do at all. E. g. NFS ignores VFS_SYNC() for forced unmounts, since non-responding server does not allow sync to finish. On the other hand, filesystems can and do stop writes using fs-specific facilities, and should already fully flush caches in VFS_UNMOUNT() due to the race. Adjust msdosfs tp sync in unmount for forced call, to accomodate the new behaviour. Note that it is still racy, since writes are not stopped. Discussed with: avg, bjk, mckusick Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 213dd00..d14cdef 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -797,11 +797,15 @@ msdosfs_unmount(struct mount *mp, int mntflags)
int error, flags;
flags = 0;
- if (mntflags & MNT_FORCE)
+ error = msdosfs_sync(mp, MNT_WAIT);
+ if ((mntflags & MNT_FORCE) != 0) {
flags |= FORCECLOSE;
+ } else if (error != 0) {
+ return (error);
+ }
error = vflush(mp, 0, flags, curthread);
- if (error && error != ENXIO)
- return error;
+ if (error != 0 && error != ENXIO)
+ return (error);
pmp = VFSTOMSDOSFS(mp);
if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) {
error = markvoldirty(pmp, 0);
OpenPOWER on IntegriCloud