* [PATCH] btrfs: tests: fix chunk map leak after failure to add it to the tree
@ 2025-03-11 16:06 fdmanana
2025-03-11 16:19 ` Boris Burkov
2025-03-11 21:25 ` Qu Wenruo
0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2025-03-11 16:06 UTC (permalink / raw)
To: linux-btrfs
From: Filipe Manana <fdmanana@suse.com>
If we fail to add the chunk map to the fs mapping tree we exit
test_rmap_block() without freeing the chunk map. Fix this by adding a
call to btrfs_free_chunk_map() before exiting the test function if the
call to btrfs_add_chunk_map() failed.
Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
fs/btrfs/tests/extent-map-tests.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c
index 56e61ac1cc64..609bb6c9c087 100644
--- a/fs/btrfs/tests/extent-map-tests.c
+++ b/fs/btrfs/tests/extent-map-tests.c
@@ -1045,6 +1045,7 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
ret = btrfs_add_chunk_map(fs_info, map);
if (ret) {
test_err("error adding chunk map to mapping tree");
+ btrfs_free_chunk_map(map);
goto out_free;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs: tests: fix chunk map leak after failure to add it to the tree
2025-03-11 16:06 [PATCH] btrfs: tests: fix chunk map leak after failure to add it to the tree fdmanana
@ 2025-03-11 16:19 ` Boris Burkov
2025-03-11 21:25 ` Qu Wenruo
1 sibling, 0 replies; 3+ messages in thread
From: Boris Burkov @ 2025-03-11 16:19 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs
On Tue, Mar 11, 2025 at 04:06:46PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> If we fail to add the chunk map to the fs mapping tree we exit
> test_rmap_block() without freeing the chunk map. Fix this by adding a
> call to btrfs_free_chunk_map() before exiting the test function if the
> call to btrfs_add_chunk_map() failed.
>
> Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
> fs/btrfs/tests/extent-map-tests.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c
> index 56e61ac1cc64..609bb6c9c087 100644
> --- a/fs/btrfs/tests/extent-map-tests.c
> +++ b/fs/btrfs/tests/extent-map-tests.c
> @@ -1045,6 +1045,7 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
> ret = btrfs_add_chunk_map(fs_info, map);
> if (ret) {
> test_err("error adding chunk map to mapping tree");
> + btrfs_free_chunk_map(map);
> goto out_free;
> }
>
> --
> 2.45.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs: tests: fix chunk map leak after failure to add it to the tree
2025-03-11 16:06 [PATCH] btrfs: tests: fix chunk map leak after failure to add it to the tree fdmanana
2025-03-11 16:19 ` Boris Burkov
@ 2025-03-11 21:25 ` Qu Wenruo
1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2025-03-11 21:25 UTC (permalink / raw)
To: fdmanana, linux-btrfs
在 2025/3/12 02:36, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> If we fail to add the chunk map to the fs mapping tree we exit
> test_rmap_block() without freeing the chunk map. Fix this by adding a
> call to btrfs_free_chunk_map() before exiting the test function if the
> call to btrfs_add_chunk_map() failed.
>
> Fixes: 7dc66abb5a47 ("btrfs: use a dedicated data structure for chunk maps")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/tests/extent-map-tests.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c
> index 56e61ac1cc64..609bb6c9c087 100644
> --- a/fs/btrfs/tests/extent-map-tests.c
> +++ b/fs/btrfs/tests/extent-map-tests.c
> @@ -1045,6 +1045,7 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
> ret = btrfs_add_chunk_map(fs_info, map);
> if (ret) {
> test_err("error adding chunk map to mapping tree");
> + btrfs_free_chunk_map(map);
> goto out_free;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-11 21:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 16:06 [PATCH] btrfs: tests: fix chunk map leak after failure to add it to the tree fdmanana
2025-03-11 16:19 ` Boris Burkov
2025-03-11 21:25 ` Qu Wenruo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.