From: wenxiong@linux.vnet.ibm.com
To: James.Bottomley@HansenPartnership.com
Cc: linux-scsi@vger.kernel.org, brking@linux.vnet.ibm.com,
Wen Xiong <wenxiong@linux.vnet.ibm.com>
Subject: [PATCH 1/1] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd
Date: Mon, 15 Apr 2013 13:39:50 -0500 [thread overview]
Message-ID: <20130415184142.788994252@linux.vnet.ibm.com> (raw)
In-Reply-To: 20130415183949.678757952@linux.vnet.ibm.com
[-- Attachment #1: check_return_of_queuecommand --]
[-- Type: text/plain, Size: 1468 bytes --]
Fix scsi_send_eh_cmnd to check the return code of queuecommand when
sending commands and retry for a bit if the LLDD returns a busy response.
This fixes an issue seen with the ipr driver where an ipr initiated reset
immediately following an eh_host_reset caused EH initiated commands to fail,
resulting in devices being taken offline. This patch resolves the issue.
Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
---
drivers/scsi/scsi_error.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: b/drivers/scsi/scsi_error.c
===================================================================
--- a/drivers/scsi/scsi_error.c 2013-04-10 12:55:57.000000000 -0500
+++ b/drivers/scsi/scsi_error.c 2013-04-10 13:04:12.467858487 -0500
@@ -793,6 +793,7 @@ static int scsi_send_eh_cmnd(struct scsi
DECLARE_COMPLETION_ONSTACK(done);
unsigned long timeleft;
struct scsi_eh_save ses;
+ int attempts = 30;
int rtn;
scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
@@ -800,7 +801,14 @@ static int scsi_send_eh_cmnd(struct scsi
scsi_log_send(scmd);
scmd->scsi_done = scsi_eh_done;
- shost->hostt->queuecommand(shost, scmd);
+
+ while ((rtn = shost->hostt->queuecommand(shost, scmd)) && attempts) {
+ if (rtn == SCSI_MLQUEUE_DEVICE_BUSY ||
+ rtn == SCSI_MLQUEUE_TARGET_BUSY ||
+ rtn == SCSI_MLQUEUE_HOST_BUSY)
+ attempts--;
+ ssleep(1);
+ }
timeleft = wait_for_completion_timeout(&done, timeout);
--
next prev parent reply other threads:[~2013-04-15 18:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-15 18:39 [PATCH 0/1] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd wenxiong
2013-04-15 18:39 ` wenxiong [this message]
2013-04-15 20:45 ` James Bottomley
2013-04-15 21:55 ` Brian King
2013-04-15 22:33 ` James Bottomley
2013-04-16 0:09 ` wenxiong
2013-04-16 15:12 ` Brian King
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=20130415184142.788994252@linux.vnet.ibm.com \
--to=wenxiong@linux.vnet.ibm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=brking@linux.vnet.ibm.com \
--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