summaryrefslogtreecommitdiff
path: root/sys/msdosfs/msdosfs_vfsops.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2017-05-29 14:07:17 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2017-05-29 14:07:17 +0000
commitf4d37800595ef62f944a7168c1ce6e5cabdd3e4e (patch)
tree7f5c7f62088152d1681aa91e5c4a1f8f2fb2d4ec /sys/msdosfs/msdosfs_vfsops.c
parent83920e2e5440a3c9f885ab545ee5b9c75cbdc824 (diff)
msdosfs & ffs: flush cache if updating mount from r/w to r/o
ok deraadt@
Diffstat (limited to 'sys/msdosfs/msdosfs_vfsops.c')
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index e13b0b1ea0b..5c426a2c37e 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.83 2016/10/10 00:34:50 bluhm Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.84 2017/05/29 14:07:16 sf Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
@@ -64,6 +64,7 @@
#include <sys/malloc.h>
#include <sys/dirent.h>
#include <sys/disk.h>
+#include <sys/dkio.h>
#include <sys/stdint.h>
#include <msdosfs/bpb.h>
@@ -128,8 +129,14 @@ msdosfs_mount(struct mount *mp, const char *path, void *data,
if (mp->mnt_flag & MNT_FORCE)
flags |= FORCECLOSE;
error = vflush(mp, NULLVP, flags);
- if (!error)
+ if (!error) {
+ int force = 0;
+
pmp->pm_flags |= MSDOSFSMNT_RONLY;
+ /* may be not supported, ignore error */
+ VOP_IOCTL(pmp->pm_devvp, DIOCCACHESYNC,
+ &force, FWRITE, FSCRED, p);
+ }
}
if (!error && (mp->mnt_flag & MNT_RELOAD))
/* not yet implemented */