aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2004-05-25 23:01:21 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2004-05-25 23:01:21 +0000
commit30735f364d173dca7ee848d6827908ec809f1dd6 (patch)
treeccb3431036db8d5238f9842da96e9b8335ffbaa1
parent4a6f9d7da947326cb6b18fbad6b27c7fc2de9550 (diff)
downloadsrc-30735f364d173dca7ee848d6827908ec809f1dd6.tar.gz
src-30735f364d173dca7ee848d6827908ec809f1dd6.zip
MFS: msync(2) with the MS_INVALIDATE flag should not delete dirty pages.
Approved by: so
Notes
Notes: svn path=/releng/4.9/; revision=129736
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c2
-rw-r--r--sys/vm/vm_map.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index 9d95dac03921..5c77bd1c07d6 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/ufs/ufs/ufs_readwrite.c
@@ -532,6 +532,8 @@ WRITE(ap)
bp->b_flags |= B_DIRECT;
if (ioflag & IO_NOWDRAIN)
bp->b_flags |= B_NOWDRAIN;
+ if ((ioflag & (IO_SYNC|IO_INVAL)) == (IO_SYNC|IO_INVAL))
+ bp->b_flags |= B_NOCACHE;
if (uio->uio_offset + xfersize > ip->i_size) {
ip->i_size = uio->uio_offset + xfersize;
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 59f08e802d2b..056dc4e54d6f 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -70,6 +70,8 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/vmmeter.h>
#include <sys/mman.h>
@@ -149,6 +151,10 @@ static void vm_map_copy_entry __P((vm_map_t, vm_map_t, vm_map_entry_t,
static void vm_map_split __P((vm_map_entry_t));
static void vm_map_unclip_range __P((vm_map_t map, vm_map_entry_t start_entry, vm_offset_t start, vm_offset_t end, int flags));
+static int old_msync;
+SYSCTL_INT(_vm, OID_AUTO, old_msync, CTLFLAG_RW, &old_msync, 0,
+ "Use old (insecure) msync behavior");
+
void
vm_map_startup()
{
@@ -2013,7 +2019,7 @@ vm_map_clean(map, start, end, syncio, invalidate)
vm_object_page_remove(object,
OFF_TO_IDX(offset),
OFF_TO_IDX(offset + size + PAGE_MASK),
- FALSE);
+ old_msync ? FALSE : TRUE);
vm_object_deallocate(object);
}
start += size;