linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] ext4: Fix block zeroing when punching holes in indirect block files
Date: Thu, 19 Jun 2014 17:38:12 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1406191737150.2182@localhost.localdomain> (raw)
In-Reply-To: <1403119984-3635-1-git-send-email-jack@suse.cz>

On Wed, 18 Jun 2014, Jan Kara wrote:

> Date: Wed, 18 Jun 2014 21:33:03 +0200
> From: Jan Kara <jack@suse.cz>
> To: Ted Tso <tytso@mit.edu>
> Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>
> Subject: [PATCH 1/2] ext4: Fix block zeroing when punching holes in indirect
>     block files
> 
> free_holes_block() passed local variable as a block pointer
> to ext4_clear_blocks(). Thus ext4_clear_blocks() zeroed out this local
> variable instead of proper place in inode / indirect block. We later
> zero out proper place in inode / indirect block but don't dirty the
> inode / buffer again which can lead to subtle issues (some changes e.g.
> to inode can be lost).

Please see my patch

[PATCH] ext4: Fix punch hole on files with indirect mapping

which fixes those issues in a different way while also make this
operation faster.

Thanks!
-Lukas

> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/ext4/indirect.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
> index 8a57e9fcd1b9..9d381707a6fc 100644
> --- a/fs/ext4/indirect.c
> +++ b/fs/ext4/indirect.c
> @@ -1329,8 +1329,8 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode,
>  		if (level == 0 ||
>  		    (bh && all_zeroes((__le32 *)bh->b_data,
>  				      (__le32 *)bh->b_data + addr_per_block))) {
> -			ext4_free_data(handle, inode, parent_bh, &blk, &blk+1);
> -			*i_data = 0;
> +			ext4_free_data(handle, inode, parent_bh,
> +				       i_data, i_data + 1);
>  		}
>  		brelse(bh);
>  		bh = NULL;
> 

  parent reply	other threads:[~2014-06-19 15:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 19:33 [PATCH 1/2] ext4: Fix block zeroing when punching holes in indirect block files Jan Kara
2014-06-18 19:33 ` [PATCH 2/2] ext4: Fix hole punching for files with indirect blocks Jan Kara
2014-06-19 15:38 ` Lukáš Czerner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-10-10 14:23 [PATCH 0/2 v2] Fix data corruption when blocksize < pagesize for mmapped data Jan Kara
2014-10-10 14:23 ` [PATCH 1/2] ext4: Fix block zeroing when punching holes in indirect block files Jan Kara

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.1406191737150.2182@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=jack@suse.cz \
    --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).