From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/2] btrfs: fix the incorrect freeing of a compression folio in btrfs_submit_compressed_read()
Date: Sat, 28 Feb 2026 10:53:11 +1030 [thread overview]
Message-ID: <e215406b40140104da3357b3d5bfd18ee7dfecff.1772238005.git.wqu@suse.com> (raw)
In-Reply-To: <cover.1772238005.git.wqu@suse.com>
[BUG]
Commit dafcfa1c8e37 ("btrfs: get rid of compressed_folios[] usage for
compressed read") changed how we allocate folios for a compressed read.
Previously we allocate an array of folios for the compressed read.
But now we require all folios to be allocated and freed by
btrfs_alloc_compr_folios() and btrfs_free_compr_folios() to use the
cached folio pool.
Unfortunately we only use btrfs_alloc_compr_folio() but not pairing it
with btrfs_free_compr_folio().
This can lead to problems as a compr folio has maintained its own RCU
list, not releasing it from the RCU list can lead to various problems.
[FIX]
Use btrfs_free_compr_folio() to replace the regular folio_put() call.
Fixes: dafcfa1c8e37 ("btrfs: get rid of compressed_folios[] usage for compressed read")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/compression.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 192f133d9eb5..dd004b1cc4ef 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -576,7 +576,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio)
ret = bio_add_folio(&cb->bbio.bio, folio, cur_len, 0);
if (unlikely(!ret)) {
- folio_put(folio);
+ btrfs_free_compr_folio(folio);
ret = -EINVAL;
goto out_free_bio;
}
--
2.53.0
next prev parent reply other threads:[~2026-02-28 0:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-28 0:23 [PATCH 0/2] btrfs: fix unpaired compr folio allocation/freeing Qu Wenruo
2026-02-28 0:23 ` Qu Wenruo [this message]
2026-02-28 0:23 ` [PATCH 2/2] btrfs: fix the incorrect freeing of a compression folio in btrfs_do_encoded_write() Qu Wenruo
2026-02-28 6:41 ` [PATCH 0/2] btrfs: fix unpaired compr folio allocation/freeing 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=e215406b40140104da3357b3d5bfd18ee7dfecff.1772238005.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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