Commit 08fb306f authored by Mingming Cao's avatar Mingming Cao Committed by Linus Torvalds

[PATCH] ext3 filesystem bogus ENOSPC with reservation fix

To handle the earlier bogus ENOSPC error caused by filesystem full of block
reservation, current code falls back to non block reservation, starts to
allocate block(s) from the goal allocation block group as if there is no
block reservation.

Current code needs to re-load the corresponding block group descriptor for
the initial goal block group in this case.  The patch fixes this.
Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 607eb266
...@@ -1269,12 +1269,12 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, ...@@ -1269,12 +1269,12 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
goal = le32_to_cpu(es->s_first_data_block); goal = le32_to_cpu(es->s_first_data_block);
group_no = (goal - le32_to_cpu(es->s_first_data_block)) / group_no = (goal - le32_to_cpu(es->s_first_data_block)) /
EXT3_BLOCKS_PER_GROUP(sb); EXT3_BLOCKS_PER_GROUP(sb);
goal_group = group_no;
retry_alloc:
gdp = ext3_get_group_desc(sb, group_no, &gdp_bh); gdp = ext3_get_group_desc(sb, group_no, &gdp_bh);
if (!gdp) if (!gdp)
goto io_error; goto io_error;
goal_group = group_no;
retry:
free_blocks = le16_to_cpu(gdp->bg_free_blocks_count); free_blocks = le16_to_cpu(gdp->bg_free_blocks_count);
/* /*
* if there is not enough free blocks to make a new resevation * if there is not enough free blocks to make a new resevation
...@@ -1349,7 +1349,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, ...@@ -1349,7 +1349,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
if (my_rsv) { if (my_rsv) {
my_rsv = NULL; my_rsv = NULL;
group_no = goal_group; group_no = goal_group;
goto retry; goto retry_alloc;
} }
/* No space left on the device */ /* No space left on the device */
*errp = -ENOSPC; *errp = -ENOSPC;
......
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