From: Hannes Reinecke <hare@suse.de>
To: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>
Cc: Anton Eidelman <anton@lightbitslabs.com>,
Christoph Hellwig <hch@lst.de>,
linux-nvme <linux-nvme@lists.infradead.org>
Subject: Re: nvme deadlock with ANA
Date: Thu, 2 Apr 2020 18:12:06 +0200 [thread overview]
Message-ID: <9d8c4bed-1b90-41c0-9cf3-2907bb21889d@suse.de> (raw)
In-Reply-To: <20200402160003.GA3901@redsun51.ssa.fujisawa.hgst.com>
On 4/2/20 6:00 PM, Keith Busch wrote:
> On Wed, Mar 25, 2020 at 11:23:50PM -0700, Sagi Grimberg wrote:
>> 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?
>
While we do lock ns->head when updating the ana state, we do not protect
the ns->head pointer itself.
So I guess the intention was to avoid anyone messing with the ns->head
pointer while traversing; but looking closer I think we should be good
with just taking the read lock.
Can you try if it makes a difference?
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
_______________________________________________
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:12 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
2020-04-02 16:12 ` Hannes Reinecke [this message]
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=9d8c4bed-1b90-41c0-9cf3-2907bb21889d@suse.de \
--to=hare@suse.de \
--cc=anton@lightbitslabs.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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