From: Liu Bo <bo.li.liu@oracle.com>
To: dsterba@suse.cz
Cc: Josef Bacik <jbacik@fb.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: don't leak reloc root nodes on error
Date: Tue, 6 Sep 2016 12:22:01 -0700 [thread overview]
Message-ID: <20160906192200.GA31641@localhost.localdomain> (raw)
In-Reply-To: <20160905152053.GX16983@twin.jikos.cz>
On Mon, Sep 05, 2016 at 05:20:53PM +0200, David Sterba wrote:
> On Fri, Sep 02, 2016 at 06:08:35PM -0700, Liu Bo wrote:
> > On Fri, Sep 02, 2016 at 03:25:43PM -0400, Josef Bacik wrote:
> > > We don't track the reloc roots in any sort of normal way, so the only way the
> > > root/commit_root nodes get free'd is if the relocation finishes successfully and
> > > the reloc root is deleted. Fix this by free'ing them in free_reloc_roots.
> > > Thanks,
> >
> > Looks good.
> >
> > >
> > > Signed-off-by: Josef Bacik <jbacik@fb.com>
> > > ---
> > > fs/btrfs/relocation.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> > > index 7fc6ea7..62dfc2c 100644
> > > --- a/fs/btrfs/relocation.c
> > > +++ b/fs/btrfs/relocation.c
> > > @@ -2349,6 +2349,10 @@ void free_reloc_roots(struct list_head *list)
> > > while (!list_empty(list)) {
> > > reloc_root = list_entry(list->next, struct btrfs_root,
> > > root_list);
> > > + free_extent_buffer(reloc_root->node);
> > > + free_extent_buffer(reloc_root->commit_root);
> > > + reloc_root->node = NULL;
> > > + reloc_root->commit_root = NULL;
> >
> > What about reloc_root itself?
>
> > > __del_reloc_root(reloc_root);
>
> It's deleted at the end of __del_reloc_root
__del_reloc_root() is dealing with the associated rb_node, not
reloc_root.
I posted a patch to free reloc_root while free'ing its corresponding fs
root, but it'd be good if we can free it here.
Thanks,
-liubo
next prev parent reply other threads:[~2016-09-06 19:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 19:25 [PATCH] Btrfs: don't leak reloc root nodes on error Josef Bacik
2016-09-03 1:08 ` Liu Bo
2016-09-05 15:20 ` David Sterba
2016-09-06 19:22 ` Liu Bo [this message]
2016-09-21 14:00 ` David Sterba
2016-09-21 22:45 ` [PATCH] Btrfs: don't leak reloc root nodes on errorg Liu Bo
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=20160906192200.GA31641@localhost.localdomain \
--to=bo.li.liu@oracle.com \
--cc=dsterba@suse.cz \
--cc=jbacik@fb.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;
as well as URLs for NNTP newsgroup(s).