The same as is already implemented for ffs & msdosfs. ok?
Cheers, Stefan diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 53eaa05a32a..98d5536418c 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -181,6 +181,7 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, ump = VFSTOUFS(mp); fs = ump->um_e2fs; if (fs->e2fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { + int force = 0; flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; @@ -193,6 +194,12 @@ ext2fs_mount(struct mount *mp, const char *path, void *data, } if (error) return (error); + /* + * Updating mount to readonly. Try a cache flush. + * Ignore error because the ioctl may not be supported. + */ + VOP_IOCTL(ump->um_devvp, DIOCCACHESYNC, &force, + FWRITE, FSCRED, p); fs->e2fs_ronly = 1; } if (mp->mnt_flag & MNT_RELOAD) {