linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] ext4: fix unjournalled bg descriptor while initializing inode bitmap
Date: Tue, 8 Jul 2014 08:46:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1407080845130.2180@localhost.localdomain> (raw)
In-Reply-To: <1404592131-29738-1-git-send-email-tytso@mit.edu>

On Sat, 5 Jul 2014, Theodore Ts'o wrote:

> Date: Sat,  5 Jul 2014 16:28:51 -0400
> From: Theodore Ts'o <tytso@mit.edu>
> To: Ext4 Developers List <linux-ext4@vger.kernel.org>
> Cc: Theodore Ts'o <tytso@mit.edu>, stable@vger.kernel.org
> Subject: [PATCH] ext4: fix unjournalled bg descriptor while initializing inode
>      bitmap
> 
> The first time that we allocate from an uninitialized inode allocation
> bitmap, if the block allocation bitmap is also uninitalized, we need
> to get write access to the block group descriptor before we start
> modifying the block group descriptor flags and updating the free block
> count, etc.  Otherwise, there is the potential of a bad journal
> checksum (if journal checksums are enabled), and of the file system
> becoming inconsistent if we crash at exactly the wrong time.

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Cc: stable@vger.kernel.org
> ---
>  fs/ext4/ialloc.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index a87455d..0840bf3 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -874,6 +874,13 @@ got:
>  		goto out;
>  	}
>  
> +	BUFFER_TRACE(group_desc_bh, "get_write_access");
> +	err = ext4_journal_get_write_access(handle, group_desc_bh);
> +	if (err) {
> +		ext4_std_error(sb, err);
> +		goto out;
> +	}
> +
>  	/* We may have to initialize the block bitmap if it isn't already */
>  	if (ext4_has_group_desc_csum(sb) &&
>  	    gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
> @@ -910,13 +917,6 @@ got:
>  		}
>  	}
>  
> -	BUFFER_TRACE(group_desc_bh, "get_write_access");
> -	err = ext4_journal_get_write_access(handle, group_desc_bh);
> -	if (err) {
> -		ext4_std_error(sb, err);
> -		goto out;
> -	}
> -
>  	/* Update the relevant bg descriptor fields */
>  	if (ext4_has_group_desc_csum(sb)) {
>  		int free;
> 

      reply	other threads:[~2014-07-08  6:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 20:28 [PATCH] ext4: fix unjournalled bg descriptor while initializing inode bitmap Theodore Ts'o
2014-07-08  6:46 ` 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.1407080845130.2180@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=stable@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).