diff options
| author | Shuangpeng Bai <shuangpeng.kernel@gmail.com> | 2026-07-05 01:46:35 -0400 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-08-07 19:17:16 +0200 |
| commit | 3f950867c307c5413d628a153ac44915bd117ffd (patch) | |
| tree | af3f61dfd5adb2eed3a6d56b1437b13700f28670 /tools/perf/scripts/python/syscall-counts.py | |
| parent | ee2851074b4a555c7f4f883816143cce46880e0c (diff) | |
btrfs: fix extent map leak in NOCOW direct I/O write
btrfs_dio_iomap_begin() calls btrfs_get_extent(), which returns an
extent map reference that must be dropped on all exit paths.
For direct writes into a NOCOW range, btrfs_get_blocks_direct_write()
keeps using that extent map and asks btrfs_create_dio_extent() to
allocate the ordered extent. If that fails, for example because
btrfs_alloc_ordered_extent() fails, the function returns the error
without dropping the input extent map. The PREALLOC path avoided this by
dropping the input extent map before replacing it with the newly created
one.
Check the error from btrfs_create_dio_extent() before replacing the
map and drop the input extent map on failure.
Fixes: 5f9a8a51d8b9 ("Btrfs: add semaphore to synchronize direct IO writes with fsync")
CC: stable@vger.kernel.org
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions
