Re: [PATCH] Always pass result and sense on request completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
> ---
>  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@xxxxxxx			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux