Index: uspace/lib/c/generic/fibril_synch.c
===================================================================
--- uspace/lib/c/generic/fibril_synch.c	(revision 55bd76cdfcb40d7b25063357b27a0b77e7b71022)
+++ uspace/lib/c/generic/fibril_synch.c	(revision 9414abc19106996bac61d12354e75953aa14bf29)
@@ -180,7 +180,8 @@
 void fibril_rwlock_read_lock(fibril_rwlock_t *frw)
 {
+	fibril_t *f = (fibril_t *) fibril_get_id();
+	
 	futex_down(&async_futex);
 	if (frw->writers) {
-		fibril_t *f = (fibril_t *) fibril_get_id();
 		awaiter_t wdata;
 
@@ -195,5 +196,7 @@
 		fibril_switch(FIBRIL_TO_MANAGER);
 	} else {
-		frw->readers++;
+		/* Consider the first reader the owner. */
+		if (frw->readers++ == 0)
+			frw->oi.owned_by = f;
 		futex_up(&async_futex);
 	}
@@ -229,6 +232,21 @@
 	assert(frw->readers || (frw->writers == 1));
 	if (frw->readers) {
-		if (--frw->readers)
+		if (--frw->readers) {
+			if (frw->oi.owned_by == (fibril_t *) fibril_get_id()) {
+				/*
+				 * If this reader firbril was considered the
+				 * owner of this rwlock, clear the ownership
+				 * information even if there are still more
+				 * readers.
+				 *
+				 * This is the limitation of the detection
+				 * mechanism rooted in the fact that tracking
+				 * all readers would require dynamically
+				 * allocated memory for keeping linkage info.
+				 */
+				frw->oi.owned_by = NULL;
+			}
 			goto out;
+		}
 	} else {
 		frw->writers--;
@@ -265,5 +283,8 @@
 			list_remove(&wdp->wu_event.link);
 			fibril_add_ready(wdp->fid);
-			frw->readers++;
+			if (frw->readers++ == 0) {
+				/* Consider the first reader the owner. */
+				frw->oi.owned_by = f;
+			}
 			optimize_execution_power();
 		}
