Skip to contentSkip to conversation

scsi_dh_alua: Do not run STPG for implicit ALUA

PATCH In review Hannes Reinecke 2 participants 3 messages Oct 18, 2019 – Oct 19, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_dh_alua: Do not run STPG for implicit ALUA

If a target only supports implicit ALUA sending a SET TARGET PORT GROUPS command is not only pointless, but might actually cause issues. So don't.

---
 drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/scsi/device_handler/scsi_dh_alua.c +4 -0
index 4971104b1817..0053277721d0 100644
@@ -832,6 +832,10 @@ static void alua_rtpg_work(struct work_struct *work)
 		if (err != SCSI_DH_OK)
 			pg->flags &= ~ALUA_PG_RUN_STPG;
 	}
+	/* Do not run STPG if only implicit ALUA is supported */
+	if (scsi_device_tpgs(sdev) == TPGS_MODE_IMPLICIT)
+		pg->flags &= ~ALUA_PG_RUN_STPG;
+
 	if (pg->flags & ALUA_PG_RUN_STPG) {
 		pg->flags &= ~ALUA_PG_RUN_STPG;
 		spin_unlock_irqrestore(&pg->lock, flags);
Signature · 1 line
2.16.4
#1 lore raw

Hannes,

Quoted 2 lines

If a target only supports implicit ALUA sending a SET TARGET PORT GROUPS command is not only pointless, but might actually cause issues.

We already have a conditional in alua_stpg():

        if (!(pg->tpgs & TPGS_MODE_EXPLICIT)) {
                /* Only implicit ALUA supported, retry */
                return SCSI_DH_RETRY;
        }

drivers/scsi/device_handler/scsi_dh_alua.c static void alua_rtpg_work(struct work_struct *work) · line 841

Quoted 11 lines
drivers/scsi/device_handler/scsi_dh_alua.c +4 -0
@@ -832,6 +832,10 @@ static void alua_rtpg_work(struct work_struct *work)
 		if (err != SCSI_DH_OK)
 			pg->flags &= ~ALUA_PG_RUN_STPG;
 	}
+	/* Do not run STPG if only implicit ALUA is supported */
+	if (scsi_device_tpgs(sdev) == TPGS_MODE_IMPLICIT)
+		pg->flags &= ~ALUA_PG_RUN_STPG;
+
 	if (pg->flags & ALUA_PG_RUN_STPG) {
 		pg->flags &= ~ALUA_PG_RUN_STPG;
 		spin_unlock_irqrestore(&pg->lock, flags);

Instead of checking for EXPLICIT one place and checking for !IMPLICIT another, can we consolidate the two and maybe do:

  	if (pg->flags & ALUA_PG_RUN_STPG &&
            scsi_device_tpgs(sdev) == TPGS_MODE_EXPLICIT) {
        	[...]

and then remove the redundant check in alua_stpg()?

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
Quoted 28 lines · Martin K. Petersen

Hannes,

Quoted 2 lines

If a target only supports implicit ALUA sending a SET TARGET PORT GROUPS command is not only pointless, but might actually cause issues.

We already have a conditional in alua_stpg():

         if (!(pg->tpgs & TPGS_MODE_EXPLICIT)) {
                 /* Only implicit ALUA supported, retry */
                 return SCSI_DH_RETRY;
         }

drivers/scsi/device_handler/scsi_dh_alua.c static void alua_rtpg_work(struct work_struct *work) · line 841

Quoted 11 lines
drivers/scsi/device_handler/scsi_dh_alua.c +4 -0
@@ -832,6 +832,10 @@ static void alua_rtpg_work(struct work_struct *work)
  		if (err != SCSI_DH_OK)
  			pg->flags &= ~ALUA_PG_RUN_STPG;
  	}
+	/* Do not run STPG if only implicit ALUA is supported */
+	if (scsi_device_tpgs(sdev) == TPGS_MODE_IMPLICIT)
+		pg->flags &= ~ALUA_PG_RUN_STPG;
+
  	if (pg->flags & ALUA_PG_RUN_STPG) {
  		pg->flags &= ~ALUA_PG_RUN_STPG;
  		spin_unlock_irqrestore(&pg->lock, flags);

Instead of checking for EXPLICIT one place and checking for !IMPLICIT another, can we consolidate the two and maybe do:

Quoted 6 lines
   	if (pg->flags & ALUA_PG_RUN_STPG &&
             scsi_device_tpgs(sdev) == TPGS_MODE_EXPLICIT) {
         	[...]

and then remove the redundant check in alua_stpg()?

Good point.
Will be resending the patch.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                              +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)