Skip to content

Commit 0d0f131

Browse files
adam900710kdave
authored andcommitted
btrfs: zlib: fix the folio leak on S390 hardware acceleration
[BUG] After commit aa60fe1 ("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: aa60fe1 ("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>
1 parent 4e15915 commit 0d0f131

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/btrfs/zlib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static int copy_data_into_buffer(struct address_space *mapping,
139139
data_in = kmap_local_folio(folio, offset);
140140
memcpy(workspace->buf + cur - filepos, data_in, copy_length);
141141
kunmap_local(data_in);
142+
folio_put(folio);
142143
cur += copy_length;
143144
}
144145
return 0;

0 commit comments

Comments
 (0)