From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroup: Avoid calling qgroup functions if qgroup is not enabled
Date: Tue, 9 Oct 2018 17:44:06 +0200 [thread overview]
Message-ID: <20181009154406.GI29418@twin.jikos.cz> (raw)
In-Reply-To: <20181009063645.16113-1-wqu@suse.com>
On Tue, Oct 09, 2018 at 02:36:45PM +0800, Qu Wenruo wrote:
> Some qgroup trace events like btrfs_qgroup_release_data() and
> btrfs_qgroup_free_delayed_ref() can still be triggered even qgroup is
> not enabled.
>
> This is caused by the lack of qgroup status check before really calling
> qgroup functions.
> Thankfully related functions can handle quota disabled case well and just
> do nothing for qgroup disabled case.
>
> This patch will do earlier check before triggering related trace events.
>
> And for enabled <-> disabled race case:
> 1) For enabled->disabled case
> Disable will wipe out all qgroups data including reservation and
> excl/rfer. Even we leaks some reserveration or numbers, it will
> still be wiped, so nothing can go wrong.
>
> 2) For disabled -> enabled case
> Current btrfs_qgroup_release_data() will use extent_io tree to ensure
> we won't underflow reservation. And for delayed_ref we use
> head->qgroup_reserved to record reserved space, so in that case
> head->qgroup_reserved should be 0 and we won't underflow.
>
> Reported-by: Chris Murphy <lists@colorremedies.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
I've added the link to the report.
prev parent reply other threads:[~2018-10-09 15:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 6:36 [PATCH] btrfs: qgroup: Avoid calling qgroup functions if qgroup is not enabled Qu Wenruo
2018-10-09 15:44 ` 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=20181009154406.GI29418@twin.jikos.cz \
--to=dsterba@suse.cz \
--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