All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-fabrics: Fix state check in nvmf_ctlr_matches_baseopts()
@ 2022-01-20 20:17 James Smart
  2022-01-23  9:16 ` Sagi Grimberg
  2022-02-03  6:31 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2022-01-20 20:17 UTC (permalink / raw)
  To: linux-nvme; +Cc: James Smart, stable, Uday Shankar, Sagi Grimberg

From: Uday Shankar <ushankar@purestorage.com>

Controller deletion/reset, immediately followed by or concurrent with
a reconnect, is hard failing the connect attempt resulting in a
complete loss of connectivity to the controller.

In the connect request, fabrics looks for an existing controller with
the same address components and aborts the connect if a controller
already exists and the duplicate connect option isn't set. The match
routine filters out controllers that are dead or dying, so they don't
interfere with the new connect request.

When NVME_CTRL_DELETING_NOIO was added, it missed updating the state
filters in the nvmf_ctlr_matches_baseopts() routine. Thus, when in this
new state, it's seen as a live controller and fails the connect request.

Correct by adding the DELETING_NIO state to the match checks.

Fixes: ecca390e8056 ("nvme: fix deadlock in disconnect during scan_work and/or ana_work")
Cc: <stable@vger.kernel.org> # v5.7+
Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Reviewed-by: James Smart <jsmart2021@gmail.com>
CC: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/fabrics.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index c3203ff1c654..1e3a09cad961 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -170,6 +170,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
 			struct nvmf_ctrl_options *opts)
 {
 	if (ctrl->state == NVME_CTRL_DELETING ||
+	    ctrl->state == NVME_CTRL_DELETING_NOIO ||
 	    ctrl->state == NVME_CTRL_DEAD ||
 	    strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
 	    strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||
-- 
2.26.2


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

* Re: [PATCH] nvme-fabrics: Fix state check in nvmf_ctlr_matches_baseopts()
  2022-01-20 20:17 [PATCH] nvme-fabrics: Fix state check in nvmf_ctlr_matches_baseopts() James Smart
@ 2022-01-23  9:16 ` Sagi Grimberg
  2022-02-03  6:31 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2022-01-23  9:16 UTC (permalink / raw)
  To: James Smart, linux-nvme; +Cc: stable, Uday Shankar

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH] nvme-fabrics: Fix state check in nvmf_ctlr_matches_baseopts()
  2022-01-20 20:17 [PATCH] nvme-fabrics: Fix state check in nvmf_ctlr_matches_baseopts() James Smart
  2022-01-23  9:16 ` Sagi Grimberg
@ 2022-02-03  6:31 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-02-03  6:31 UTC (permalink / raw)
  To: James Smart; +Cc: linux-nvme, stable, Uday Shankar, Sagi Grimberg

Thanks,

applied to nvme-5.17.

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

end of thread, other threads:[~2022-02-03  6:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 20:17 [PATCH] nvme-fabrics: Fix state check in nvmf_ctlr_matches_baseopts() James Smart
2022-01-23  9:16 ` Sagi Grimberg
2022-02-03  6:31 ` 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.