Thread (9 messages) 9 messages, 3 authors, 2016-08-16

Re: [BUG] Deadlock in blk_mq_register_disk error path

From: Jinpu Wang <hidden>
Date: 2016-08-03 08:02:37

On Tue, Aug 2, 2016 at 7:21 PM, Jens Axboe [off-list ref] wrote:
On 08/02/2016 06:58 AM, Jinpu Wang wrote:
quoted
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 =3D 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=3Dfor-linus&id=3D6316338a=
94b2319abe9d3790eb9cdc56ef81ac1a

--
Jens Axboe
Thanks Jens, looks good to me!


--=20
Mit freundlichen Gr=C3=BC=C3=9Fen,
Best Regards,

Jack Wang

Linux Kernel Developer Storage
ProfitBricks GmbH  The IaaS-Company.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help