All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <jbottomley@parallels.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Wen Xiong <wenxiong@linux.vnet.ibm.com>,
	Brian King <brking@linux.vnet.ibm.com>
Subject: Re: [PATCH][v3] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd
Date: Thu, 25 Apr 2013 07:53:41 +0200	[thread overview]
Message-ID: <5178C4E5.9070809@suse.de> (raw)
In-Reply-To: <1366814922.1971.5.camel@dabdike>

On 04/24/2013 04:48 PM, James Bottomley wrote:
> On Wed, 2013-04-24 at 13:32 +0200, Hannes Reinecke wrote:
>> scsi_send_eh_cmnd() is calling queuecommand() directly, so
>> it needs to check the return value here.
>> The only valid return codes for queuecommand() are 'busy'
>> states, so we need to wait for a bit to allow the LLDD
>> to recover.
>>
>> Based on an earlier patch from Wen Xiong.
> 
> This looks good, only one minor nitpick:
> 
>> Cc: Wen Xiong <wenxiong@linux.vnet.ibm.com>
>> Cc: Brian King <brking@linux.vnet.ibm.com>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>>
>> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index c1b05a8..1fc6da94 100644
>> --- a/drivers/scsi/scsi_error.c
>> +++ b/drivers/scsi/scsi_error.c
>> @@ -791,22 +791,32 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
>>  	struct scsi_device *sdev = scmd->device;
>>  	struct Scsi_Host *shost = sdev->host;
>>  	DECLARE_COMPLETION_ONSTACK(done);
>> -	unsigned long timeleft;
>> +	unsigned long timeleft = timeout;
>>  	struct scsi_eh_save ses;
>> +	const int stall_for = min(HZ/10, 1);
>>  	int rtn;
>>  
>> +retry:
>>  	scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
>>  	shost->eh_action = &done;
>>  
>>  	scsi_log_send(scmd);
>>  	scmd->scsi_done = scsi_eh_done;
>> -	shost->hostt->queuecommand(shost, scmd);
>> -
>> -	timeleft = wait_for_completion_timeout(&done, timeout);
>> +	rtn = shost->hostt->queuecommand(shost, scmd);
>> +	if (rtn) {
>> +		if (timeleft) {
>> +			scsi_eh_restore_cmnd(scmd, &ses);
>> +			timeleft -= stall_for;
>> +			msleep(stall_for);
> 
> Stall for is in HZ: need to convert to ms, so
> 
> 			msleep(stall_for * 1000/HZ);
> 
Right. Will be converting it.

> I also don't see a need to restore and reprep the command each time, but
> I don't see a problem with it either.
> 
This was mainly thought as a safeguard here; just in case someone
else might be fiddling with the command. But yeah, it's not required.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2013-04-25  5:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 11:32 [PATCH][v3] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd Hannes Reinecke
2013-04-24 14:48 ` James Bottomley
2013-04-25  5:53   ` Hannes Reinecke [this message]

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=5178C4E5.9070809@suse.de \
    --to=hare@suse.de \
    --cc=brking@linux.vnet.ibm.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=wenxiong@linux.vnet.ibm.com \
    /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 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.