Index: dist/Makefile
===================================================================
--- dist/Makefile	(revision b05e2fea495fd5f11723d2735513f3ab996c0fab)
+++ dist/Makefile	(revision b3bdb68ae47deaa07a48d445993b822630a063b8)
@@ -43,5 +43,10 @@
 
 SUFFIX = $(suffix $(IMGFILE))
-DISTFILE = HelenOS-$(RELEASE)-$(PLATFORM)-$(MACHINE)-$(PROCESSOR)$(SUFFIX)
+
+ifdef PROFILE
+	DISTFILE = Helenos-$(shell echo $(PROFILE) | tr '/' '-')$(SUFFIX)
+else
+	DISTFILE = HelenOS-$(RELEASE)-$(PLATFORM)-$(MACHINE)-$(PROCESSOR)$(SUFFIX)
+endif
 
 .PHONY: all clean dist distfile
@@ -53,4 +58,7 @@
 	cp $< $@
 
+$(IMGFILE):
+	$(MAKE) -C ..
+
 dist:
 	for profile in $(PROFILES); do \
Index: uspace/lib/block/libblock.c
===================================================================
--- uspace/lib/block/libblock.c	(revision b05e2fea495fd5f11723d2735513f3ab996c0fab)
+++ uspace/lib/block/libblock.c	(revision b3bdb68ae47deaa07a48d445993b822630a063b8)
@@ -411,4 +411,5 @@
 	l = hash_table_find(&cache->block_hash, &key);
 	if (l) {
+found:
 		/*
 		 * We found the block in the cache.
@@ -493,4 +494,18 @@
 					fibril_mutex_unlock(&b->lock);
 					goto retry;
+				}
+				l = hash_table_find(&cache->block_hash, &key);
+				if (l) {
+					/*
+					 * Someone else must have already
+					 * instantiated the block while we were
+					 * not holding the cache lock.
+					 * Leave the recycled block on the
+					 * freelist and continue as if we
+					 * found the block of interest during
+					 * the first try.
+					 */
+					fibril_mutex_unlock(&b->lock);
+					goto found;
 				}
 
