diff options
author | Qu Wenruo <wqu@suse.com> | 2023-06-30 08:56:40 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-07-18 03:13:15 +0200 |
commit | 486c737f7fdc0c3f6464cf27ede811daec2769a1 (patch) | |
tree | f9be63314b197f32e9d5d46f6974d5bd24dc1fd7 /ipc | |
parent | 866e98a4d95d93de2d485f82c69ffeabd712e48b (diff) | |
download | linux-stable-486c737f7fdc0c3f6464cf27ede811daec2769a1.tar.gz linux-stable-486c737f7fdc0c3f6464cf27ede811daec2769a1.tar.bz2 linux-stable-486c737f7fdc0c3f6464cf27ede811daec2769a1.zip |
btrfs: raid56: always verify the P/Q contents for scrub
[REGRESSION]
Commit 75b470332965 ("btrfs: raid56: migrate recovery and scrub recovery
path to use error_bitmap") changed the behavior of scrub_rbio().
Initially if we have no error reading the raid bio, we will assign
@need_check to true, then finish_parity_scrub() would later verify the
content of P/Q stripes before writeback.
But after that commit we never verify the content of P/Q stripes and
just writeback them.
This can lead to unrepaired P/Q stripes during scrub, or already
corrupted P/Q copied to the dev-replace target.
[FIX]
The situation is more complex than the regression, in fact the initial
behavior is not 100% correct either.
If we have the following rare case, it can still lead to the same
problem using the old behavior:
0 16K 32K 48K 64K
Data 1: |IIIIIII| |
Data 2: | |
Parity: | |CCCCCCC| |
Where "I" means IO error, "C" means corruption.
In the above case, we're scrubbing the parity stripe, then read out all
the contents of Data 1, Data 2, Parity stripes.
But found IO error in Data 1, which leads to rebuild using Data 2 and
Parity and got the correct data.
In that case, we would not verify if the Parity is correct for range
[16K, 32K).
So here we have to always verify the content of Parity no matter if we
did recovery or not.
This patch would remove the @need_check parameter of
finish_parity_scrub() completely, and would always do the P/Q
verification before writeback.
Fixes: 75b470332965 ("btrfs: raid56: migrate recovery and scrub recovery path to use error_bitmap")
CC: stable@vger.kernel.org # 6.2+
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions