public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
@ 2026-02-20 13:09 Mark Harmstone
  2026-02-20 13:13 ` Filipe Manana
  2026-02-20 15:58 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Harmstone @ 2026-02-20 13:09 UTC (permalink / raw)
  To: linux-btrfs, fdmanana; +Cc: Mark Harmstone, Chris Mason

If the call to btrfs_translate_remap() in btrfs_map_block() returns an
error code, we were leaking the chunk map. Fix it by jumping to out
rather than returning directly.

Signed-off-by: Mark Harmstone <mark@harmstone.com>
Fixes: 18ba64992871 ("btrfs: redirect I/O for remapped block groups")
Suggested-by: Chris Mason <clm@fb.com>
Link: https://lore.kernel.org/linux-btrfs/20260125125830.2352988-1-clm@meta.com/
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 83e2834ea273..1bd3464ccdd8 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7082,7 +7082,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
 
 		ret = btrfs_translate_remap(fs_info, &new_logical, length);
 		if (ret)
-			return ret;
+			goto out;
 
 		if (new_logical != logical) {
 			btrfs_free_chunk_map(map);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
  2026-02-20 13:09 [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap() Mark Harmstone
@ 2026-02-20 13:13 ` Filipe Manana
  2026-02-20 15:58 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: Filipe Manana @ 2026-02-20 13:13 UTC (permalink / raw)
  To: Mark Harmstone; +Cc: linux-btrfs, Chris Mason

On Fri, Feb 20, 2026 at 1:10 PM Mark Harmstone <mark@harmstone.com> wrote:
>
> If the call to btrfs_translate_remap() in btrfs_map_block() returns an
> error code, we were leaking the chunk map. Fix it by jumping to out
> rather than returning directly.
>
> Signed-off-by: Mark Harmstone <mark@harmstone.com>
> Fixes: 18ba64992871 ("btrfs: redirect I/O for remapped block groups")
> Suggested-by: Chris Mason <clm@fb.com>

It's a bug fix so this is more a Reported-by rather than a Suggested-by.

Otherwise,

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Thanks.

> Link: https://lore.kernel.org/linux-btrfs/20260125125830.2352988-1-clm@meta.com/
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 83e2834ea273..1bd3464ccdd8 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -7082,7 +7082,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op,
>
>                 ret = btrfs_translate_remap(fs_info, &new_logical, length);
>                 if (ret)
> -                       return ret;
> +                       goto out;
>
>                 if (new_logical != logical) {
>                         btrfs_free_chunk_map(map);
> --
> 2.52.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
  2026-02-20 13:09 [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap() Mark Harmstone
  2026-02-20 13:13 ` Filipe Manana
@ 2026-02-20 15:58 ` David Sterba
  2026-02-20 16:27   ` Mark Harmstone
  1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2026-02-20 15:58 UTC (permalink / raw)
  To: Mark Harmstone; +Cc: linux-btrfs, fdmanana, Chris Mason

On Fri, Feb 20, 2026 at 01:09:54PM +0000, Mark Harmstone wrote:
> If the call to btrfs_translate_remap() in btrfs_map_block() returns an
> error code, we were leaking the chunk map. Fix it by jumping to out
> rather than returning directly.
> 
> Signed-off-by: Mark Harmstone <mark@harmstone.com>
> Fixes: 18ba64992871 ("btrfs: redirect I/O for remapped block groups")
> Suggested-by: Chris Mason <clm@fb.com>

If it's a but then it's Reported-by

> Link: https://lore.kernel.org/linux-btrfs/20260125125830.2352988-1-clm@meta.com/

Please sort the tags according to
https://btrfs.readthedocs.io/en/latest/dev/Developer-s-FAQ.html#ordering

as it's been for a long time and saves me editing each patch. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap()
  2026-02-20 15:58 ` David Sterba
@ 2026-02-20 16:27   ` Mark Harmstone
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Harmstone @ 2026-02-20 16:27 UTC (permalink / raw)
  To: dsterba; +Cc: linux-btrfs, fdmanana, Chris Mason

On 20/02/2026 3.58 pm, David Sterba wrote:
> On Fri, Feb 20, 2026 at 01:09:54PM +0000, Mark Harmstone wrote:
>> If the call to btrfs_translate_remap() in btrfs_map_block() returns an
>> error code, we were leaking the chunk map. Fix it by jumping to out
>> rather than returning directly.
>>
>> Signed-off-by: Mark Harmstone <mark@harmstone.com>
>> Fixes: 18ba64992871 ("btrfs: redirect I/O for remapped block groups")
>> Suggested-by: Chris Mason <clm@fb.com>
> 
> If it's a but then it's Reported-by
> 
>> Link: https://lore.kernel.org/linux-btrfs/20260125125830.2352988-1-clm@meta.com/
> 
> Please sort the tags according to
> https://btrfs.readthedocs.io/en/latest/dev/Developer-s-FAQ.html#ordering
> 
> as it's been for a long time and saves me editing each patch. Thanks.

Okay, I've edited the patches and pushed them with the tags in the right 
order.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-20 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20 13:09 [PATCH] btrfs: fix chunk map leak in btrfs_map_block() after btrfs_translate_remap() Mark Harmstone
2026-02-20 13:13 ` Filipe Manana
2026-02-20 15:58 ` David Sterba
2026-02-20 16:27   ` Mark Harmstone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox