All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <James.Bottomley@suse.de>
Cc: dm-devel@redhat.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] Always pass result and sense on request completion
Date: Thu, 10 Dec 2009 10:49:11 +0100	[thread overview]
Message-ID: <4B20C417.4020201@suse.de> (raw)
In-Reply-To: <20091119122454.71A7D3A174@ochil.suse.de>

Hi James,

would you mind commenting on this patch?
We really need this if we ever want to be able to do proper error code
handling from multipath.

Hannes Reinecke wrote:
> Currently we're passing the SCSI result and sense
> code only for BLK_PC commands. However, some
> instances up the stack might be interested
> in them, too. So we can as well pass the
> result and a possible sense code with every
> request.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/scsi/scsi_lib.c |   28 ++++++++++++----------------
>  1 files changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index cc0a06f..10aa084 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -722,23 +722,19 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
>  			sense_deferred = scsi_sense_is_deferred(&sshdr);
>  	}
>  
> -	if (blk_pc_request(req)) { /* SG_IO ioctl from block level */
> -		req->errors = result;
> -		if (result) {
> -			if (sense_valid && req->sense) {
> -				/*
> -				 * SG_IO wants current and deferred errors
> -				 */
> -				int len = 8 + cmd->sense_buffer[7];
> +	req->errors = result;
> +	if (sense_valid && req->sense) {
> +		int len = 8 + cmd->sense_buffer[7];
> +
> +		if (len > SCSI_SENSE_BUFFERSIZE)
> +			len = SCSI_SENSE_BUFFERSIZE;
> +		memcpy(req->sense, cmd->sense_buffer,  len);
> +		req->sense_len = len;
> +	}
>  
> -				if (len > SCSI_SENSE_BUFFERSIZE)
> -					len = SCSI_SENSE_BUFFERSIZE;
> -				memcpy(req->sense, cmd->sense_buffer,  len);
> -				req->sense_len = len;
> -			}
> -			if (!sense_deferred)
> -				error = -EIO;
> -		}
> +	if (blk_pc_request(req)) { /* SG_IO ioctl from block level */
> +		if ((result) && (!sense_deferred))
> +			error = -EIO;
>  
>  		req->resid_len = scsi_get_resid(cmd);
>  

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, 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:[~2009-12-10  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-19 12:24 [PATCH] Always pass result and sense on request completion Hannes Reinecke
2009-12-10  9:49 ` Hannes Reinecke [this message]
2009-12-10 16:44   ` James Bottomley
2009-12-10 17:03     ` [dm-devel] " Mike Christie
2009-12-10 17:26       ` James Bottomley
2009-12-10 17:31     ` Boaz Harrosh
2009-12-10 17:31       ` Boaz Harrosh
2009-12-11  7:32       ` Mike Christie

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=4B20C417.4020201@suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@suse.de \
    --cc=dm-devel@redhat.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 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.