]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: zlib: fix the folio leak on S390 hardware acceleration
authorQu Wenruo <wqu@suse.com>
Mon, 19 Jan 2026 05:54:04 +0000 (16:24 +1030)
committerDavid Sterba <dsterba@suse.com>
Wed, 21 Jan 2026 18:35:41 +0000 (19:35 +0100)
[BUG]
After commit aa60fe12b4f4 ("btrfs: zlib: refactor S390x HW acceleration
buffer preparation"), we no longer release the folio of the page cache
of folio returned by btrfs_compress_filemap_get_folio() for S390
hardware acceleration path.

[CAUSE]
Before that commit, we call kumap_local() and folio_put() after handling
each folio.

Although the timing is not ideal (it release previous folio at the
beginning of the loop, and rely on some extra cleanup out of the loop),
it at least handles the folio release correctly.

Meanwhile the refactored code is easier to read, it lacks the call to
release the filemap folio.

[FIX]
Add the missing folio_put() for copy_data_into_buffer().

CC: linux-s390@vger.kernel.org # 6.18+
Fixes: aa60fe12b4f4 ("btrfs: zlib: refactor S390x HW acceleration buffer preparation")
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zlib.c

index 6caba8be7c845ce05354a035bce8dc68ed9a4ba7..10ed48d4a846651e6825632a877e1304d62bb9a7 100644 (file)
@@ -139,6 +139,7 @@ static int copy_data_into_buffer(struct address_space *mapping,
                data_in = kmap_local_folio(folio, offset);
                memcpy(workspace->buf + cur - filepos, data_in, copy_length);
                kunmap_local(data_in);
+               folio_put(folio);
                cur += copy_length;
        }
        return 0;