On 3/17/26 13:06, John Garry wrote:
Add same as alua_tur() from scsi_dh_alua.c

Signed-off-by: John Garry <[email protected]>
---
  drivers/scsi/scsi_alua.c | 26 ++++++++++++++++++++++++++
  1 file changed, 26 insertions(+)

diff --git a/drivers/scsi/scsi_alua.c b/drivers/scsi/scsi_alua.c
index 1045885f74169..d8825ad7a1672 100644
--- a/drivers/scsi/scsi_alua.c
+++ b/drivers/scsi/scsi_alua.c
@@ -40,6 +40,32 @@ static struct workqueue_struct *kalua_wq;
  #define ALUA_RTPG_DELAY_MSECS         5
  #define ALUA_RTPG_RETRY_DELAY         2
+/*
+ * alua_tur - Send a TEST UNIT READY
+ * @sdev: device to which the TEST UNIT READY command should be send
+ *
+ * Send a TEST UNIT READY to @sdev to figure out the device state
+ * Returns SCSI_DH_RETRY if the sense code is NOT READY/ALUA TRANSITIONING,
+ * SCSI_DH_OK if no error occurred, and SCSI_DH_IO otherwise.
+ */
+__maybe_unused
+static int scsi_alua_tur(struct scsi_device *sdev)
+{
+       struct scsi_sense_hdr sense_hdr;
+       int retval;
+
+       retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ,
+                                     ALUA_FAILOVER_RETRIES, &sense_hdr);
+       if ((sense_hdr.sense_key == NOT_READY ||
+            sense_hdr.sense_key == UNIT_ATTENTION) &&
+           sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
+               return -EAGAIN;//SCSI_DH_RETRY;
+       else if (retval)
+               return -EIO;//SCSI_DH_IO;
+       else
+               return 0;//SCSI_DH_OK;
+}
+
  /*
   * submit_rtpg - Issue a REPORT TARGET GROUP STATES command
   * @sdev: sdev the command should be sent to

???
And this function is useful _why_?
We're just sending a normal 'TEST UNIT READY', it has nothing to
do with ALUA. Why do we have a special function here?

Cheers,

Hannes
--
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

Reply via email to