diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2023-09-14 19:07:01 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-10-12 17:44:09 +0300 |
commit | 9acaa64187f9b4cbb75622883c96ea1a893d5431 (patch) | |
tree | 49b678991588de37505fa00be1b48dbfbaaea79d /fs/btrfs/volumes.h | |
parent | 10e27980f2ff66ba0c6da55f33b4814d5bc86573 (diff) | |
download | linux-9acaa64187f9b4cbb75622883c96ea1a893d5431.tar.xz |
btrfs: scrub: implement raid stripe tree support
A filesystem that uses the raid stripe tree for logical to physical
address translation can't use the regular scrub path, that reads all
stripes and then checks if a sector is unused afterwards.
When using the raid stripe tree, this will result in lookup errors, as
the stripe tree doesn't know the requested logical addresses.
In case we're scrubbing a filesystem which uses the RAID stripe tree for
multi-device logical to physical address translation, perform an extra
block mapping step to get the real on-disk stripe length from the stripe
tree when scrubbing the sectors.
This prevents a double completion of the btrfs_bio caused by splitting the
underlying bio and ultimately a use-after-free.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r-- | fs/btrfs/volumes.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 000c56a3d2a2..a0e76bb20140 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -393,6 +393,7 @@ struct btrfs_io_stripe { /* Block mapping. */ u64 physical; u64 length; + bool is_scrub; /* For the endio handler. */ struct btrfs_io_context *bioc; }; |