]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ext2: block allocation fix
authorAndrew Morton <akpm@digeo.com>
Sun, 16 Mar 2003 15:22:55 +0000 (07:22 -0800)
committerDave Jones <davej@codemonkey.org.uk>
Sun, 16 Mar 2003 15:22:55 +0000 (07:22 -0800)
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.

fs/ext2/balloc.c

index e5bee153791aeec8e6adc83ee8f29439d4bb90eb..40868d403f0b133e7479ee8c5d7a223105142a8a 100644 (file)
@@ -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;
        }