diff options
| author | Qu Wenruo <wqu@suse.com> | 2025-11-26 08:20:21 +1030 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-02-03 06:38:32 +0100 |
| commit | fab0c0f03cfd0dfe793889e3374ebc68ecf18889 (patch) | |
| tree | b15d7f6c168ba0953aaf558b108648959276f149 /include/linux/i2c/git@git.tavy.me:linux.git | |
| parent | ddea91780fecd349eb4b2c4036bfbf1ab5f75321 (diff) | |
btrfs: introduce BTRFS_PATH_AUTO_RELEASE() helper
There are already several bugs with on-stack btrfs_path involved, even
it is already a little safer than btrfs_path pointers (only leaks the
extent buffers, not the btrfs_path structure itself)
- Patch "btrfs: make sure extent and csum paths are always released in
scrub_raid56_parity_stripe()"
- Patch "btrfs: fix a potential path leak in print_data_reloc_error()"
Thus there is a real need to apply auto release for those on-stack paths.
Introduces a new macro, BTRFS_PATH_AUTO_RELEASE() which defines one
on-stack btrfs_path structure, initialize it all to 0, then call
btrfs_release_path() on it when exiting the scope.
This applies to current 3 on-stack path usages:
- defrag_get_extent() in defrag.c
- print_data_reloc_error() in inode.c
There is a special case where we want to release the path early before
the time consuming iterate_extent_inodes() call, thus that manual
early release is kept as is, with an extra comment added.
- scrub_radi56_parity_stripe() in scrub.c
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/linux/i2c/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
