Re: [PATCH] ext2 allocation failures

Andrew Morton (akpm@digeo.com)
Tue, 21 Jan 2003 13:18:14 -0800


Hugh Dickins wrote:
>
> 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.

ugh.

> [Insert lecture on dangers of using goto for unwind :-]

Actually, I rather don't like the practice of:

*errp = -EFOO;
<200 lines of code>
if (something_bad)
goto out;

And lo, both ext2_new_block() and ext3_new_block() have additional
bugs, due mainly to this dubious optimisation.

I'll change them to the very straightforward

if (something_bad) {
*errp = -EFOO;
goto out;
}

Thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/