[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200821124154.10218-1-alex.dewar90@gmail.com>
Date: Fri, 21 Aug 2020 13:41:54 +0100
From: Alex Dewar <alex.dewar90@...il.com>
To: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Goldwyn Rodrigues <rgoldwyn@...e.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Alex Dewar <alex.dewar90@...il.com>
Subject: [PATCH] btrfs: check return value of filemap_fdatawrite_range()
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@...il.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)
--
2.28.0
Powered by blists - more mailing lists