--- linux-source-2.6.28.orig/fs/ext3/ialloc.c 2008-12-24 17:26:37.000000000 -0600 +++ linux-source-2.6.28/fs/ext3/ialloc.c 2009-06-07 14:09:38.000000000 -0500 @@ -207,6 +207,7 @@ static int find_group_dir(struct super_b freei = percpu_counter_read_positive(&EXT3_SB(sb)->s_freeinodes_counter); avefreei = freei / ngroups; + fallback: for (group = 0; group < ngroups; group++) { desc = ext3_get_group_desc (sb, group, NULL); if (!desc || !desc->bg_free_inodes_count) @@ -220,6 +221,14 @@ static int find_group_dir(struct super_b best_desc = desc; } } + if (avefreei && best_group == -1) { + /* + * The free-inodes counter is approximate, and + * the above test can fail to find any blockgroups + */ + avefreei = 0; + goto fallback; + } return best_group; }