All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zheng Liu <gnehzuil.liu@gmail.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/2] ext4: Use EXT_MAX_BLOCKS in ext4_es_can_be_merged()
Date: Wed, 23 Apr 2014 15:27:36 +0800	[thread overview]
Message-ID: <20140423072735.GA3602@gmail.com> (raw)
In-Reply-To: <1397585302-27175-2-git-send-email-lczerner@redhat.com>

On Tue, Apr 15, 2014 at 08:08:22PM +0200, Lukas Czerner wrote:
> In ext4_es_can_be_merged() when checking whether we can merge two
> extents we should use EXT_MAX_BLOCKS instead of defining it manually.
> Also if it is really the case we should notify userspace because clearly
> there is a bug in extent status tree implementation since this should
> never happen.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>

Thanks for fixing this.  It looks good to me.
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>

                                                - Zheng

> ---
>  fs/ext4/extents_status.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
> index 3c47b4e..b38d71a 100644
> --- a/fs/ext4/extents_status.c
> +++ b/fs/ext4/extents_status.c
> @@ -344,8 +344,14 @@ static int ext4_es_can_be_merged(struct extent_status *es1,
>  	if (ext4_es_status(es1) != ext4_es_status(es2))
>  		return 0;
>  
> -	if (((__u64) es1->es_len) + es2->es_len > 0xFFFFFFFFULL)
> +	if (((__u64) es1->es_len) + es2->es_len > EXT_MAX_BLOCKS) {
> +		pr_warn("ES assertion failed when merging extents. "
> +			"The sum of lengths of es1 (%d) and es2 (%d) "
> +			"is bigger than allowed file size (%d)\n",
> +			es1->es_len, es2->es_len, EXT_MAX_BLOCKS);
> +		WARN_ON(1);
>  		return 0;
> +	}
>  
>  	if (((__u64) es1->es_lblk) + es1->es_len != es2->es_lblk)
>  		return 0;
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-04-23  7:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 18:08 [PATCH 1/2] ext4: Remove arbitrary block value in __es_remove_extent() Lukas Czerner
2014-04-15 18:08 ` [PATCH 2/2] ext4: Use EXT_MAX_BLOCKS in ext4_es_can_be_merged() Lukas Czerner
2014-04-23  7:27   ` Zheng Liu [this message]
2014-05-13  2:25   ` [2/2] " Theodore Ts'o
2014-04-17 16:19 ` [PATCH 1/2] ext4: Remove arbitrary block value in __es_remove_extent() Theodore Ts'o
2014-04-18  9:22   ` Lukáš Czerner
2014-04-18 11:18     ` Theodore Ts'o
2014-04-18 11:24       ` Lukáš Czerner

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=20140423072735.GA3602@gmail.com \
    --to=gnehzuil.liu@gmail.com \
    --cc=lczerner@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.