From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, Jeff Mahoney <jeffm@suse.com>
Subject: Re: [PATCH v2] btrfs: destroy qgroup extent records on transaction abort
Date: Fri, 14 Feb 2020 18:03:04 +0100 [thread overview]
Message-ID: <20200214170304.GD2902@twin.jikos.cz> (raw)
In-Reply-To: <20200211072537.25751-1-wqu@suse.com>
On Tue, Feb 11, 2020 at 03:25:37PM +0800, Qu Wenruo wrote:
> From: Jeff Mahoney <jeffm@suse.com>
>
> We clean up the delayed references when we abort a transaction but
> we leave the pending qgroup extent records behind, leaking memory.
>
> This patch destroyes the extent records when we destroy the delayed
> refs and checks to ensure they're gone before releasing the transaction.
>
> Fixes: 3368d001ba5df (btrfs: qgroup: Record possible quota-related extent for qgroup.)
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> [Rebased to latest upstream, remove to_qgroup() helper, use
> rbtree_postorder_for_each_entry_safe() wrapper]
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> Changelog:
> v2:
> - Update the commit message to remove to_qgroup()
Added to misc-next, thanks.
> +void btrfs_qgroup_destroy_extent_records(struct btrfs_transaction *trans)
> +{
> + struct btrfs_delayed_ref_root *delayed_refs = &trans->delayed_refs;
> + struct btrfs_qgroup_extent_record *entry;
> + struct btrfs_qgroup_extent_record *next;
> + struct rb_root *root = &delayed_refs->dirty_extent_root;
I've removed the delayed_refs varaible indirection:
root = &trans->delayed_refs.dirty_extent_root;
> + rbtree_postorder_for_each_entry_safe(entry, next, root, node) {
> + ulist_free(entry->old_roots);
> + kfree(entry);
> + }
> +}
prev parent reply other threads:[~2020-02-14 17:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-11 7:25 [PATCH v2] btrfs: destroy qgroup extent records on transaction abort Qu Wenruo
2020-02-12 13:06 ` Josef Bacik
2020-02-14 17:03 ` David Sterba [this message]
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=20200214170304.GD2902@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=jeffm@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.