public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.6] btrfs: free path if inline extents in range_is_hole_in_parent()
@ 2026-02-27  6:44 Hongbo Li
  2026-02-27  6:48 ` Qu Wenruo
  2026-02-27  7:52 ` [PATCH 6.6 v2] " Hongbo Li
  0 siblings, 2 replies; 9+ messages in thread
From: Hongbo Li @ 2026-02-27  6:44 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: wqu, sashal, fdmanana, linux-btrfs, lihongbo22

Commit f2dc6ab3a14c ("btrfs: send: check for inline extents in
range_is_hole_in_parent()") is a patch backported directly from
mainline to 6.6, it does not free the path in the inline extents case.

Commit 4ca6f24a52c4 ("btrfs: more trivial BTRFS_PATH_AUTO_FREE
conversions") in 6.18-rc1 fixes this by accident by converting to
BTRFS_PATH_AUTO_FREE, but we cannot backport this to 6.6 due to many
dependencies. Instead, we choose to use a goto statement to avoid the
memory leak in inline extents case.

Fixes: f2dc6ab3a14c ("btrfs: send: check for inline extents in range_is_hole_in_parent()")
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 fs/btrfs/send.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 6768e2231d61..b107a33dfd4d 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6545,8 +6545,10 @@ static int range_is_hole_in_parent(struct send_ctx *sctx,
 		extent_end = btrfs_file_extent_end(path);
 		if (extent_end <= start)
 			goto next;
-		if (btrfs_file_extent_type(leaf, fi) == BTRFS_FILE_EXTENT_INLINE)
-			return 0;
+		if (btrfs_file_extent_type(leaf, fi) == BTRFS_FILE_EXTENT_INLINE) {
+			ret = 0;
+			goto out;
+		}
 		if (btrfs_file_extent_disk_bytenr(leaf, fi) == 0) {
 			search_start = extent_end;
 			goto next;
-- 
2.34.1


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

end of thread, other threads:[~2026-03-01 20:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27  6:44 [PATCH 6.6] btrfs: free path if inline extents in range_is_hole_in_parent() Hongbo Li
2026-02-27  6:48 ` Qu Wenruo
2026-02-27  6:56   ` Qu Wenruo
2026-02-27  7:16   ` Hongbo Li
2026-02-27  7:20     ` Qu Wenruo
2026-02-27  7:52 ` [PATCH 6.6 v2] " Hongbo Li
2026-02-27  7:54   ` Qu Wenruo
2026-03-01 12:31   ` kernel test robot
2026-03-01 20:44     ` Qu Wenruo

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