Index: uspace/lib/ext4/libext4_ialloc.c
===================================================================
--- uspace/lib/ext4/libext4_ialloc.c	(revision 2f59112756a7b4e140a34a9de2e2150cdffe0fb1)
+++ uspace/lib/ext4/libext4_ialloc.c	(revision 44183b98263c7398ff611132b0a9d5a068ae69fe)
@@ -195,6 +195,18 @@
 		uint32_t used_dirs = ext4_block_group_get_used_dirs_count(bg, sb);
 		
-		/* Check if this block group is good candidate for allocation */
-		if ((free_inodes >= avg_free_inodes) && (free_blocks > 0)) {
+		/*
+		 * Check if this block group is a good candidate
+		 * for allocation.
+		 *
+		 * The criterion is based on the average number
+		 * of free inodes, unless we examine the last block
+		 * group. In that case the last block group might
+		 * have less than the average number of free inodes,
+		 * but it still needs to be taken as a candidate
+		 * because the previous block groups have zero free
+		 * blocks.
+		 */
+		if (((free_inodes >= avg_free_inodes) || (bgid == bg_count - 1)) &&
+		    (free_blocks > 0)) {
 			/* Load block with bitmap */
 			uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
