1 |
From 240246f6b913b0c23733cfd2def1d283f8cc9bbe Mon Sep 17 00:00:00 2001 |
2 |
From: Goldwyn Rodrigues <rgoldwyn@suse.de> |
3 |
Date: Fri, 9 Jul 2021 11:29:22 -0500 |
4 |
Subject: btrfs: mark compressed range uptodate only if all bio succeed |
5 |
|
6 |
From: Goldwyn Rodrigues <rgoldwyn@suse.de> |
7 |
|
8 |
commit 240246f6b913b0c23733cfd2def1d283f8cc9bbe upstream. |
9 |
|
10 |
In compression write endio sequence, the range which the compressed_bio |
11 |
writes is marked as uptodate if the last bio of the compressed (sub)bios |
12 |
is completed successfully. There could be previous bio which may |
13 |
have failed which is recorded in cb->errors. |
14 |
|
15 |
Set the writeback range as uptodate only if cb->errors is zero, as opposed |
16 |
to checking only the last bio's status. |
17 |
|
18 |
Backporting notes: in all versions up to 4.4 the last argument is always |
19 |
replaced by "!cb->errors". |
20 |
|
21 |
CC: stable@vger.kernel.org # 4.4+ |
22 |
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> |
23 |
Reviewed-by: David Sterba <dsterba@suse.com> |
24 |
Signed-off-by: David Sterba <dsterba@suse.com> |
25 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
26 |
--- |
27 |
fs/btrfs/compression.c | 2 +- |
28 |
1 file changed, 1 insertion(+), 1 deletion(-) |
29 |
|
30 |
--- a/fs/btrfs/compression.c |
31 |
+++ b/fs/btrfs/compression.c |
32 |
@@ -340,7 +340,7 @@ static void end_compressed_bio_write(str |
33 |
cb->compressed_pages[0]->mapping = cb->inode->i_mapping; |
34 |
btrfs_writepage_endio_finish_ordered(cb->compressed_pages[0], |
35 |
cb->start, cb->start + cb->len - 1, |
36 |
- bio->bi_status == BLK_STS_OK); |
37 |
+ !cb->errors); |
38 |
cb->compressed_pages[0]->mapping = NULL; |
39 |
|
40 |
end_compressed_writeback(inode, cb); |