Linux-NVME Archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "nvme-fc: fix race between error recovery and creating association"
@ 2023-12-18 16:24 Keith Busch
  2023-12-18 16:31 ` Daniel Wagner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Keith Busch @ 2023-12-18 16:24 UTC (permalink / raw
  To: linux-nvme, hch
  Cc: sagi, james.smart, Keith Busch, Daniel Wagner, Maurizio Lombardi,
	Michael Liang

From: Keith Busch <kbusch@kernel.org>

The commit was identified to be might sleep in invalid context and is
blocking regression testing.

This reverts commit ee6fdc5055e916b1dd497f11260d4901c4c1e55e.

Link: https://lore.kernel.org/linux-nvme/hkhl56n665uvc6t5d6h3wtx7utkcorw4xlwi7d2t2bnonavhe6@xaan6pu43ap6/
Link: https://lists.infradead.org/pipermail/linux-nvme/2023-December/043756.html
Reported-by: Daniel Wagner <dwagner@suse.de>
Reported-by: Maurizio Lombardi <mlombard@redhat.com>
Cc: Michael Liang <mliang@purestorage.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvme/host/fc.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index fb22976a36a89..1d51925ea67fd 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2548,24 +2548,17 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
 	 * the controller.  Abort any ios on the association and let the
 	 * create_association error path resolve things.
 	 */
-	enum nvme_ctrl_state state;
-	unsigned long flags;
-
-	spin_lock_irqsave(&ctrl->lock, flags);
-	state = ctrl->ctrl.state;
-	if (state == NVME_CTRL_CONNECTING) {
-		set_bit(ASSOC_FAILED, &ctrl->flags);
-		spin_unlock_irqrestore(&ctrl->lock, flags);
+	if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
 		__nvme_fc_abort_outstanding_ios(ctrl, true);
+		set_bit(ASSOC_FAILED, &ctrl->flags);
 		dev_warn(ctrl->ctrl.device,
 			"NVME-FC{%d}: transport error during (re)connect\n",
 			ctrl->cnum);
 		return;
 	}
-	spin_unlock_irqrestore(&ctrl->lock, flags);
 
 	/* Otherwise, only proceed if in LIVE state - e.g. on first error */
-	if (state != NVME_CTRL_LIVE)
+	if (ctrl->ctrl.state != NVME_CTRL_LIVE)
 		return;
 
 	dev_warn(ctrl->ctrl.device,
@@ -3180,16 +3173,12 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
 		else
 			ret = nvme_fc_recreate_io_queues(ctrl);
 	}
-
-	spin_lock_irqsave(&ctrl->lock, flags);
 	if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
 		ret = -EIO;
-	if (ret) {
-		spin_unlock_irqrestore(&ctrl->lock, flags);
+	if (ret)
 		goto out_term_aen_ops;
-	}
+
 	changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
-	spin_unlock_irqrestore(&ctrl->lock, flags);
 
 	ctrl->ctrl.nr_reconnects = 0;
 
-- 
2.34.1



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

* Re: [PATCH] Revert "nvme-fc: fix race between error recovery and creating association"
  2023-12-18 16:24 [PATCH] Revert "nvme-fc: fix race between error recovery and creating association" Keith Busch
@ 2023-12-18 16:31 ` Daniel Wagner
  2023-12-19  4:26 ` Christoph Hellwig
  2023-12-19 14:15 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Wagner @ 2023-12-18 16:31 UTC (permalink / raw
  To: Keith Busch
  Cc: linux-nvme, hch, sagi, james.smart, Keith Busch,
	Maurizio Lombardi, Michael Liang

On Mon, Dec 18, 2023 at 08:24:10AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> The commit was identified to be might sleep in invalid context and is
> blocking regression testing.
> 
> This reverts commit ee6fdc5055e916b1dd497f11260d4901c4c1e55e.
> 
> Link: https://lore.kernel.org/linux-nvme/hkhl56n665uvc6t5d6h3wtx7utkcorw4xlwi7d2t2bnonavhe6@xaan6pu43ap6/
> Link: https://lists.infradead.org/pipermail/linux-nvme/2023-December/043756.html
> Reported-by: Daniel Wagner <dwagner@suse.de>
> Reported-by: Maurizio Lombardi <mlombard@redhat.com>
> Cc: Michael Liang <mliang@purestorage.com>
> Signed-off-by: Keith Busch <kbusch@kernel.org>

Thanks!

Tested-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Daniel Wagner <dwagner@suse.de>


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

* Re: [PATCH] Revert "nvme-fc: fix race between error recovery and creating association"
  2023-12-18 16:24 [PATCH] Revert "nvme-fc: fix race between error recovery and creating association" Keith Busch
  2023-12-18 16:31 ` Daniel Wagner
@ 2023-12-19  4:26 ` Christoph Hellwig
  2023-12-19 14:15 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-12-19  4:26 UTC (permalink / raw
  To: Keith Busch
  Cc: linux-nvme, hch, sagi, james.smart, Keith Busch, Daniel Wagner,
	Maurizio Lombardi, Michael Liang

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH] Revert "nvme-fc: fix race between error recovery and creating association"
  2023-12-18 16:24 [PATCH] Revert "nvme-fc: fix race between error recovery and creating association" Keith Busch
  2023-12-18 16:31 ` Daniel Wagner
  2023-12-19  4:26 ` Christoph Hellwig
@ 2023-12-19 14:15 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2023-12-19 14:15 UTC (permalink / raw
  To: Keith Busch, linux-nvme, hch
  Cc: james.smart, Keith Busch, Daniel Wagner, Maurizio Lombardi,
	Michael Liang

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


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

end of thread, other threads:[~2023-12-19 14:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-18 16:24 [PATCH] Revert "nvme-fc: fix race between error recovery and creating association" Keith Busch
2023-12-18 16:31 ` Daniel Wagner
2023-12-19  4:26 ` Christoph Hellwig
2023-12-19 14:15 ` Sagi Grimberg

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 read-only IMAP folder(s) and NNTP newsgroup(s).