From: Mingming Cao Subject: Re: new_block error Date: Thu, 28 Feb 2008 16:59:18 -0800 Message-ID: <1204246758.3609.49.camel@localhost.localdomain> References: <1204224350.16889.30.camel@worker.quietwind.net> <1204237379.3609.7.camel@localhost.localdomain> <1204243811.16889.53.camel@worker.quietwind.net> Reply-To: cmm@us.ibm.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org To: chriskot@quietwind.net, aneesh.kumar@linux.vnet.ibm.com Return-path: Received: from e6.ny.us.ibm.com ([32.97.182.146]:37908 "EHLO e6.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759849AbYB2A7q (ORCPT ); Thu, 28 Feb 2008 19:59:46 -0500 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e6.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m1T11fCl005612 for ; Thu, 28 Feb 2008 20:01:41 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m1T0xhuL167336 for ; Thu, 28 Feb 2008 19:59:43 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m1T0xg0W007230 for ; Thu, 28 Feb 2008 19:59:43 -0500 In-Reply-To: <1204243811.16889.53.camel@worker.quietwind.net> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 2008-02-28 at 17:10 -0700, Chris Kottaridis wrote: > That's all I currently have of the log, I'll see if I can get more of > it. > > I was pointed to this diff that has a "goto out" added if we hit this > scenario: > > feda58d37ae0efe22e711a74e26fb541d4eb1baa > fs/ext3/balloc.c | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c > index a26e683..d2dface 100644 > --- a/fs/ext3/balloc.c > +++ b/fs/ext3/balloc.c > @@ -530,11 +530,13 @@ do_more: > in_range (block, le32_to_cpu(desc->bg_inode_table), > sbi->s_itb_per_group) || > in_range (block + count - 1, le32_to_cpu(desc->bg_inode_table), > - sbi->s_itb_per_group)) > + sbi->s_itb_per_group)) { > ext3_error (sb, "ext3_free_blocks", > "Freeing blocks in system zones - " > "Block = "E3FSBLK", count = %lu", > block, count); > + goto error_return; > + } > > /* > * We are about to start releasing blocks in the bitmap, > @@ -1637,11 +1639,13 @@ allocated: > in_range(ret_block, le32_to_cpu(gdp->bg_inode_table), > EXT3_SB(sb)->s_itb_per_group) || > in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table), > - EXT3_SB(sb)->s_itb_per_group)) > + EXT3_SB(sb)->s_itb_per_group)) { > ext3_error(sb, "ext3_new_block", > "Allocating block in system zone - " > "blocks from "E3FSBLK", length %lu", > ret_block, num); > + goto out; > + } > > performed_allocation = 1; > > > The *errp gets set to -ENOSPC at the beginning of the routine so it'd go > to out with *errp set to -ENOSPC. > Ah...That seems a wrong, should returns EIO in this case. The fs has a marked the blocks for fs metadata as "used" on bitmaps at the mkfs time, so if we are able to allocate a new block(which checks the bitmap), the fs is not short of free block. > That's got to be better then continuing thinking it's OK to scribble on > metadata. > > However, I don't think it's necessarily true that it's out of space. > Before this is a loop that looks for a group that will satisfy the > request. If it thinks it's found one it stops checking the groups and > jumps out of the loop and then makes this test for overlapping the > metadata. With the new patch it returns -ENOSPC, but really there just > isn't any space up to the groups that have been checked and we get to > the test before all the groups have been checked. > It would seem that this check would be better serviced inside the loop > once we think we have a possible range of blocks that will fit. If it > turns out the range overlaps the metadata we should try the next group. Ur..If the allocated data blocks overlaps the fs metadata blocks, that means fs is corrupted: could be a bad block group descriptor, or a bad bitmap. In any case it should mark fs error and should not continue allocation in next group. What does fsck reports? Mingming