diff options
| author | robbieko <robbieko@synology.com> | 2026-04-13 14:52:36 +0800 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-04-21 04:02:34 +0200 |
| commit | fe0cdfd7118d8b40a21bfac221bb4982c5e10e10 (patch) | |
| tree | ec9642f0a25558a4dc2a963d7e97985bf14046a5 /include/linux/workqueue_api.h | |
| parent | 653361585d251fbca0e19ac58b04ba95dd01e378 (diff) | |
btrfs: handle -EAGAIN from btrfs_duplicate_item and refresh stale leaf pointer
In the 'punch a hole' case of btrfs_delete_raid_extent(),
btrfs_duplicate_item() can return -EAGAIN when the leaf needs to be
split and the path becomes invalid. The old code treats any error as
fatal and breaks out of the loop.
Additionally, btrfs_duplicate_item() may trigger setup_leaf_for_split()
which can reallocate the leaf node. The code continues using the old
leaf pointer, leading to use-after-free or stale data access.
Fix both issues by:
- Handling -EAGAIN specifically: release the path and retry the loop.
- Refreshing leaf = path->nodes[0] after successful duplication.
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>
Diffstat (limited to 'include/linux/workqueue_api.h')
0 files changed, 0 insertions, 0 deletions
