public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Ye Bin <yebin10@huawei.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	jack@suse.cz
Subject: Re: [PATCH -next] ext4: fix miss release buffer head in ext4_fc_write_inode
Date: Wed, 14 Sep 2022 16:37:56 +0200	[thread overview]
Message-ID: <20220914143756.y5if4kllwi7mz67b@quack3> (raw)
In-Reply-To: <20220914100859.1415196-1-yebin10@huawei.com>

On Wed 14-09-22 18:08:59, Ye Bin wrote:
> In 'ext4_fc_write_inode' function first call 'ext4_get_inode_loc' get 'iloc',
> after use it miss release 'iloc.bh'.
> So just release 'iloc.bh' before 'ext4_fc_write_inode' return.
> 
> Signed-off-by: Ye Bin <yebin10@huawei.com>

Yes, nice. Feel free to add:

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

								Honza

> ---
>  fs/ext4/fast_commit.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> index 2af962cbb835..b7414a5812f6 100644
> --- a/fs/ext4/fast_commit.c
> +++ b/fs/ext4/fast_commit.c
> @@ -874,22 +874,25 @@ static int ext4_fc_write_inode(struct inode *inode, u32 *crc)
>  	tl.fc_tag = cpu_to_le16(EXT4_FC_TAG_INODE);
>  	tl.fc_len = cpu_to_le16(inode_len + sizeof(fc_inode.fc_ino));
>  
> +	ret = -ECANCELED;
>  	dst = ext4_fc_reserve_space(inode->i_sb,
>  			sizeof(tl) + inode_len + sizeof(fc_inode.fc_ino), crc);
>  	if (!dst)
> -		return -ECANCELED;
> +		goto err;
>  
>  	if (!ext4_fc_memcpy(inode->i_sb, dst, &tl, sizeof(tl), crc))
> -		return -ECANCELED;
> +		goto err;
>  	dst += sizeof(tl);
>  	if (!ext4_fc_memcpy(inode->i_sb, dst, &fc_inode, sizeof(fc_inode), crc))
> -		return -ECANCELED;
> +		goto err;
>  	dst += sizeof(fc_inode);
>  	if (!ext4_fc_memcpy(inode->i_sb, dst, (u8 *)ext4_raw_inode(&iloc),
>  					inode_len, crc))
> -		return -ECANCELED;
> -
> -	return 0;
> +		goto err;
> +	ret = 0;
> +err:
> +	brelse(iloc.bh);
> +	return ret;
>  }
>  
>  /*
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2022-09-14 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 10:08 [PATCH -next] ext4: fix miss release buffer head in ext4_fc_write_inode Ye Bin
2022-09-14 14:37 ` Jan Kara [this message]
2022-09-30  3:19 ` Theodore Ts'o

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=20220914143756.y5if4kllwi7mz67b@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yebin10@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