summaryrefslogtreecommitdiff
path: root/debian/patches/libpager-deadlock.patch
blob: 2fb85f034973c5293ae3f1ae1cd172410281899b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/libpager/pager-attr.c b/libpager/pager-attr.c
index 7629f1d..ad1560e 100644
--- a/libpager/pager-attr.c
+++ b/libpager/pager-attr.c
@@ -19,9 +19,9 @@
 #include <assert.h>
 
 /* Change the attributes of the memory object underlying pager P.
-   Args MAY_CACHE and COPY_STRATEGY are as for 
-   memory_object_change_atributes.  Wait for the kernel to report completion
-   off WAIT is set.*/
+   Arguments MAY_CACHE and COPY_STRATEGY are as for
+   memory_object_change_atributes.  Wait for the kernel to report
+   completion if WAIT is set.  */
 void
 pager_change_attributes (struct pager *p,
  			 boolean_t may_cache,
@@ -77,11 +77,14 @@ pager_change_attributes (struct pager *p,
 	}
     }      
 
+  pthread_mutex_unlock (&p->interlock);
   memory_object_change_attributes (p->memobjcntl, may_cache, copy_strategy,
 				   wait ? p->port.port_right : MACH_PORT_NULL);
   
   if (wait)
     {
+      pthread_mutex_lock (&p->interlock);
+
       while (ar->attrs_pending)
 	pthread_cond_wait (&p->wakeup, &p->interlock);
 
@@ -92,7 +95,7 @@ pager_change_attributes (struct pager *p,
 	    ar->next->prevp = ar->prevp;
 	  free (ar);
 	}
+
+      pthread_mutex_unlock (&p->interlock);
     }
-  
-  pthread_mutex_unlock (&p->interlock);
 }
diff --git a/libpager/pager.h b/libpager/pager.h
index 75ff108..d0572af 100644
--- a/libpager/pager.h
+++ b/libpager/pager.h
@@ -111,9 +111,9 @@ pager_offer_page (struct pager *pager,
 		  vm_address_t buf);  
 
 /* Change the attributes of the memory object underlying pager PAGER.
-   Args MAY_CACHE and COPY_STRATEGY are as for
-   memory_object_change_atributes.  Wait for the kernel to report completion
-   off WAIT is set.*/
+   Arguments MAY_CACHE and COPY_STRATEGY are as for
+   memory_object_change_atributes.  Wait for the kernel to report
+   completion if WAIT is set.  */
 void
 pager_change_attributes (struct pager *pager,
 			 boolean_t may_cache,