summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.h
diff options
context:
space:
mode:
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>2023-09-14 18:07:01 +0200
committerDavid Sterba <dsterba@suse.com>2023-10-12 16:44:09 +0200
commit9acaa64187f9b4cbb75622883c96ea1a893d5431 (patch)
tree49b678991588de37505fa00be1b48dbfbaaea79d /fs/btrfs/volumes.h
parentbtrfs: lookup physical address from stripe extent (diff)
downloadlinux-9acaa64187f9b4cbb75622883c96ea1a893d5431.tar.xz
linux-9acaa64187f9b4cbb75622883c96ea1a893d5431.zip
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 '')
-rw-r--r--fs/btrfs/volumes.h1
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;
};