linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "zhangyi (F)" <yi.zhang@huawei.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, miaoxie@huawei.com
Subject: Re: [PATCH v2 1/2] ext4: use i_size_read() when converting initialized extent
Date: Mon, 21 Jan 2019 16:56:19 +0100	[thread overview]
Message-ID: <20190121155619.GC21694@quack2.suse.cz> (raw)
In-Reply-To: <1545141822-3082-2-git-send-email-yi.zhang@huawei.com>

On Tue 18-12-18 22:03:41, zhangyi (F) wrote:
> Use i_size_read() in ext4_ext_convert_to_initialized() and
> ext4_split_convert_extents() because we haven't taken inode->i_rwsem
> in these two functions.
> 
> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>

The patch looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/extents.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 240b6de..0307fc6 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3483,7 +3483,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
>  		(unsigned long long)map->m_lblk, map_len);
>  
>  	sbi = EXT4_SB(inode->i_sb);
> -	eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
> +	eof_block = (i_size_read(inode) + inode->i_sb->s_blocksize - 1) >>
>  		inode->i_sb->s_blocksize_bits;
>  	if (eof_block < map->m_lblk + map_len)
>  		eof_block = map->m_lblk + map_len;
> @@ -3739,7 +3739,7 @@ static int ext4_split_convert_extents(handle_t *handle,
>  		  __func__, inode->i_ino,
>  		  (unsigned long long)map->m_lblk, map->m_len);
>  
> -	eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
> +	eof_block = (i_size_read(inode) + inode->i_sb->s_blocksize - 1) >>
>  		inode->i_sb->s_blocksize_bits;
>  	if (eof_block < map->m_lblk + map->m_len)
>  		eof_block = map->m_lblk + map->m_len;
> -- 
> 2.7.4
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2019-01-21 15:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 14:03 [PATCH v2 0/2] ext4: fix unsafe extent initialization zhangyi (F)
2018-12-18 14:03 ` [PATCH v2 1/2] ext4: use i_size_read() when converting initialized extent zhangyi (F)
2019-01-21 15:56   ` Jan Kara [this message]
2018-12-18 14:03 ` [PATCH v2 2/2] ext4: fix unsafe extent initialization zhangyi (F)
2019-01-21 16:55   ` 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=20190121155619.GC21694@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    /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).