All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_dh_alua: Do not run STPG for implicit ALUA
@ 2019-10-18 13:55 Hannes Reinecke
  2019-10-18 21:44 ` Martin K. Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2019-10-18 13:55 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke,
	Hannes Reinecke

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.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 4971104b1817..0053277721d0 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -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);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi_dh_alua: Do not run STPG for implicit ALUA
  2019-10-18 13:55 [PATCH] scsi_dh_alua: Do not run STPG for implicit ALUA Hannes Reinecke
@ 2019-10-18 21:44 ` Martin K. Petersen
  2019-10-19 15:54   ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2019-10-18 21:44 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, Hannes Reinecke


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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi_dh_alua: Do not run STPG for implicit ALUA
  2019-10-18 21:44 ` Martin K. Petersen
@ 2019-10-19 15:54   ` Hannes Reinecke
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2019-10-19 15:54 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, James Bottomley, linux-scsi, Hannes Reinecke

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
hare@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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-19 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 13:55 [PATCH] scsi_dh_alua: Do not run STPG for implicit ALUA Hannes Reinecke
2019-10-18 21:44 ` Martin K. Petersen
2019-10-19 15:54   ` Hannes Reinecke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.