From: Josef Bacik <josef@toxicpanda.com>
To: Alex Dewar <alex.dewar90@gmail.com>, Chris Mason <clm@fb.com>,
David Sterba <dsterba@suse.com>,
Goldwyn Rodrigues <rgoldwyn@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: check return value of filemap_fdatawrite_range()
Date: Fri, 21 Aug 2020 10:11:44 -0400 [thread overview]
Message-ID: <c3c0ddbe-e225-22a4-c9bf-9317a50c211b@toxicpanda.com> (raw)
In-Reply-To: <20200821124154.10218-1-alex.dewar90@gmail.com>
On 8/21/20 8:41 AM, Alex Dewar wrote:
> In btrfs_dio_imap_begin(), filemap_fdatawrite_range() is called without
> checking the return value. Add a check to catch errors.
>
> Fixes: c0aaf9b7a114f ("btrfs: switch to iomap_dio_rw() for dio")
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> ---
> fs/btrfs/inode.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 7b57aaa1f9acc..38fde20b4a81b 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -7347,9 +7347,12 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
> * outstanding dirty pages are on disk.
> */
> if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT,
> - &BTRFS_I(inode)->runtime_flags))
> + &BTRFS_I(inode)->runtime_flags)) {
> ret = filemap_fdatawrite_range(inode->i_mapping, start,
> start + length - 1);
> + if (ret)
> + return ret;
> + }
>
> dio_data = kzalloc(sizeof(*dio_data), GFP_NOFS);
> if (!dio_data)
>
Had to check to make sure there's no cleanup that's needed, there isn't,
you can add
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
next prev parent reply other threads:[~2020-08-21 14:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 12:41 [PATCH] btrfs: check return value of filemap_fdatawrite_range() Alex Dewar
2020-08-21 14:11 ` Josef Bacik [this message]
2020-08-21 14:38 ` David Sterba
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=c3c0ddbe-e225-22a4-c9bf-9317a50c211b@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=alex.dewar90@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rgoldwyn@suse.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