linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian King <brking@linux.vnet.ibm.com>
To: linux-scsi <linux-scsi@vger.kernel.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Hannes Reinecke <hare@suse.de>,
	Bart Van Assche <bart.vanassche@sandisk.com>
Subject: [PATCH] SCSI: Scale up REPORT_LUNS timeout on failure
Date: Wed, 02 Sep 2015 09:31:46 -0500	[thread overview]
Message-ID: <55E70852.9050506@linux.vnet.ibm.com> (raw)
In-Reply-To: <55DDB8F3.3020308@suse.de>


This patch fixes an issue seen with an IBM 2145 (SVC) where, following an error
injection test which results in paths going offline, when they came
back online, the path would timeout the REPORT_LUNS issued during the
scan. This timeout situation continued until retries were expired, resulting in
falling back to a sequential LUN scan. Then, since the target responds
with PQ=1, PDT=0 for all possible LUNs, due to the way the sequential
LUN scan code works, we end up adding 512 LUNs for each target, when there
is really only a small handful of LUNs that are actually present.

This patch doubles the timeout used on the REPORT_LUNS for each retry
after a timeout is seen on a REPORT_LUNS. This patch solves the issue
of 512 non existent LUNs showing up after this event. Running the test
with this patch still showed that we were regularly hitting two timeouts,
but the third, and final, REPORT_LUNS was always successful.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 drivers/scsi/scsi_scan.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff -puN drivers/scsi/scsi_scan.c~scsi_report_luns_timeout_escalate drivers/scsi/scsi_scan.c
--- linux/drivers/scsi/scsi_scan.c~scsi_report_luns_timeout_escalate	2015-09-02 08:49:07.268243497 -0500
+++ linux-bjking1/drivers/scsi/scsi_scan.c	2015-09-02 08:49:07.272243461 -0500
@@ -1304,6 +1304,7 @@ static int scsi_report_lun_scan(struct s
 	struct scsi_device *sdev;
 	struct Scsi_Host *shost = dev_to_shost(&starget->dev);
 	int ret = 0;
+	int timeout = SCSI_TIMEOUT + 4 * HZ;
 
 	/*
 	 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set.
@@ -1383,7 +1384,7 @@ retry:
 
 		result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE,
 					  lun_data, length, &sshdr,
-					  SCSI_TIMEOUT + 4 * HZ, 3, NULL);
+					  timeout, 3, NULL);
 
 		SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
 				"scsi scan: REPORT LUNS"
@@ -1392,6 +1393,8 @@ retry:
 				retries, result));
 		if (result == 0)
 			break;
+		else if (host_byte(result) == DID_TIME_OUT)
+			timeout = timeout * 2;
 		else if (scsi_sense_valid(&sshdr)) {
 			if (sshdr.sense_key != UNIT_ATTENTION)
 				break;
_


  parent reply	other threads:[~2015-09-02 14:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 22:11 SCSI scanning behavior Brian King
2015-08-26 13:02 ` Hannes Reinecke
2015-08-26 13:52   ` Bart Van Assche
2015-09-02 14:31   ` Brian King [this message]
2015-09-04 15:00     ` [PATCH] SCSI: Scale up REPORT_LUNS timeout on failure Bart Van Assche
2015-09-04 15:28       ` Brian King
2015-09-04 15:36     ` James Bottomley
2015-09-04 15:47       ` Brian King
2015-09-04 16:15         ` James Bottomley
2015-09-04 19:47           ` [PATCH] SCSI: Increase REPORT_LUNS timeout Brian King
2015-09-13  8:43             ` Hannes Reinecke
2015-11-03  4:03             ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E70852.9050506@linux.vnet.ibm.com \
    --to=brking@linux.vnet.ibm.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).