[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080123202045.GF23304@atrey.karlin.mff.cuni.cz>
Date: Wed, 23 Jan 2008 21:20:45 +0100
From: Jan Kara <jack@...e.cz>
To: Abhishek Rai <abhishekrai@...gle.com>
Cc: linux-ext4@...r.kernel.org
Subject: Re: Confused by journaling code in ext3_new_blocks()
Hello,
> I have the following question related to the journaling code in
> ext3_new_blocks() function of fs/ext3/balloc.c, any help in this
> regard will be greatly appreciated. The code snippet below is taken
> from 2.6.24-rc8-mm1 but this code has changed little for a long time
> so it's likely that any other recent kernel will also have very
> similar code.
>
> ext3_new_blocks()
> -> ext3_try_to_allocate_with_rsv()
> -> ext3_journal_dirty_metadata(handle, bitmap_bh)
> ...
> allocated:
> if ( /*sanity checking of newly allocated block numbers*/) {
> ext3_error(...);
> goto out;
> }
>
> out:
> ...
> brelse(bitmap_bh);
> return 0;
>
>
> In the above code snippet, ext3_try_to_allocate_with_rsv() is marking
> bitmap_bh as dirty metadata _before_ the sanity checks. I'm not
> worried about the sanity checks as such, but it seems to me that if
> the checks were to fail, we'd be committing the bitmap_bh updates to
> disk even though it violates metadata sanity, or am I missing
> something here ?
Actually, it depends. Because if sanity checks fail, we call
ext3_error() which remounts fs R/O or panics in most cases. Only if
errors=continue is set, we really get to committing the wrong bitmap
data. But I don't think this really is a problem - fsck has to be run
anyway and it rebuilds the bitmaps from scratch.
Honza
--
Jan Kara <jack@...e.cz>
SuSE CR Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists