public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] ext4: Verify block bitmap even after fresh initialization
Date: Tue, 2 Jun 2015 09:59:32 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1506020953400.4950@localhost.localdomain> (raw)
In-Reply-To: <3D297E12-A721-4426-9313-CB25F5280B07@dilger.ca>

On Mon, 1 Jun 2015, Andreas Dilger wrote:

> Date: Mon, 1 Jun 2015 13:20:31 -0600
> From: Andreas Dilger <adilger@dilger.ca>
> To: Lukas Czerner <lczerner@redhat.com>
> Cc: linux-ext4@vger.kernel.org
> Subject: Re: [PATCH 1/3] ext4: Verify block bitmap even after fresh
>     initialization
> 
> 
> > On Jun 1, 2015, at 1:54 AM, Lukas Czerner <lczerner@redhat.com> wrote:
> > 
> > If we want to rely on the buffer_verified() flag of the block bitmap
> > buffer, we have to set it consistently. However currently if we're
> > initializing uninitialized block bitmap in
> > ext4_read_block_bitmap_nowait() we're not going to set buffer verified
> > at all.
> > 
> > We can do this by simply setting the flag on the buffer, but I think
> > it's actually better to run ext4_validate_block_bitmap() to make sure
> > that what we did in the ext4_init_block_bitmap() is right.
> > 
> > So run ext4_validate_block_bitmap() even after the block bitmap
> > initialization. Also bail out early from ext4_validate_block_bitmap() if
> > we see corrupt bitmap, since we already know it's corrupt and we do not
> > need to verify that.
> > 
> > Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> > ---
> > fs/ext4/balloc.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> > index 955bf49..cd6ea29 100644
> > --- a/fs/ext4/balloc.c
> > +++ b/fs/ext4/balloc.c
> > @@ -369,7 +369,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb,
> > 	struct ext4_group_info *grp = ext4_get_group_info(sb, block_group);
> > 	struct ext4_sb_info *sbi = EXT4_SB(sb);
> > 
> > -	if (buffer_verified(bh))
> > +	if (buffer_verified(bh) || EXT4_MB_GRP_BBITMAP_CORRUPT(grp))
> > 		return;
> > 
> > 	ext4_lock_group(sb, block_group);
> > @@ -446,7 +446,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
> > 		unlock_buffer(bh);
> > 		if (err)
> > 			ext4_error(sb, "Checksum bad for grp %u", block_group);
> > -		return bh;
> > +		goto verify;
> 
> (defect) This looks like it will miss the ext4_unlock_group() call
> below, since that is missing in the "verify:" branch.  Either you
> need to add an explicit ext4_unlock_group() call before "goto verify",
> or add a new "unlock_group:" label that unlocks the group.

Hi,

the code snippet tricked you ;). Take a look at the code there is
ext4_unlock_group() just before unlock_buffer() which is missing in
the snipper above.

Thanks!
-Lukas

> 
> 
> > 	}
> > 	ext4_unlock_group(sb, block_group);
> > 	if (buffer_uptodate(bh)) {
> 
> Cheers, Andreas
> 
> 
> 
> 
> 
> 

      reply	other threads:[~2015-06-02  7:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  7:54 [PATCH 1/3] ext4: Verify block bitmap even after fresh initialization Lukas Czerner
2015-06-01  7:55 ` [PATCH 2/3] ext4: Try to initialize all groups we can in case of failure on ppc64 Lukas Czerner
2015-06-01 19:15   ` Andreas Dilger
2015-06-02  7:53     ` Lukáš Czerner
2015-06-01  7:55 ` [PATCH 3/3] ext4: Return error code from ext4_mb_good_group() Lukas Czerner
2015-06-01 19:20 ` [PATCH 1/3] ext4: Verify block bitmap even after fresh initialization Andreas Dilger
2015-06-02  7:59   ` Lukáš Czerner [this message]

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=alpine.LFD.2.00.1506020953400.4950@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    /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