From 6c122e4c770d0229ef32962da0c99f4d4a8f0e89 Mon Sep 17 00:00:00 2001 From: jhb Date: Wed, 13 Jul 2005 15:12:19 +0000 Subject: Wrap the ia64-specific freebsd32_mmap_partial() hack in Giant for now since it calls into VFS and VM. This makes the freebsd32_mmap() routine MP safe and the extra Giants here can be revisited later. Glanced at by: marcel MFC after: 3 days --- sys/compat/freebsd32/freebsd32_misc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index de4881e..b84e9dd 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -397,6 +397,7 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap) start = addr; end = addr + len; + mtx_lock(&Giant); if (start != trunc_page(start)) { error = freebsd32_mmap_partial(td, start, round_page(start), prot, @@ -427,11 +428,14 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap) prot |= VM_PROT_WRITE; map = &td->td_proc->p_vmspace->vm_map; rv = vm_map_remove(map, start, end); - if (rv != KERN_SUCCESS) + if (rv != KERN_SUCCESS) { + mtx_unlock(&Giant); return (EINVAL); + } rv = vm_map_find(map, 0, 0, &start, end - start, FALSE, prot, VM_PROT_ALL, 0); + mtx_unlock(&Giant); if (rv != KERN_SUCCESS) return (EINVAL); r.fd = fd; @@ -445,6 +449,7 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap) td->td_retval[0] = addr; return (0); } + mtx_unlock(&Giant); if (end == start) { /* * After dealing with the ragged ends, there -- cgit v1.1