On 10/18/19 11:44 PM, Martin K. Petersen wrote:

Hannes,

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;
         }

@@ -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()?

Good point.
Will be resending the patch.

Cheers,

Hannes
--
Dr. Hannes Reinecke            Teamlead Storage & Networking
h...@suse.de                              +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)

Reply via email to