From 60bff6e739eb8556b4cb0229ea29fa24b04e19d0 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 25 May 2024 23:25:58 -0400 Subject: 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 --- sys/vm/vm_map.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'sys/vm') 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 */ -- cgit v1.2.3