From: Sagi Grimberg <sagi@grimberg.me>
To: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
Keith Busch <kbusch@kernel.org>
Cc: Anton Eidelman <anton@lightbitslabs.com>
Subject: [PATCH v2 rfc 0/3] resolve controller delete hang due to ongoing mpath I/O
Date: Sun, 5 Jul 2020 00:59:32 -0700 [thread overview]
Message-ID: <20200705075935.506535-1-sagi@grimberg.me> (raw)
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.
Feedback is welcome.
Sagi Grimberg (3):
nvme: split nvme_remove_namespaces
nvme: document nvme controller states
nvme-core: fix deadlock in disconnect during scan_work and/or ana_work
drivers/nvme/host/core.c | 45 +++++++++++++++++++++++++++--------
drivers/nvme/host/fc.c | 1 +
drivers/nvme/host/multipath.c | 13 +++++++++-
drivers/nvme/host/nvme.h | 23 +++++++++++++++++-
drivers/nvme/host/pci.c | 4 +++-
drivers/nvme/host/rdma.c | 10 ++++----
drivers/nvme/host/tcp.c | 15 +++++++-----
7 files changed, 88 insertions(+), 23 deletions(-)
--
2.25.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next reply other threads:[~2020-07-05 7:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-05 7:59 Sagi Grimberg [this message]
2020-07-05 7:59 ` [PATCH v2 rfc 1/3] nvme: split nvme_remove_namespaces Sagi Grimberg
2020-07-08 15:17 ` Christoph Hellwig
2020-07-10 4:35 ` Sagi Grimberg
2020-07-14 11:06 ` Christoph Hellwig
2020-07-22 22:58 ` Sagi Grimberg
2020-07-05 7:59 ` [PATCH v2 rfc 2/3] nvme: document nvme controller states Sagi Grimberg
2020-07-05 7:59 ` [PATCH v2 rfc 3/3] nvme-core: fix deadlock in disconnect during scan_work and/or ana_work 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=20200705075935.506535-1-sagi@grimberg.me \
--to=sagi@grimberg.me \
--cc=anton@lightbitslabs.com \
--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).