From: Sagi Grimberg <sagi@grimberg.me>
To: Keith Busch <kbusch@kernel.org>
Cc: Anton Eidelman <anton@lightbitslabs.com>,
Christoph Hellwig <hch@lst.de>,
linux-nvme <linux-nvme@lists.infradead.org>,
Hannes Reinecke <hare@suse.de>
Subject: Re: nvme deadlock with ANA
Date: Thu, 2 Apr 2020 09:08:25 -0700 [thread overview]
Message-ID: <97402d87-2c3c-ff30-d537-6d17fd7df3b5@grimberg.me> (raw)
In-Reply-To: <20200402160003.GA3901@redsun51.ssa.fujisawa.hgst.com>
>> Hey,
>>
>> I want to consult with you guys on a deadlock condition I'm able to
>> hit with a test that incorporate controller reconnect, ana updates
>> and live I/O with timeouts.
>>
>> This is true for NVMe/TCP, but can also happen in rdma or pci drivers as
>> well.
>>
>> The deadlock combines 4 flows in parallel:
>> - ns scanning (triggered from reconnect)
>> - request timeout
>> - ANA update (triggered from reconnect)
>> - FS I/O coming into the mpath device
>>
>> (1) ns scanning triggers disk revalidation -> update disk info ->
>> freeze queue -> but blocked, why?
>>
>> (2) timeout handler reference the g_usage_counter - > but blocks in
>> the timeout handler, why?
>>
>> (3) the timeout handler (indirectly) calls nvme_stop_queue() -> which
>> takes the namespaces_rwsem - > but blocks, why?
>>
>> (4) ANA update takes the namespaces_rwsem -> calls nvme_mpath_set_live()
>> -> which synchronize the ns_head srcu (see commit 504db087aacc) ->
>> but it blocks, why?
>
>
> Why is ana updating occuring under a write lock? AFAIK, that should be
> necessary only if it's manipulating the ctrl->namespaces list, but this
> is just iterating it. What's the harm in using the read lock here?
Yes you are absolutely correct!
I think this should resolve the deadlock, as nvme_stop_queues can make
forward progress, and then the transport timeout handler will complete,
the timeout handler can decrement the g_usage_counter, and the queue
freeze in update_disk_info will complete.
I'll send a patch.
Thanks!
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-04-02 16:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 6:23 nvme deadlock with ANA Sagi Grimberg
2020-03-26 6:29 ` Sagi Grimberg
2020-04-02 7:09 ` Sagi Grimberg
2020-04-02 15:18 ` Christoph Hellwig
2020-04-02 15:24 ` Sagi Grimberg
2020-04-02 15:30 ` Hannes Reinecke
2020-04-02 15:38 ` Sagi Grimberg
2020-04-02 17:22 ` James Smart
2020-04-02 16:00 ` Keith Busch
2020-04-02 16:08 ` Sagi Grimberg [this message]
2020-04-02 16:12 ` Hannes Reinecke
2020-04-02 16:18 ` Sagi Grimberg
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=97402d87-2c3c-ff30-d537-6d17fd7df3b5@grimberg.me \
--to=sagi@grimberg.me \
--cc=anton@lightbitslabs.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).