]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: copy devid in btrfs_partially_delete_raid_extent()
authorrobbieko <robbieko@synology.com>
Mon, 13 Apr 2026 06:52:32 +0000 (14:52 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 21 Apr 2026 02:02:18 +0000 (04:02 +0200)
commit513f8a52eed880ea525dbb139b2127bd9bb793f1
treecc53e5aa64902113f143736d43dcebc24cc97534
parent4d95b9efd783adca472e957b2f576983e789b839
btrfs: copy devid in btrfs_partially_delete_raid_extent()

When btrfs_partially_delete_raid_extent() rebuilds a truncated/shifted
stripe extent into newitem, the loop copies the physical address for
each stride but forgets to copy the devid. The resulting item written
back to the stripe tree has zeroed-out devids, corrupting the stripe
mapping.

Fix this by reading the devid with btrfs_raid_stride_devid() and
writing it into the new item with btrfs_set_stack_raid_stride_devid()
before copying the physical address.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: robbieko <robbieko@synology.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid-stripe-tree.c