From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroup: don't try to wait flushing if we're already holding a transaction
Date: Fri, 4 Dec 2020 18:28:53 +0100 [thread overview]
Message-ID: <20201204172853.GX6430@twin.jikos.cz> (raw)
In-Reply-To: <20201204012448.26546-1-wqu@suse.com>
On Fri, Dec 04, 2020 at 09:24:47AM +0800, Qu Wenruo wrote:
> There is a chance of racing for qgroup flushing which may lead to
> deadlock:
>
> Thread A | Thread B
> (no trans handler hold) | (already hold a trans handler)
> --------------------------------+--------------------------------
> __btrfs_qgroup_reserve_meta() | __btrfs_qgroup_reserve_meta()
> |- try_flush_qgroup() | |- try_flushing_qgroup()
> |- QGROUP_FLUSHING bit set | |
> | | |- test_and_set_bit()
> | | |- wait_event()
> |- btrfs_join_transaction() |
> |- btrfs_commit_transaction()|
>
> !!! DEAD LOCK !!!
>
> Since thread A want to commit transaction, but thread B is hold a
> transaction handler, blocking the commit.
> At the same time, thread B is waiting thread A to finish it commit.
>
> This is just a hot fix, and would lead to more EDQUOT when we're near
> the qgroup limit.
>
> The root fix would to make all metadata/data reservation to happen
> without a transaction handler hold.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Added to misc-next, thanks.
next prev parent reply other threads:[~2020-12-04 17:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-04 1:24 [PATCH] btrfs: qgroup: don't try to wait flushing if we're already holding a transaction Qu Wenruo
2020-12-04 1:24 ` [PATCH] btrfs: qgroup: don't commit transaction when we already hold the handle Qu Wenruo
2020-12-04 7:37 ` Nikolay Borisov
2020-12-04 7:46 ` Qu Wenruo
2020-12-04 11:48 ` [PATCH] btrfs: qgroup: don't try to wait flushing if we're already holding a transaction Filipe Manana
2020-12-04 17:28 ` David Sterba [this message]
2020-12-05 2:55 ` Qu Wenruo
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=20201204172853.GX6430@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