summaryrefslogtreecommitdiff
path: root/libpager/lock-completed.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-02-21 20:16:42 +0000
committerMiles Bader <miles@gnu.org>1996-02-21 20:16:42 +0000
commit356382a974a7bfb0dcb22e644286f4546433125b (patch)
treec9cf157c7941fddcb672332dac1332a921468c05 /libpager/lock-completed.c
parentb6ffaa9df33d114d6a50cb528ad51aef42986c4f (diff)
(_pager_seqnos_memory_object_lock_completed):
Be picky about always releasing SEQNO.
Diffstat (limited to 'libpager/lock-completed.c')
-rw-r--r--libpager/lock-completed.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libpager/lock-completed.c b/libpager/lock-completed.c
index 47a55064..45dbfcbf 100644
--- a/libpager/lock-completed.c
+++ b/libpager/lock-completed.c
@@ -29,6 +29,7 @@ _pager_seqnos_memory_object_lock_completed (mach_port_t object,
vm_offset_t offset,
vm_size_t length)
{
+ error_t err = 0;
struct pager *p;
struct lock_request *lr;
@@ -41,18 +42,18 @@ _pager_seqnos_memory_object_lock_completed (mach_port_t object,
return EOPNOTSUPP;
}
+ mutex_lock (&p->interlock);
+ _pager_wait_for_seqno (p, seqno);
+
if (control != p->memobjcntl)
{
printf ("lock_completed: bad control port\n");
- ports_port_deref (p);
- return EPERM;
+ err = EPERM;
+ goto out;
}
mach_port_deallocate (mach_task_self (), control);
- mutex_lock (&p->interlock);
- _pager_wait_for_seqno (p, seqno);
-
for (lr = p->lock_requests; lr; lr = lr->next)
if (lr->start == offset && lr->end == offset + length)
{
@@ -67,9 +68,10 @@ _pager_seqnos_memory_object_lock_completed (mach_port_t object,
barf ("orphaned lock_request: p %#x <port = %d>; offset %#x; length %#x\n",
(int) p, p->port.port_right, offset, length);
+ out:
_pager_release_seqno (p, seqno);
mutex_unlock (&p->interlock);
ports_port_deref (p);
- return 0;
+ return err;
}