[PATCH] minor bugfix agains ext2

Alex Tomas (bzzz@tmi.comex.ru)
12 Mar 2003 18:57:26 +0300


Hi!

looks like following code in 2.5.64 has bug:

for (bit = 0; !group_alloc &&
bit < sbi->s_groups_count; bit++) {
group_no++;
if (group_no >= sbi->s_groups_count)
group_no = 0;
desc = ext2_get_group_desc(sb, group_no, &gdp_bh);
if (!desc)
goto io_error;
group_alloc = group_reserve_blocks(desc, gdp_bh, es_alloc);
}
if (bit >= sbi->s_groups_count) {
*err = -ENOSPC;
goto out_release;
}

if group_reserve_blocks() finds free blocks on last repeat then if (bit >= ...)
will be true, and ext2_new_block() will return -ENOSPC.

here is the patch:

--- linux/fs/ext2/balloc.c Thu Feb 20 16:18:53 2003
+++ balloc.c Wed Mar 12 18:47:21 2003
@@ -395,7 +395,7 @@
goto io_error;
group_alloc = group_reserve_blocks(desc, gdp_bh, es_alloc);
}
- if (bit >= sbi->s_groups_count) {
+ if (!group_alloc) {
*err = -ENOSPC;
goto out_release;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/