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.




 25-akpm/fs/ext2/balloc.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/ext2/balloc.c~ext2-balloc-fix fs/ext2/balloc.c
--- 25/fs/ext2/balloc.c~ext2-balloc-fix	Thu Mar 13 16:25:57 2003
+++ 25-akpm/fs/ext2/balloc.c	Thu Mar 13 16:25:57 2003
@@ -395,7 +395,7 @@ int ext2_new_block (struct inode * inode
 			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;
 	}

_