summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-11-09 22:09:04 +0000
committeralc <alc@FreeBSD.org>2003-11-09 22:09:04 +0000
commitb2bc11d840b269eb5927723a806087bb3444d082 (patch)
treee01c4379016581f313959e38c98f7afddfeecae1 /sys/vm/vm_mmap.c
parentb5775784dd2b0165b4cd9c025e3d8ff6cb67b0e4 (diff)
downloadFreeBSD-src-b2bc11d840b269eb5927723a806087bb3444d082.zip
FreeBSD-src-b2bc11d840b269eb5927723a806087bb3444d082.tar.gz
- Remove Giant from msync(2). Giant is still acquired by the lower layers
if we drop into the pmap or vnode layers. - Migrate the handling of zero-length msync(2)s into vm_map_sync() so that multithread applications can't change the map between implementing the zero-length hack in msync(2) and reacquiring the map lock in vm_map_sync(). Reviewed by: tegge
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r--sys/vm/vm_mmap.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 158a443..95e335a 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -546,40 +546,13 @@ msync(td, uap)
if ((flags & (MS_ASYNC|MS_INVALIDATE)) == (MS_ASYNC|MS_INVALIDATE))
return (EINVAL);
- mtx_lock(&Giant);
-
map = &td->td_proc->p_vmspace->vm_map;
/*
- * XXX Gak! If size is zero we are supposed to sync "all modified
- * pages with the region containing addr". Unfortunately, we don't
- * really keep track of individual mmaps so we approximate by flushing
- * the range of the map entry containing addr. This can be incorrect
- * if the region splits or is coalesced with a neighbor.
- */
- if (size == 0) {
- vm_map_entry_t entry;
-
- vm_map_lock_read(map);
- rv = vm_map_lookup_entry(map, addr, &entry);
- vm_map_unlock_read(map);
- if (rv == FALSE) {
- rv = -1;
- goto done2;
- }
- addr = entry->start;
- size = entry->end - entry->start;
- }
-
- /*
* Clean the pages and interpret the return value.
*/
rv = vm_map_sync(map, addr, addr + size, (flags & MS_ASYNC) == 0,
(flags & MS_INVALIDATE) != 0);
-
-done2:
- mtx_unlock(&Giant);
-
switch (rv) {
case KERN_SUCCESS:
return (0);
OpenPOWER on IntegriCloud