From: Andreas Dilger <adilger@clusterfs.com>
To: Andre Noll <maan@systemlinux.org>
Cc: Theodore Ts'o <tytso@mit.edu>,
linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org,
Eric Sandeen <esandeen@redhat.com>
Subject: Re: ext3: bogus i_mode errors with 2.6.18.1
Date: Tue, 24 Oct 2006 14:27:16 -0600 [thread overview]
Message-ID: <20061024202716.GX3509@schatzie.adilger.int> (raw)
In-Reply-To: <20061024091449.GZ22487@skl-net.de>
On Oct 24, 2006 11:14 +0200, Andre Noll wrote:
> On 14:02, Andreas Dilger wrote:
> Something like the this? (only compile tested). And no, I do _not_ know,
> what I'm doing ;)
Don't worry, everyone starts out not knowing what they are doing.
The ext3_free_blocks() part looks OK from a cursory review.
> @@ -1372,12 +1370,24 @@ 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)) {
> + int j;
> + ext3_error(sb, __FUNCTION__,
> "Allocating block in system zone - "
> "blocks from "E3FSBLK", length %lu",
> ret_block, num);
> -
> + /* Note: This will potentially use up one of the handle's
> + * buffer credits. Normally we have way too many credits,
> + * so that is OK. In _very_ rare cases it might not be OK.
> + * We will trigger an assertion if we run out of credits,
> + * and we will have to do a full fsck of the filesystem -
> + * better than randomly corrupting filesystem metadata.
> + */
> + j = find_next_usable_block(-1, gdp, EXT3_BLOCKS_PER_GROUP(sb));
I'm not sure why the "find_next_usable_block()" part is in here? At this
point we KNOW that ret_block is not a block we should be allocating, yet
it is marked free in the bitmap. So we should just mark the block(s) in-use
in the bitmap and look for a different block(s).
> + if (j >= 0)
> + ext3_set_bit(j, gdp_bh->b_data);
Note that we need to loop over "num" blocks and set any bits that should
be set, as is done in the ext3_free_blocks() code. This function has
changed since 2.4 in that it can now potentially allocate multiple blocks.
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
next prev parent reply other threads:[~2006-10-24 20:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20061023144556.GY22487@skl-net.de>
2006-10-23 16:44 ` ext3: bogus i_mode errors with 2.6.18.1 Andreas Dilger
2006-10-23 20:02 ` Andreas Dilger
2006-10-24 9:14 ` Andre Noll
2006-10-24 20:27 ` Andreas Dilger [this message]
2006-10-25 9:44 ` Andre Noll
2006-10-26 9:36 ` Andreas Dilger
2006-10-26 16:02 ` Andre Noll
2006-10-26 18:01 ` Andreas Dilger
2006-10-27 15:34 ` Andre Noll
2006-10-28 14:24 ` Andreas Dilger
2006-10-30 9:55 ` Andre Noll
2006-11-15 0:03 ` Andreas Dilger
2006-11-15 14:30 ` Andre Noll
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061024202716.GX3509@schatzie.adilger.int \
--to=adilger@clusterfs.com \
--cc=esandeen@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maan@systemlinux.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).