[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Alfred M. Szmidt
Subject: pager
Date: Fri, 03 Dec 2004 10:28:35 +0100

Following looks correct to me.  OK to commit?

Summary: libpager/data-request.c: missing call to
_pager_allow_termination; elide unlock relock sequence in the fast

Original Submission: Please see the discussion here:


I am happy with this patch. This just needs approval from,
e.g. Roland. I have added this to the savannah patch manager so that
it will not get lost.


2004-09-28  Neal H. Walfield  <neal@cs.uml.edu>
            Ognyan Kulev  <ogi@fmi.uni-sofia.bg>

        * data-request.c (_pager_seqnos_memory_object_data_request): 
        Elide gratuitous mutex_unlock, mutex_lock sequence.
        When _pager_pagemap_resize fails, clean up correctly.

Index: data-request.c
RCS file: /cvsroot/hurd/hurd/libpager/data-request.c,v
retrieving revision 1.22
diff -u -p -r1.22 data-request.c
--- data-request.c      8 May 2002 09:22:14 -0000       1.22
+++ data-request.c      28 Sep 2004 15:03:43 -0000
@@ -68,13 +68,16 @@ _pager_seqnos_memory_object_data_request
       printf ("pager in wrong state for read\n");
       _pager_release_seqno (p, seqno);
-      mutex_unlock (&p->interlock);
       goto allow_term_out;
   err = _pager_pagemap_resize (p, offset + length);
   if (err)
-    goto release_out;          /* Can't do much about the actual error.  */
+    {
+      /* Can't do much about the actual error.  */
+      _pager_release_seqno (p, seqno);
+      goto allow_term_out;
+    }
   /* If someone is paging this out right now, the disk contents are
      unreliable, so we have to wait.  It is too expensive (right now) to
@@ -109,10 +112,12 @@ _pager_seqnos_memory_object_data_request
   /* Let someone else in.  */
   _pager_release_seqno (p, seqno);
-  mutex_unlock (&p->interlock);
   if (!doread)
     goto allow_term_out;
+  mutex_unlock (&p->interlock);
   if (doerror)
     goto error_read;
@@ -133,8 +138,8 @@ _pager_seqnos_memory_object_data_request
   memory_object_data_error (p->memobjcntl, offset, length, EIO);
   _pager_mark_object_error (p, offset, length, EIO);
- allow_term_out:
   mutex_lock (&p->interlock);
+ allow_term_out:
   _pager_allow_termination (p);
   mutex_unlock (&p->interlock);
   ports_port_deref (p);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]