From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix the memory leak caused in lzo_compress_pages()
Date: Sat, 20 Nov 2021 17:11:16 -0500 [thread overview]
Message-ID: <YZlyhNy1/xRYVuCC@localhost.localdomain> (raw)
In-Reply-To: <20211120083411.120338-1-wqu@suse.com>
On Sat, Nov 20, 2021 at 04:34:11PM +0800, Qu Wenruo wrote:
> [BUG]
> Fstests generic/027 is pretty easy to trigger a slow but steady memory
> leak if run with "-o compress=lzo" mount option.
>
> Normally one single run of generic/027 is enough to eat up at least 4G ram.
>
> [CAUSE]
> In commit d4088803f511 ("btrfs: subpage: make lzo_compress_pages()
> compatible") we changed how @page_in is released.
>
> But that refactor makes @page_in only released after all pages being
> compressed.
>
> This leaves error path not releasing @page_in. And by "error path"
> things like incompressible data will also be treated as an error
> (-E2BIG).
>
> Thus it can leave btrfs to leak memory even there is nothing wrong
> happened.
>
> [FIX]
> Add check under @out label to release @page_in when needed, so when we
> hit any error, the input page is properly released.
>
> Reported-by: Josef Bacik <josef@toxicpanda.com>
> Fixes: d4088803f511 ("btrfs: subpage: make lzo_compress_pages() compatible")
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Woo now we're making it all the way through the xfstests runs on the vm that has
-o compress=lzo. You can add
Reviewed-and-tested-by: Josef Bacik <josef@toxicpanda.com>
Thanks for digging into this Qu,
Josef
next prev parent reply other threads:[~2021-11-20 22:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-20 8:34 [PATCH] btrfs: fix the memory leak caused in lzo_compress_pages() Qu Wenruo
2021-11-20 22:11 ` Josef Bacik [this message]
2021-11-22 18:21 ` David Sterba
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=YZlyhNy1/xRYVuCC@localhost.localdomain \
--to=josef@toxicpanda.com \
--cc=linux-btrfs@vger.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