Commit 8262499b authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] ext2: block allocation fix

Patch from Alex Tomas <bzzz@tmi.comex.ru>

There is a logic error in ext2_new_block().  If we manage to reserve some
blocks in the final blockgroup, local variable `bit' will be equal to
sbi->s_groups_count and we erroneously assume that the allocation failed.

Fix that up by testing local variable `group_alloc' instead.
parent 3bdfab20
......@@ -395,7 +395,7 @@ int ext2_new_block (struct inode * inode, unsigned long goal,
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment