From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: qgroup: don't try to wait flushing if we're already holding a transaction
Date: Sat, 5 Dec 2020 10:55:32 +0800 [thread overview]
Message-ID: <c210ee6e-113a-f3da-b075-d8f2a8802ca0@gmx.com> (raw)
In-Reply-To: <20201204172853.GX6430@twin.jikos.cz>
[-- Attachment #1.1: Type: text/plain, Size: 1367 bytes --]
On 2020/12/5 上午1:28, David Sterba wrote:
> 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.
>
Sorry, forgot the fixes tag:
Fixes: c53e9653605d ("btrfs: qgroup: try to flush qgroup space when we
get -EDQUOT")
Mind to add that in the branch?
Thanks,
Qu
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2020-12-05 2:57 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
2020-12-05 2:55 ` Qu Wenruo [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=c210ee6e-113a-f3da-b075-d8f2a8802ca0@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=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