aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-25 23:25:58 -0400
committerIan Moffett <ian@osmora.org>2024-05-25 23:25:58 -0400
commit60bff6e739eb8556b4cb0229ea29fa24b04e19d0 (patch)
tree249814247e2e7136d128121a98e171e4a4f81df8 /sys/vm/vm_map.c
parentab3e000fdefa15404bf0a25dee375e684b02eb00 (diff)
kernel: vm_map: Fix cleanup in munmap()
- vm_obj_destroy() handles vnode cleanup so we don't need to worry about that. - No need to acquire the lock. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 11222e0..ca1d18a 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -279,9 +279,7 @@ munmap(void *addr, size_t len)
{
struct proc *td = this_td();
struct vm_mapping *mapping;
-
struct vm_object *obj;
- struct vnode *vp;
struct vm_mapspace *ms;
size_t map_len, granule;
@@ -302,19 +300,15 @@ munmap(void *addr, size_t len)
/* Try to release any virtual memory objects */
if ((obj = mapping->vmobj) != NULL) {
- spinlock_acquire(&obj->lock);
/*
* Drop our ref and try to cleanup. If the refcount
* is > 0, something is still holding it and we can't
* do much.
*/
vm_object_unref(obj);
- vp = obj->vnode;
- if (vp != NULL && obj->ref == 0) {
- vp->vmobj = NULL;
+ if (obj->ref == 0) {
vm_obj_destroy(obj);
}
- spinlock_release(&obj->lock);
}
/* Release the mapping */