Commit d3e8b185 authored by Keith Busch's avatar Keith Busch

Revert "nvme-fc: fix race between error recovery and creating association"

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

This reverts commit ee6fdc50.

Link: https://lore.kernel.org/linux-nvme/hkhl56n665uvc6t5d6h3wtx7utkcorw4xlwi7d2t2bnonavhe6@xaan6pu43ap6/
Link: https://lists.infradead.org/pipermail/linux-nvme/2023-December/043756.htmlReported-by: default avatarDaniel Wagner <dwagner@suse.de>
Reported-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
Cc: Michael Liang <mliang@purestorage.com>
Tested-by: default avatarDaniel Wagner <dwagner@suse.de>
Reviewed-by: default avatarDaniel Wagner <dwagner@suse.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent c6d3ab9e
...@@ -2548,24 +2548,17 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) ...@@ -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 * the controller. Abort any ios on the association and let the
* create_association error path resolve things. * create_association error path resolve things.
*/ */
enum nvme_ctrl_state state; if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
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);
__nvme_fc_abort_outstanding_ios(ctrl, true); __nvme_fc_abort_outstanding_ios(ctrl, true);
set_bit(ASSOC_FAILED, &ctrl->flags);
dev_warn(ctrl->ctrl.device, dev_warn(ctrl->ctrl.device,
"NVME-FC{%d}: transport error during (re)connect\n", "NVME-FC{%d}: transport error during (re)connect\n",
ctrl->cnum); ctrl->cnum);
return; return;
} }
spin_unlock_irqrestore(&ctrl->lock, flags);
/* Otherwise, only proceed if in LIVE state - e.g. on first error */ /* 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; return;
dev_warn(ctrl->ctrl.device, dev_warn(ctrl->ctrl.device,
...@@ -3180,16 +3173,12 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) ...@@ -3180,16 +3173,12 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
else else
ret = nvme_fc_recreate_io_queues(ctrl); ret = nvme_fc_recreate_io_queues(ctrl);
} }
spin_lock_irqsave(&ctrl->lock, flags);
if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags)) if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
ret = -EIO; ret = -EIO;
if (ret) { if (ret)
spin_unlock_irqrestore(&ctrl->lock, flags);
goto out_term_aen_ops; goto out_term_aen_ops;
}
changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
spin_unlock_irqrestore(&ctrl->lock, flags);
ctrl->ctrl.nr_reconnects = 0; ctrl->ctrl.nr_reconnects = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment