diff options
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/procfs/procfs_map.c | 8 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_mem.c | 11 | ||||
-rw-r--r-- | sys/fs/specfs/spec_vnops.c | 5 |
3 files changed, 7 insertions, 17 deletions
diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c index 047a67f..692594d 100644 --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -81,14 +81,14 @@ procfs_domap(curp, p, pfs, uio) vm_map_entry_t entry; char mebuffer[MEBUFFERSIZE]; + GIANT_REQUIRED; + if (uio->uio_rw != UIO_READ) return (EOPNOTSUPP); if (uio->uio_offset != 0) return (0); - mtx_lock(&vm_mtx); - error = 0; if (map != &curproc->p_vmspace->vm_map) vm_map_lock_read(map); @@ -171,17 +171,13 @@ case OBJT_DEVICE: error = EFBIG; break; } - mtx_unlock(&vm_mtx); error = uiomove(mebuffer, len, uio); - mtx_lock(&vm_mtx); if (error) break; } if (map != &curproc->p_vmspace->vm_map) vm_map_unlock_read(map); - mtx_unlock(&vm_mtx); - return error; } diff --git a/sys/fs/procfs/procfs_mem.c b/sys/fs/procfs/procfs_mem.c index b8c60d6..e109146 100644 --- a/sys/fs/procfs/procfs_mem.c +++ b/sys/fs/procfs/procfs_mem.c @@ -83,6 +83,8 @@ procfs_rwmem(curp, p, uio) vm_prot_t reqprot; vm_offset_t kva; + GIANT_REQUIRED; + /* * if the vmspace is in the midst of being deallocated or the * process is exiting, don't try to grab anything. The page table @@ -91,12 +93,8 @@ procfs_rwmem(curp, p, uio) vm = p->p_vmspace; if ((p->p_flag & P_WEXIT)) return EFAULT; - - mtx_lock(&vm_mtx); - if (vm->vm_refcnt < 1) { - mtx_unlock(&vm_mtx); + if (vm->vm_refcnt < 1) return EFAULT; - } ++vm->vm_refcnt; /* * The map we want... @@ -214,9 +212,7 @@ procfs_rwmem(curp, p, uio) /* * Now do the i/o move. */ - mtx_unlock(&vm_mtx); error = uiomove((caddr_t)(kva + page_offset), len, uio); - mtx_lock(&vm_mtx); pmap_kremove(kva); @@ -235,7 +231,6 @@ procfs_rwmem(curp, p, uio) kmem_free(kernel_map, kva, PAGE_SIZE); vmspace_free(vm); - mtx_unlock(&vm_mtx); return (error); } diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 5ed07c0..f2b1c34 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -660,7 +660,8 @@ spec_getpages(ap) int blksiz; int gotreqpage; - mtx_assert(&Giant, MA_OWNED); + GIANT_REQUIRED; + error = 0; pcount = round_page(ap->a_count) / PAGE_SIZE; @@ -732,7 +733,6 @@ spec_getpages(ap) cnt.v_vnodein++; cnt.v_vnodepgsin += pcount; - mtx_unlock(&vm_mtx); /* Do the input. */ BUF_STRATEGY(bp); @@ -743,7 +743,6 @@ spec_getpages(ap) tsleep(bp, PVM, "spread", 0); splx(s); - mtx_lock(&vm_mtx); if ((bp->b_ioflags & BIO_ERROR) != 0) { if (bp->b_error) |