diff options
author | Pedro Martelletto <pedro@cvs.openbsd.org> | 2005-09-29 22:31:31 +0000 |
---|---|---|
committer | Pedro Martelletto <pedro@cvs.openbsd.org> | 2005-09-29 22:31:31 +0000 |
commit | 77ba0228677547ab5a13dce7ade677414f766b89 (patch) | |
tree | 77a9111d95da3f0dfc1428b0f58d944016c974d3 /sys/ufs/ffs | |
parent | 079c31dd38aea9cf7c0dfda4f8d2124729e5fa11 (diff) |
Sync dirty data when going from read-write to read-only.
Verified against FreeBSD, closes PR 4526, okay deraadt@.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 9 |
1 files changed, 8 insertions, 1 deletions
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; |