From 77ba0228677547ab5a13dce7ade677414f766b89 Mon Sep 17 00:00:00 2001 From: Pedro Martelletto Date: Thu, 29 Sep 2005 22:31:31 +0000 Subject: Sync dirty data when going from read-write to read-only. Verified against FreeBSD, closes PR 4526, okay deraadt@. --- sys/ufs/ffs/ffs_vfsops.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/ufs/ffs') diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 0c54b77c511..98566ea48be 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.70 2005/07/03 20:14:02 drahn Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.71 2005/09/29 22:31:30 pedro Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -202,6 +202,13 @@ ffs_mount(mp, path, data, ndp, p) ronly = fs->fs_ronly; if (ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { + /* + * Flush any dirty data. + */ + VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p); + /* + * Get rid of files open for writing. + */ flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; -- cgit v1.2.3