Commit 359ae811 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix handling of ext2 allocation failures

Patch from: Hugh Dickins <hugh@veritas.com>

For almost a year (since 2.5.4) ext2_new_block has tended to set err 0
instead of -ENOSPC or -EIO.  This manifested variously (typically depends on
what's stale in ext2_get_block's chain[4] array): sometimes __brelse free
free buffer backtraces, sometimes release_pages oops, usually
generic_make_request beyond end of device messages, followed by further ext2
errors.

[Insert lecture on dangers of using goto for unwind :-]
parent 28b6394d
...@@ -470,10 +470,10 @@ int ext2_new_block (struct inode * inode, unsigned long goal, ...@@ -470,10 +470,10 @@ int ext2_new_block (struct inode * inode, unsigned long goal,
ext2_debug ("allocating block %d. ", block); ext2_debug ("allocating block %d. ", block);
*err = 0;
out_release: out_release:
group_release_blocks(desc, gdp_bh, group_alloc); group_release_blocks(desc, gdp_bh, group_alloc);
release_blocks(sb, es_alloc); release_blocks(sb, es_alloc);
*err = 0;
out_unlock: out_unlock:
unlock_super (sb); unlock_super (sb);
DQUOT_FREE_BLOCK(inode, dq_alloc); DQUOT_FREE_BLOCK(inode, dq_alloc);
......
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