All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] resolve controller delete hang due to ongoing mpath I/O
@ 2020-07-22 23:32 Sagi Grimberg
  2020-07-22 23:32 ` [PATCH v3 1/2] nvme: document nvme controller states Sagi Grimberg
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sagi Grimberg @ 2020-07-22 23:32 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch; +Cc: Anton Eidelman, James Smart

Changes from v2:
- remove nvme_remove_namespaces split (Christoph)
- tweaked nvme_path_is_disabled to look better (Christoph)

Changes from v1:
- Rename states to NVME_CTRL_DELETING and NVME_CTRL_DELETING_NOIO to better
  describe the states
- Added prep patch to split nvme_remove_namespaces to _prep_ and _do_
- Added prep patch to provide some documentation about the states

--------------------------------------------------------------------------

A deadlock happens in the following scenario with multipath:
1) scan_work(nvme0) detects a new nsid while nvme0
    is an optimized path to it, path nvme1 happens to be
    inaccessible.

2) Before scan_work is complete nvme0 disconnect is initiated
    nvme_delete_ctrl_sync() sets nvme0 state to NVME_CTRL_DELETING

3) scan_work(1) attempts to submit IO,
    but nvme_path_is_optimized() observes nvme0 is not LIVE.
    Since nvme1 is a possible path IO is requeued and scan_work hangs.

4) Delete also hangs in flush_work(ctrl->scan_work)
    from nvme_remove_namespaces().

Similiarly a deadlock with ana_work may happen: if ana_work has started
and calls nvme_mpath_set_live and device_add_disk, it will
trigger I/O. When we trigger disconnect I/O will block because
our accessible (optimized) path is disconnecting, but the alternate
path is inaccessible, so I/O blocks. Then disconnect tries to flush
the ana_work and hangs.

This patchset alters the nvme states to address this deadlock condition.

Sagi Grimberg (2):
  nvme: document nvme controller states
  nvme-core: fix deadlock in disconnect during scan_work and/or ana_work

 drivers/nvme/host/core.c      | 15 +++++++++++++++
 drivers/nvme/host/fc.c        |  1 +
 drivers/nvme/host/multipath.c | 18 +++++++++++++++---
 drivers/nvme/host/nvme.h      | 20 ++++++++++++++++++++
 drivers/nvme/host/rdma.c      | 10 ++++++----
 drivers/nvme/host/tcp.c       | 15 +++++++++------
 6 files changed, 66 insertions(+), 13 deletions(-)

-- 
2.25.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-24 16:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 23:32 [PATCH v3 0/2] resolve controller delete hang due to ongoing mpath I/O Sagi Grimberg
2020-07-22 23:32 ` [PATCH v3 1/2] nvme: document nvme controller states Sagi Grimberg
2020-07-22 23:32 ` [PATCH v3 2/2] nvme-core: fix deadlock in disconnect during scan_work and/or ana_work Sagi Grimberg
2020-07-23 23:56   ` Logan Gunthorpe
2020-07-24  0:11     ` Sagi Grimberg
2020-07-24  0:26       ` Sagi Grimberg
2020-07-24  1:03         ` Sagi Grimberg
2020-07-24 16:17           ` Logan Gunthorpe
2020-07-23  9:02 ` [PATCH v3 0/2] resolve controller delete hang due to ongoing mpath I/O Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.