From: Jens Axboe <axboe@kernel.dk>
To: Jinpu Wang <jinpu.wang@profitbricks.com>, linux-block@vger.kernel.org
Subject: Re: [BUG] Deadlock in blk_mq_register_disk error path
Date: Tue, 2 Aug 2016 10:21:22 -0700 [thread overview]
Message-ID: <16bc5b4f-e217-969e-4f26-5f4b04705dcc@kernel.dk> (raw)
In-Reply-To: <CAMGffEmw8ako59nAkDfpHWH06xAngkKR0YYpxF24LwZMjA9P2g@mail.gmail.com>
On 08/02/2016 06:58 AM, Jinpu Wang wrote:
> Hi Jens,
>
> I found in blk_mq_register_disk, we blk_mq_disable_hotplug which in
> turn mutex_lock(&all_q_mutex);
> queue_for_each_hw_ctx(q, hctx, i) {
> ret = blk_mq_register_hctx(hctx);
> if (ret)
> break; /// if about error out, we will call
> unregister below
> }
>
> if (ret)
> blk_mq_unregister_disk(disk);
>
> In blk_mq_unregister_disk, we will try to disable_hotplug again, which
> leads to dead lock.
>
> Did I miss anything?
Nope, your analysis looks correct. This should fix it:
http://git.kernel.dk/cgit/linux-block/commit/?h=for-linus&id=6316338a94b2319abe9d3790eb9cdc56ef81ac1a
--
Jens Axboe
next prev parent reply other threads:[~2016-08-02 17:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 13:58 [BUG] Deadlock in blk_mq_register_disk error path Jinpu Wang
2016-08-02 17:21 ` Jens Axboe [this message]
2016-08-03 8:02 ` Jinpu Wang
2016-08-15 15:53 ` Bart Van Assche
2016-08-15 16:01 ` Jinpu Wang
2016-08-15 16:22 ` Bart Van Assche
2016-08-16 8:18 ` Jinpu Wang
2016-08-15 17:15 ` Jens Axboe
2016-08-15 17:41 ` Bart Van Assche
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=16bc5b4f-e217-969e-4f26-5f4b04705dcc@kernel.dk \
--to=axboe@kernel.dk \
--cc=jinpu.wang@profitbricks.com \
--cc=linux-block@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