Index: uspace/lib/c/generic/rcu.c
===================================================================
--- uspace/lib/c/generic/rcu.c	(revision 38d8849c5dae9664aadfb5dfe635e66fd4bcb908)
+++ uspace/lib/c/generic/rcu.c	(revision 42f5860963db60eafa4b16ddff590121a76573c6)
@@ -105,12 +105,10 @@
 	size_t cur_gp;
 	size_t reader_group;
-	futex_t list_futex;
+	fibril_rmutex_t list_mutex;
 	list_t fibrils_list;
 	struct {
-		futex_t futex;
+		fibril_rmutex_t mutex;
 		bool locked;
 		list_t blocked_fibrils;
-		size_t blocked_thread_cnt;
-		futex_t futex_blocking_threads;
 	} sync_lock;
 } rcu_data_t;
@@ -137,12 +135,10 @@
 	.cur_gp = 0,
 	.reader_group = RCU_GROUP_A,
-	.list_futex = FUTEX_INITIALIZER,
+	.list_mutex = FIBRIL_RMUTEX_INITIALIZER(rcu.list_mutex),
 	.fibrils_list = LIST_INITIALIZER(rcu.fibrils_list),
 	.sync_lock = {
-		.futex = FUTEX_INITIALIZER,
+		.mutex = FIBRIL_RMUTEX_INITIALIZER(rcu.sync_lock.mutex),
 		.locked = false,
 		.blocked_fibrils = LIST_INITIALIZER(rcu.sync_lock.blocked_fibrils),
-		.blocked_thread_cnt = 0,
-		.futex_blocking_threads = FUTEX_INITIALIZE(0),
 	},
 };
@@ -171,7 +167,7 @@
 	assert(!fibril_rcu.registered);
 
-	futex_lock(&rcu.list_futex);
+	fibril_rmutex_lock(&rcu.list_mutex);
 	list_append(&fibril_rcu.link, &rcu.fibrils_list);
-	futex_unlock(&rcu.list_futex);
+	fibril_rmutex_unlock(&rcu.list_mutex);
 
 	fibril_rcu.registered = true;
@@ -196,7 +192,7 @@
 	fibril_rcu.nesting_cnt = 0;
 
-	futex_lock(&rcu.list_futex);
+	fibril_rmutex_lock(&rcu.list_mutex);
 	list_remove(&fibril_rcu.link);
-	futex_unlock(&rcu.list_futex);
+	fibril_rmutex_unlock(&rcu.list_mutex);
 
 	fibril_rcu.registered = false;
@@ -333,5 +329,5 @@
 static void wait_for_readers(size_t reader_group)
 {
-	futex_lock(&rcu.list_futex);
+	fibril_rmutex_lock(&rcu.list_mutex);
 
 	list_t quiescent_fibrils;
@@ -344,7 +340,7 @@
 
 			if (is_preexisting_reader(fib, reader_group)) {
-				futex_unlock(&rcu.list_futex);
+				fibril_rmutex_unlock(&rcu.list_mutex);
 				sync_sleep();
-				futex_lock(&rcu.list_futex);
+				fibril_rmutex_lock(&rcu.list_mutex);
 				/* Break to while loop. */
 				break;
@@ -357,10 +353,10 @@
 
 	list_concat(&rcu.fibrils_list, &quiescent_fibrils);
-	futex_unlock(&rcu.list_futex);
+	fibril_rmutex_unlock(&rcu.list_mutex);
 }
 
 static void lock_sync(void)
 {
-	futex_lock(&rcu.sync_lock.futex);
+	fibril_rmutex_lock(&rcu.sync_lock.mutex);
 	if (rcu.sync_lock.locked) {
 		blocked_fibril_t blocked_fib;
@@ -371,9 +367,9 @@
 		do {
 			blocked_fib.is_ready = false;
-			futex_unlock(&rcu.sync_lock.futex);
+			fibril_rmutex_unlock(&rcu.sync_lock.mutex);
 			futex_lock(&async_futex);
 			fibril_switch(FIBRIL_FROM_BLOCKED);
 			futex_unlock(&async_futex);
-			futex_lock(&rcu.sync_lock.futex);
+			fibril_rmutex_lock(&rcu.sync_lock.mutex);
 		} while (rcu.sync_lock.locked);
 
@@ -389,27 +385,18 @@
 	assert(rcu.sync_lock.locked);
 
-	/*
-	 * Blocked threads have a priority over fibrils when accessing sync().
-	 * Pass the lock onto a waiting thread.
-	 */
-	if (0 < rcu.sync_lock.blocked_thread_cnt) {
-		--rcu.sync_lock.blocked_thread_cnt;
-		futex_unlock(&rcu.sync_lock.futex_blocking_threads);
-	} else {
-		/* Unlock but wake up any fibrils waiting for the lock. */
-
-		if (!list_empty(&rcu.sync_lock.blocked_fibrils)) {
-			blocked_fibril_t *blocked_fib = member_to_inst(
-			    list_first(&rcu.sync_lock.blocked_fibrils), blocked_fibril_t, link);
-
-			if (!blocked_fib->is_ready) {
-				blocked_fib->is_ready = true;
-				fibril_add_ready(blocked_fib->id);
-			}
+	/* Unlock but wake up any fibrils waiting for the lock. */
+
+	if (!list_empty(&rcu.sync_lock.blocked_fibrils)) {
+		blocked_fibril_t *blocked_fib = member_to_inst(
+		    list_first(&rcu.sync_lock.blocked_fibrils), blocked_fibril_t, link);
+
+		if (!blocked_fib->is_ready) {
+			blocked_fib->is_ready = true;
+			fibril_add_ready(blocked_fib->id);
 		}
-
-		rcu.sync_lock.locked = false;
-		futex_unlock(&rcu.sync_lock.futex);
 	}
+
+	rcu.sync_lock.locked = false;
+	fibril_rmutex_unlock(&rcu.sync_lock.mutex);
 }
 
@@ -421,7 +408,7 @@
 	 * but keep sync locked.
 	 */
-	futex_unlock(&rcu.sync_lock.futex);
+	fibril_rmutex_unlock(&rcu.sync_lock.mutex);
 	fibril_usleep(RCU_SLEEP_MS * 1000);
-	futex_lock(&rcu.sync_lock.futex);
+	fibril_rmutex_lock(&rcu.sync_lock.mutex);
 }
 
