summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_default.c2
-rw-r--r--sys/vm/swap_pager.c3
-rw-r--r--sys/vm/vm_object.c2
-rw-r--r--sys/vm/vm_pager.c5
-rw-r--r--sys/vm/vnode_pager.c7
5 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 5ecb4aa28573..6587752f2817 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -657,11 +657,11 @@ vop_stddestroyvobject(ap)
else
VM_OBJECT_UNLOCK(obj);
} else {
- VM_OBJECT_UNLOCK(obj);
/*
* Woe to the process that tries to page now :-).
*/
vm_pager_deallocate(obj);
+ VM_OBJECT_UNLOCK(obj);
}
return (0);
}
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index b21d6acccec2..fcb7a09cf245 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -428,9 +428,8 @@ swap_pager_dealloc(object)
}
mtx_unlock(&sw_alloc_mtx);
- VM_OBJECT_LOCK(object);
+ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
vm_object_pip_wait(object, "swpdea");
- VM_OBJECT_UNLOCK(object);
/*
* Free all remaining metadata. We only bother to free it from
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index dc33f0055ab2..4e1f037d7c39 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -600,12 +600,12 @@ vm_object_terminate(vm_object_t object)
}
vm_page_unlock_queues();
splx(s);
- VM_OBJECT_UNLOCK(object);
/*
* Let the pager know object is dead.
*/
vm_pager_deallocate(object);
+ VM_OBJECT_UNLOCK(object);
/*
* Remove the object from the global object list.
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c
index 46bdd411bee9..5747930eb5d4 100644
--- a/sys/vm/vm_pager.c
+++ b/sys/vm/vm_pager.c
@@ -256,10 +256,15 @@ vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size,
return (ret);
}
+/*
+ * The object must be locked.
+ */
void
vm_pager_deallocate(object)
vm_object_t object;
{
+
+ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
(*pagertab[object->type]->pgo_dealloc) (object);
}
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index 8115908c6b17..60890e1a4ae0 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -175,19 +175,20 @@ vnode_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
return (object);
}
+/*
+ * The object must be locked.
+ */
static void
vnode_pager_dealloc(object)
vm_object_t object;
{
struct vnode *vp = object->handle;
- GIANT_REQUIRED;
if (vp == NULL)
panic("vnode_pager_dealloc: pager already dealloced");
- VM_OBJECT_LOCK(object);
+ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
vm_object_pip_wait(object, "vnpdea");
- VM_OBJECT_UNLOCK(object);
object->handle = NULL;
object->type = OBJT_DEAD;