From: Sasha Levin Date: Thu, 12 Nov 2020 17:05:31 +0000 (-0500) Subject: Fixes for 4.14 X-Git-Tag: v4.4.244~75 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acaad4a9c10e0575a58de495cdbf6614facf302e;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/btrfs-fix-missing-error-return-if-writeback-for-exte.patch b/queue-4.14/btrfs-fix-missing-error-return-if-writeback-for-exte.patch new file mode 100644 index 00000000000..bcab909afa4 --- /dev/null +++ b/queue-4.14/btrfs-fix-missing-error-return-if-writeback-for-exte.patch @@ -0,0 +1,47 @@ +From 0c2d6fba54904cc9d40325a834f1b5789fc26227 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Sep 2019 17:42:28 +0100 +Subject: Btrfs: fix missing error return if writeback for extent buffer never + started + +From: Filipe Manana + +[ Upstream commit 0607eb1d452d45c5ac4c745a9e9e0d95152ea9d0 ] + +If lock_extent_buffer_for_io() fails, it returns a negative value, but its +caller btree_write_cache_pages() ignores such error. This means that a +call to flush_write_bio(), from lock_extent_buffer_for_io(), might have +failed. We should make btree_write_cache_pages() notice such error values +and stop immediatelly, making sure filemap_fdatawrite_range() returns an +error to the transaction commit path. A failure from flush_write_bio() +should also result in the endio callback end_bio_extent_buffer_writepage() +being invoked, which sets the BTRFS_FS_*_ERR bits appropriately, so that +there's no risk a transaction or log commit doesn't catch a writeback +failure. + +Reviewed-by: Josef Bacik +Signed-off-by: Filipe Manana +Signed-off-by: David Sterba +Signed-off-by: Sasha Levin +--- + fs/btrfs/extent_io.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c +index 0ba338cffa937..fd56c22c12a0e 100644 +--- a/fs/btrfs/extent_io.c ++++ b/fs/btrfs/extent_io.c +@@ -3869,6 +3869,10 @@ int btree_write_cache_pages(struct address_space *mapping, + if (!ret) { + free_extent_buffer(eb); + continue; ++ } else if (ret < 0) { ++ done = 1; ++ free_extent_buffer(eb); ++ break; + } + + ret = write_one_eb(eb, fs_info, wbc, &epd); +-- +2.27.0 + diff --git a/queue-4.14/series b/queue-4.14/series index 00aab3c21b0..dd95b961e1d 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -18,3 +18,4 @@ can-peak_usb-add-range-checking-in-decode-operations.patch can-peak_usb-peak_usb_get_ts_time-fix-timestamp-wrap.patch can-peak_canfd-pucan_handle_can_rx-fix-echo-manageme.patch xfs-flush-new-eof-page-on-truncate-to-avoid-post-eof.patch +btrfs-fix-missing-error-return-if-writeback-for-exte.patch