]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: check return value of btrfs_partially_delete_raid_extent()
authorrobbieko <robbieko@synology.com>
Mon, 13 Apr 2026 06:52:37 +0000 (14:52 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 21 Apr 2026 02:02:39 +0000 (04:02 +0200)
commita8d58a7c0200904ff24ca7f0d7c147017e25aa99
tree7580467b2239f130029f12c0102f35208504d28d
parentfe0cdfd7118d8b40a21bfac221bb4982c5e10e10
btrfs: check return value of btrfs_partially_delete_raid_extent()

btrfs_partially_delete_raid_extent() returns an error code (e.g.
-ENOMEM from kzalloc(), or errors from btrfs_del_item/btrfs_insert_item()),
but all three call sites in btrfs_delete_raid_extent() discard the
return value, silently losing errors and potentially leaving the stripe
tree in an inconsistent state.

Fix by capturing the return value into ret at all three call sites and
breaking out of the loop on error where appropriate.

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