scsi_dh_alua: always use a 2 seconds delay before retrying RTPG
diff mbox series

Message ID 20190712065347.93517-1-hare@suse.de
State Mainlined
Commit 20122994e38aef0ae50555884d287adde6641c94
Headers show
Series
  • scsi_dh_alua: always use a 2 seconds delay before retrying RTPG
Related show

Commit Message

Hannes Reinecke July 12, 2019, 6:53 a.m. UTC
Retrying immediately after we've received a 'transitioning' sense
code is pretty much pointless, we should always use a delay before
retrying.
So ensure the default delay is applied before retrying.

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

Comments

Martin K. Petersen July 17, 2019, 2:36 a.m. UTC | #1
Zhang,

> Retrying immediately after we've received a 'transitioning' sense
> code is pretty much pointless, we should always use a delay before
> retrying.

Does Hannes' patch alleviate your issue?
Zhangguanghui July 17, 2019, 9:19 a.m. UTC | #2
Hi
  Does Hannes' patch has been lightly tested on my scenario, always use 2 seconds delay before retrying.
The patch looks good to me, well running.
But I'd wonder whether 'if (!pg->interval) ' is necessary condition for codes style?
Thanks very much! 

the details:
Jul 17 16:21:10 cvknode2058 kernel: [16190.492656] sd 1:0:0:0: alua: rtpg retry
Jul 17 16:21:10 cvknode2058 kernel: [16190.492663] sd 1:0:0:0: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:10 cvknode2058 kernel: [16190.492665] sd 1:0:0:0: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:10 cvknode2058 kernel: [16190.492669] sd 1:0:0:1: alua: rtpg retry
Jul 17 16:21:10 cvknode2058 kernel: [16190.492673] sd 1:0:0:1: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:10 cvknode2058 kernel: [16190.492674] sd 1:0:0:1: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:10 cvknode2058 kernel: [16190.492678] sd 1:0:0:2: alua: rtpg retry
Jul 17 16:21:10 cvknode2058 kernel: [16190.492681] sd 1:0:0:2: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:10 cvknode2058 kernel: [16190.492683] sd 1:0:0:2: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:11 cvknode2058 multipathd: check_path:1711: sdo: path wwid has changed. Refusing to use
Jul 17 16:21:11 cvknode2058 multipathd: check_path:1711: sdp: path wwid has changed. Refusing to use
Jul 17 16:21:12 cvknode2058 kernel: [16192.508658] sd 1:0:0:2: alua: rtpg retry
Jul 17 16:21:12 cvknode2058 kernel: [16192.508664] sd 1:0:0:2: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:12 cvknode2058 kernel: [16192.508666] sd 1:0:0:2: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:12 cvknode2058 kernel: [16192.508670] sd 1:0:0:0: alua: rtpg retry
Jul 17 16:21:12 cvknode2058 kernel: [16192.508674] sd 1:0:0:0: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:12 cvknode2058 kernel: [16192.508676] sd 1:0:0:0: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:12 cvknode2058 kernel: [16192.508679] sd 1:0:0:1: alua: rtpg retry
Jul 17 16:21:12 cvknode2058 kernel: [16192.508682] sd 1:0:0:1: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:12 cvknode2058 kernel: [16192.508684] sd 1:0:0:1: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:14 cvknode2058 multipathd: check_path:1711: sdd: path wwid has changed. Refusing to use
Jul 17 16:21:14 cvknode2058 kernel: [16194.524638] sd 1:0:0:0: alua: rtpg retry
Jul 17 16:21:14 cvknode2058 kernel: [16194.524643] sd 1:0:0:0: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:14 cvknode2058 kernel: [16194.524645] sd 1:0:0:0: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:14 cvknode2058 kernel: [16194.524648] sd 1:0:0:1: alua: rtpg retry
Jul 17 16:21:14 cvknode2058 kernel: [16194.524651] sd 1:0:0:1: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:14 cvknode2058 kernel: [16194.524653] sd 1:0:0:1: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition
Jul 17 16:21:14 cvknode2058 kernel: [16194.524679] sd 1:0:0:2: alua: rtpg retry
Jul 17 16:21:14 cvknode2058 kernel: [16194.524682] sd 1:0:0:2: [alua] Sense Key : Not Ready [current]
Jul 17 16:21:14 cvknode2058 kernel: [16194.524684] sd 1:0:0:2: [alua] Add. Sense: Logical unit not accessible, asymmetric access state transition

-----邮件原件-----
发件人: Martin K. Petersen [mailto:martin.petersen@oracle.com]
发送时间: 2019年7月17日 10:36
收件人: zhangguanghui (Cloud)
抄送: Hannes Reinecke; Dan Carpenter; Martin K. Petersen; James Bottomley; linux-scsi@vger.kernel.org; Hannes Reinecke
主题: Re: [PATCH] scsi_dh_alua: always use a 2 seconds delay before retrying RTPG


Zhang,

> Retrying immediately after we've received a 'transitioning' sense
> code is pretty much pointless, we should always use a delay before
> retrying.

Does Hannes' patch alleviate your issue?

--
Martin K. Petersen      Oracle Linux Engineering
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有新华三集团的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!

Patch
diff mbox series

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index d7ac498ba35a..3e9a28ed417a 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -54,6 +54,7 @@ 
 #define ALUA_FAILOVER_TIMEOUT		60
 #define ALUA_FAILOVER_RETRIES		5
 #define ALUA_RTPG_DELAY_MSECS		5
+#define ALUA_RTPG_RETRY_DELAY		2
 
 /* device handler flags */
 #define ALUA_OPTIMIZE_STPG		0x01
@@ -696,7 +697,7 @@  static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
 	case SCSI_ACCESS_STATE_TRANSITIONING:
 		if (time_before(jiffies, pg->expiry)) {
 			/* State transition, retry */
-			pg->interval = 2;
+			pg->interval = ALUA_RTPG_RETRY_DELAY;
 			err = SCSI_DH_RETRY;
 		} else {
 			struct alua_dh_data *h;
@@ -821,6 +822,8 @@  static void alua_rtpg_work(struct work_struct *work)
 				spin_lock_irqsave(&pg->lock, flags);
 				pg->flags &= ~ALUA_PG_RUNNING;
 				pg->flags |= ALUA_PG_RUN_RTPG;
+				if (!pg->interval)
+					pg->interval = ALUA_RTPG_RETRY_DELAY;
 				spin_unlock_irqrestore(&pg->lock, flags);
 				queue_delayed_work(kaluad_wq, &pg->rtpg_work,
 						   pg->interval * HZ);
@@ -832,6 +835,8 @@  static void alua_rtpg_work(struct work_struct *work)
 		spin_lock_irqsave(&pg->lock, flags);
 		if (err == SCSI_DH_RETRY || pg->flags & ALUA_PG_RUN_RTPG) {
 			pg->flags &= ~ALUA_PG_RUNNING;
+			if (!pg->interval && !(pg->flags & ALUA_PG_RUN_RTPG))
+				pg->interval = ALUA_RTPG_RETRY_DELAY;
 			pg->flags |= ALUA_PG_RUN_RTPG;
 			spin_unlock_irqrestore(&pg->lock, flags);
 			queue_delayed_work(kaluad_wq, &pg->rtpg_work,