[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241011081807.65027-1-hawkxiang.cpp@gmail.com>
Date: Fri, 11 Oct 2024 16:18:06 +0800
From: Xiang Zhang <hawkxiang.cpp@...il.com>
To: lduncan@...e.com,
cleech@...hat.com,
michael.christie@...cle.com,
ames.Bottomley@...senPartnership.com,
martin.petersen@...cle.com
Cc: open-iscsi@...glegroups.com,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Xiang Zhang <hawkxiang.cpp@...il.com>
Subject: [PATCH] scsi: libiscsi: Set expecting_cc_ua flag when stop_conn
Initiator need to recover session and reconnect to target, after calling stop_conn. And target will rebuild new session info, and mark ASC_POWERON_RESET ua sense for scsi devices belong to the target(device reset). After recovery, first scsi command(scmd) request to target will get ASC_POWERON_RESET(ua sense) + SAM_STAT_CHECK_CONDITION(status) in response.
According to scsi code: "scsi_done --> scsi_complete --> scsi_decide_disposition --> scsi_check_sense", if expecting_cc_ua = 0, scmd response with ASC_POWERON_RESET(ua sense) will ignore "cmd->retries <= cmd->allowed", fail directly. It will cause SCSI return io_error to upper layer without retry.
If we set expecting_cc_ua=1 in fail_scsi_tasks, SISC will retry the scmd which is response with ASC_POWERON_RESET. The scmd second request to target can successful, because target will clear ASC_POWERON_RESET in device pending ua_sense_list after first scmd request.
Signed-off-by: Xiang Zhang <hawkxiang.cpp@...il.com>
---
drivers/scsi/libiscsi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 0fda8905eabd..317e57be32b3 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -629,9 +629,10 @@ static void __fail_scsi_task(struct iscsi_task *task, int err)
conn->session->queued_cmdsn--;
/* it was never sent so just complete like normal */
state = ISCSI_TASK_COMPLETED;
- } else if (err == DID_TRANSPORT_DISRUPTED)
+ } else if (err == DID_TRANSPORT_DISRUPTED) {
state = ISCSI_TASK_ABRT_SESS_RECOV;
- else
+ sc->device->expecting_cc_ua = 1;
+ } else
state = ISCSI_TASK_ABRT_TMF;
sc = task->sc;
--
2.44.0
Powered by blists - more mailing lists