linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Properly mark the extent uninitialized during truncate
Date: Thu, 11 Jun 2009 01:13:18 +0530	[thread overview]
Message-ID: <20090610194318.GA4686@skywalker> (raw)
In-Reply-To: <1244638557-13492-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On Wed, Jun 10, 2009 at 06:25:57PM +0530, Aneesh Kumar K.V wrote:
> We should make sure we don't mark the non uninit extent as
> uninit during truncate
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  fs/ext4/extents.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index f2a2591..764c394 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -2083,12 +2083,16 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
>  	ex = EXT_LAST_EXTENT(eh);
> 
>  	ex_ee_block = le32_to_cpu(ex->ee_block);
> -	if (ext4_ext_is_uninitialized(ex))
> -		uninitialized = 1;
>  	ex_ee_len = ext4_ext_get_actual_len(ex);
> 
>  	while (ex >= EXT_FIRST_EXTENT(eh) &&
>  			ex_ee_block + ex_ee_len > start) {
> +
> +		if (ext4_ext_is_uninitialized(ex))
> +			uninitialized = 1;
> +		else
> +			uninitialized = 0;
> +
>  		ext_debug("remove ext %lu:%u\n", ex_ee_block, ex_ee_len);
>  		path[depth].p_ext = ex;
> 

BTW this fix is really important. It fix a data corruption when we write
to an fallocate space and later truncate the same file. So mostly a
stable candidate.

-aneesh

      parent reply	other threads:[~2009-06-10 19:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10 12:55 [PATCH] ext4: Properly mark the extent uninitialized during truncate Aneesh Kumar K.V
2009-06-10 18:24 ` Theodore Tso
2009-06-10 19:43 ` Aneesh Kumar K.V [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=20090610194318.GA4686@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --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).