lkml.org 
[lkml]   [2006]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Boot failure with ext2 and initrds
On Tue, 14 Nov 2006 19:11:22 +0000 (GMT)
Hugh Dickins <hugh@veritas.com> wrote:

> On Tue, 14 Nov 2006, Mel Gorman wrote:
> > 2.6.19-rc5-mm2
> >
> > Am seeing errors with systems using ext2. First machine is a plan old x86
> > using initramfs. Console output looks like;
> > ...
> > Configuring network interfaces...BUG: soft lockup detected on CPU#3!
> > ...
> > [<c01b3b80>] ext2_try_to_allocate+0xdb/0x152
> > [<c01b3e72>] ext2_try_to_allocate_with_rsv+0x4b/0x1b2
> >
> > I've not investigated yet what patches might be at fault.
>
> I expect you'll find it's
> ext2-reservations-bring-ext2-reservations-code-in-line-with-latest-ext3.patch
> which gets stuck in a loop there for me too: back it out and all seems fine.
>
> It's not obvious which part of the patch is to blame: mostly it's
> cleanup, but a few variables do change size: I'm currently narrowing
> down to where a fix is needed.
>

Doing s/-Wall/-W/ tends to shake out bugs in this stuff.

The below might help.

Sorry, I tested this well, then the cleanup patch was merged and I didn't
get onto retesting :(



From: Andrew Morton <akpm@osdl.org>

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

fs/ext2/balloc.c | 33 +++++++++++++++------------------
1 files changed, 15 insertions(+), 18 deletions(-)

diff -puN fs/ext2/balloc.c~ext2-reservations-bring-ext2-reservations-code-in-line-with-latest-ext3-fix fs/ext2/balloc.c
--- a/fs/ext2/balloc.c~ext2-reservations-bring-ext2-reservations-code-in-line-with-latest-ext3-fix
+++ a/fs/ext2/balloc.c
@@ -1155,9 +1155,10 @@ int ext2_new_blocks(struct inode *inode,
struct buffer_head *gdp_bh;
int group_no;
int goal_group;
+ ext2_grpblk_t grp_target_blk; /* blockgroup relative goal block */
+ ext2_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/
ext2_fsblk_t ret_block; /* filesyetem-wide allocated block */
int bgi; /* blockgroup iteration index */
- int target_block;
int performed_allocation = 0;
ext2_grpblk_t free_blocks; /* number of free blocks in a group */
struct super_block *sb;
@@ -1230,14 +1231,15 @@ retry_alloc:
my_rsv = NULL;

if (free_blocks > 0) {
- ret_block = ((goal - le32_to_cpu(es->s_first_data_block)) %
+ grp_target_blk = ((goal - le32_to_cpu(es->s_first_data_block)) %
EXT2_BLOCKS_PER_GROUP(sb));
bitmap_bh = read_block_bitmap(sb, group_no);
if (!bitmap_bh)
goto io_error;
- ret_block = ext2_try_to_allocate_with_rsv(sb, group_no,
- bitmap_bh, ret_block, my_rsv, &num);
- if (ret_block >= 0)
+ grp_alloc_blk = ext2_try_to_allocate_with_rsv(sb, group_no,
+ bitmap_bh, grp_target_blk,
+ my_rsv, &num);
+ if (grp_alloc_blk >= 0)
goto allocated;
}

@@ -1273,9 +1275,9 @@ retry_alloc:
/*
* try to allocate block(s) from this group, without a goal(-1).
*/
- ret_block = ext2_try_to_allocate_with_rsv(sb, group_no,
+ grp_alloc_blk = ext2_try_to_allocate_with_rsv(sb, group_no,
bitmap_bh, -1, my_rsv, &num);
- if (ret_block >= 0)
+ if (grp_alloc_blk >= 0)
goto allocated;
}
/*
@@ -1299,25 +1301,20 @@ allocated:
ext2_debug("using block group %d(%d)\n",
group_no, gdp->bg_free_blocks_count);

- target_block = ret_block + group_no * EXT2_BLOCKS_PER_GROUP(sb)
- + le32_to_cpu(es->s_first_data_block);
+ ret_block = grp_alloc_blk + ext2_group_first_block_no(sb, group_no);

- if (in_range(le32_to_cpu(gdp->bg_block_bitmap), target_block, num) ||
- in_range(le32_to_cpu(gdp->bg_inode_bitmap), target_block, num) ||
- in_range(target_block, le32_to_cpu(gdp->bg_inode_table),
+ if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) ||
+ in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) ||
+ in_range(ret_block, le32_to_cpu(gdp->bg_inode_table),
EXT2_SB(sb)->s_itb_per_group) ||
- in_range(target_block + num - 1, le32_to_cpu(gdp->bg_inode_table),
+ in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table),
EXT2_SB(sb)->s_itb_per_group))
ext2_error(sb, "ext2_new_blocks",
"Allocating block in system zone - "
- "blocks from %u, length %lu", target_block, num);
+ "blocks from %u, length %lu", ret_block, num);

performed_allocation = 1;

-
- /* ret_block was blockgroup-relative. Now it becomes fs-relative */
- ret_block = target_block;
-
if (ret_block + num - 1 >= le32_to_cpu(es->s_blocks_count)) {
ext2_error(sb, "ext2_new_blocks",
"block("E2FSBLK") >= blocks count(%d) - "
_
-
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/

\
 
 \ /
  Last update: 2006-11-14 20:35    [W:0.188 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site