Skip to content

Commit c8ed6cb

Browse files
igawkeithbusch
authored andcommitted
nvme-fc: use ctrl state getter
Do not access the state variable directly, instead use proper synchronization so not stale data is read. Fixes: e6e7f7a ("nvme: ensure reset state check ordering") Signed-off-by: Daniel Wagner <wagi@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 2d1a2da commit c8ed6cb

File tree

1 file changed

+6
-3
lines changed
  • drivers/nvme/host

1 file changed

+6
-3
lines changed

drivers/nvme/host/fc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,8 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
20872087
nvme_fc_complete_rq(rq);
20882088

20892089
check_error:
2090-
if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING)
2090+
if (terminate_assoc &&
2091+
nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_RESETTING)
20912092
queue_work(nvme_reset_wq, &ctrl->ioerr_work);
20922093
}
20932094

@@ -2541,14 +2542,16 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
25412542
static void
25422543
nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
25432544
{
2545+
enum nvme_ctrl_state state = nvme_ctrl_state(&ctrl->ctrl);
2546+
25442547
/*
25452548
* if an error (io timeout, etc) while (re)connecting, the remote
25462549
* port requested terminating of the association (disconnect_ls)
25472550
* or an error (timeout or abort) occurred on an io while creating
25482551
* the controller. Abort any ios on the association and let the
25492552
* create_association error path resolve things.
25502553
*/
2551-
if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
2554+
if (state == NVME_CTRL_CONNECTING) {
25522555
__nvme_fc_abort_outstanding_ios(ctrl, true);
25532556
dev_warn(ctrl->ctrl.device,
25542557
"NVME-FC{%d}: transport error during (re)connect\n",
@@ -2557,7 +2560,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
25572560
}
25582561

25592562
/* Otherwise, only proceed if in LIVE state - e.g. on first error */
2560-
if (ctrl->ctrl.state != NVME_CTRL_LIVE)
2563+
if (state != NVME_CTRL_LIVE)
25612564
return;
25622565

25632566
dev_warn(ctrl->ctrl.device,

0 commit comments

Comments
 (0)