libbarrelfish: vspace_pinned_alloc: acquire lock nested, as we can recurse back into...
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Thu, 15 Dec 2016 17:38:53 +0000 (18:38 +0100)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Thu, 15 Dec 2016 17:38:53 +0000 (18:38 +0100)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

lib/barrelfish/vspace/pinned.c

index e01940e..3bb0054 100644 (file)
@@ -93,7 +93,9 @@ errval_t vspace_pinned_alloc(void **retbuf, enum slab_type slab_type)
         return LIB_ERR_VSPACE_PINNED_INVALID_TYPE;
     }
 
-    thread_mutex_lock(&state->mutex);
+    // memobj->fill() can recurse into vspace_alloc_pinned(), so we need to
+    // acquire this lock in nested mode
+    thread_mutex_lock_nested(&state->mutex);
 
     // Try allocating
     static bool is_refilling = false;