public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext2 allocation failures
@ 2003-01-21 20:54 Hugh Dickins
  2003-01-21 21:18 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2003-01-21 20:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

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 :-]

Hugh

--- 2.5.59/fs/ext2/balloc.c	Tue Dec 24 06:23:03 2002
+++ linux/fs/ext2/balloc.c	Tue Jan 21 20:14:37 2003
@@ -470,10 +470,10 @@
 
 	ext2_debug ("allocating block %d. ", block);
 
+	*err = 0;
 out_release:
 	group_release_blocks(desc, gdp_bh, group_alloc);
 	release_blocks(sb, es_alloc);
-	*err = 0;
 out_unlock:
 	unlock_super (sb);
 	DQUOT_FREE_BLOCK(inode, dq_alloc);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext2 allocation failures
  2003-01-21 20:54 [PATCH] ext2 allocation failures Hugh Dickins
@ 2003-01-21 21:18 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2003-01-21 21:18 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: linux-kernel

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-21 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-21 20:54 [PATCH] ext2 allocation failures Hugh Dickins
2003-01-21 21:18 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox