Skip to content

btrfs: fix multiple bugs in raid-stripe-tree deletion path

robbieko linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6btrfs: copy devid in btrfs_partially_delete_raid_extent()fs/btrfs/raid-stripe-tree.c+3 -01 reply
2/6btrfs: fix raid stripe search missing entries at leaf boundariesfs/btrfs/raid-stripe-tree.c+15 -32 replies
3/6btrfs: fix wrong min_objectid in btrfs_previous_item() callfs/btrfs/raid-stripe-tree.c+1 -11 reply
4/6btrfs: replace ASSERT with proper error handling in stripe lookup fallbackfs/btrfs/raid-stripe-tree.c+4 -12 replies
5/6btrfs: handle -EAGAIN from btrfs_duplicate_item and refresh stale leaf pointerfs/btrfs/raid-stripe-tree.c+10 -01 reply
6/6btrfs: check return value of btrfs_partially_delete_raid_extent()fs/btrfs/raid-stripe-tree.c+12 -71 reply

Reviews trailers per patch

5 of 6 patches have a Reviewed-by or Acked-by.

PatchJohannes Thumshirn
1/6R-b
2/6R-b
3/6R-b
4/6
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] btrfs: fix multiple bugs in raid-stripe-tree deletion path

This series fixes six bugs in fs/btrfs/raid-stripe-tree.c, all within the stripe extent deletion and partial deletion code paths.

Patch 1 fixes btrfs_partially_delete_raid_extent() failing to copy the devid when rebuilding a truncated stripe extent, resulting in zeroed-out devids and corrupted stripe mappings.

Patch 2 fixes btrfs_delete_raid_extent() using offset=0 for the search key, which can miss entries when the target is the first item on a leaf. Changed to offset=(u64)-1 with proper boundary handling.

Patch 3 fixes btrfs_previous_item() being called with min_objectid=start, which prevents finding the preceding stripe extent whose objectid is less than start.

Patch 4 replaces an ASSERT(found_start <= start) with proper error handling that returns -ENOENT, avoiding kernel panics on unexpected B-tree states.

Patch 5 handles -EAGAIN from btrfs_duplicate_item() in the punch-a-hole case and refreshes the stale leaf pointer after a potential leaf split.

Patch 6 adds return value checking for all three call sites of btrfs_partially_delete_raid_extent() to avoid silently losing errors.

robbieko (6):
btrfs: copy devid in btrfs_partially_delete_raid_extent()
btrfs: fix raid stripe search missing entries at leaf boundaries
btrfs: fix wrong min_objectid in btrfs_previous_item() call
btrfs: replace ASSERT with proper error handling in stripe lookup
fallback
btrfs: handle -EAGAIN from btrfs_duplicate_item and refresh stale leaf
pointer
btrfs: check return value of btrfs_partially_delete_raid_extent()

 fs/btrfs/raid-stripe-tree.c | 57 +++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 12 deletions(-)
Signature · 4 lines
2.43.0


Disclaimer: The contents of this e-mail message and any attachments are confidential and are intended solely for addressee. The information may also be legally privileged. This transmission is sent in trust, for the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply e-mail or phone and delete this message and its attachments, if any.