public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Hongbo Li <lihongbo22@huawei.com>
To: <clm@fb.com>, <josef@toxicpanda.com>, <dsterba@suse.com>
Cc: <wqu@suse.com>, <sashal@kernel.org>, <fdmanana@suse.com>,
	<linux-btrfs@vger.kernel.org>, <lihongbo22@huawei.com>
Subject: [PATCH 6.6] btrfs: free path if inline extents in range_is_hole_in_parent()
Date: Fri, 27 Feb 2026 14:44:14 +0800	[thread overview]
Message-ID: <20260227064414.2314529-1-lihongbo22@huawei.com> (raw)

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


             reply	other threads:[~2026-02-27  6:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-27  6:44 Hongbo Li [this message]
2026-02-27  6:48 ` [PATCH 6.6] btrfs: free path if inline extents in range_is_hole_in_parent() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260227064414.2314529-1-lihongbo22@huawei.com \
    --to=lihongbo22@huawei.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox