linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu
Cc: a3at.mail@gmail.com,
	"open list:EXT4 FILE SYSTEM" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: initialize multi-block allocator before checking block descriptors
Date: Mon, 17 Mar 2014 10:23:57 -0700	[thread overview]
Message-ID: <20140317172357.GH9070@birch.djwong.org> (raw)
In-Reply-To: <20140317020029.GC14162@thunk.org>

On Sun, Mar 16, 2014 at 10:00:30PM -0400, tytso@mit.edu wrote:
> On Mon, Mar 17, 2014 at 12:56:59AM +0400, a3at.mail@gmail.com wrote:
> > After I tested ext4 dev branch (eb3e7abb161ad5), without any xfs-tests complaints,
> > I understand what goes wrong, you have not last version of
> > this patch, the latest is v3.
> > (Actually you have description from last patch, but not the latest changes.)
> 
> What I did was to take your v3 version of the patch, and then since
> that patch removed the label failed_mount5, I changed instances of
> failed_mount4a to failed_mount5, just for aesthetic reasons.

/me wonders if it would be easier just to do something like this:

ext4: don't crash when validating block bitmap

If EXT4FS_DEBUG is defined, ext4_validate_block_bitmap is called via
ext4_count_free_clusters before sb->s_group_info is set up.  When this
happens, the kernel crashes because group info hasn't been loaded.
Forego marking the group corrupt for now; not setting BH_Verified
means we'll revisit the bitmap if something went wrong.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ext4/balloc.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 2f35689..b375768 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -355,7 +355,10 @@ void ext4_validate_block_bitmap(struct super_block *sb,
 			       struct buffer_head *bh)
 {
 	ext4_fsblk_t	blk;
-	struct ext4_group_info *grp = ext4_get_group_info(sb, block_group);
+	struct ext4_group_info *grp = NULL;
+
+	if (EXT4_SB(sb)->s_group_info)
+		grp = ext4_get_group_info(sb, block_group);
 
 	if (buffer_verified(bh))
 		return;
@@ -366,14 +369,18 @@ void ext4_validate_block_bitmap(struct super_block *sb,
 		ext4_unlock_group(sb, block_group);
 		ext4_error(sb, "bg %u: block %llu: invalid block bitmap",
 			   block_group, blk);
-		set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
+		if (grp)
+			set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT,
+				&grp->bb_state);
 		return;
 	}
 	if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
 			desc, bh))) {
 		ext4_unlock_group(sb, block_group);
 		ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
-		set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
+		if (grp)
+			set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT,
+				&grp->bb_state);
 		return;
 	}
 	set_buffer_verified(bh);

  parent reply	other threads:[~2014-03-17 17:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-15 21:40 [PATCH] ext4: initialize multi-block allocator before checking block descriptors tytso
2014-03-15 23:54 ` Azat Khuzhin
2014-03-16  2:38   ` tytso
2014-03-16 14:10     ` Azat Khuzhin
2014-03-16 16:17       ` a3at.mail
2014-03-16 18:46         ` tytso
2014-03-16 20:56           ` a3at.mail
2014-03-17  2:00             ` tytso
2014-03-17 16:19               ` Azat Khuzhin
2014-03-17 17:53                 ` a3at.mail
2014-03-25  0:17                   ` tytso
2014-03-25  6:24                     ` a3at.mail
2014-04-05 15:51                       ` Azat Khuzhin
2014-03-17 17:23               ` Darrick J. Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-10 10:25 Azat Khuzhin

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=20140317172357.GH9070@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=a3at.mail@gmail.com \
    --cc=linux-ext4@vger.kernel.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).