The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Ching Huang <ching2048@areca.com.tw>,
	hch@infradead.org, thenzl@redhat.com, jbottomley@parallels.com,
	dan.carpenter@oracle.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1.1 1/1]  arcmsr: Notify has sense data report
Date: Fri, 28 Nov 2014 11:14:53 +0100	[thread overview]
Message-ID: <54784B1D.6030308@suse.de> (raw)
In-Reply-To: <1417169252.25477.11.camel@Centos6.3-64>

On 11/28/2014 11:07 AM, Ching Huang wrote:
> From: Ching Huang <ching2048@areca.com.tw>
> 
> Setting command status with 'DRIVER_SENSE' except 'CHECK_CONDITION' if we have sense data.
> 
> Signed-off-by: Ching Huang <ching2048@areca.com.tw>
> ---
> 
> This patch is relative to http://git.infradead.org/users/hch/scsi-queue.git/tree/refs/heads/drivers-for-3.18:/drivers/scsi/arcmsr
> 
> 
> diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
> --- a/drivers/scsi/arcmsr/arcmsr.h	2014-09-19 11:04:41.845100000 +0800
> +++ b/drivers/scsi/arcmsr/arcmsr.h	2014-11-28 10:54:30.000000000 +0800
> @@ -52,7 +52,7 @@ struct device_attribute;
>  	#define ARCMSR_MAX_FREECCB_NUM	320
>  #define ARCMSR_MAX_OUTSTANDING_CMD	255
>  #endif
> -#define ARCMSR_DRIVER_VERSION		"v1.30.00.04-20140919"
> +#define ARCMSR_DRIVER_VERSION		"v1.30.00.05-20141128"
>  #define ARCMSR_SCSI_INITIATOR_ID						255
>  #define ARCMSR_MAX_XFER_SECTORS							512
>  #define ARCMSR_MAX_XFER_SECTORS_B						4096
> diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c	2014-09-19 11:01:26.990090000 +0800
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c	2014-11-28 17:51:04.000000000 +0800
> @@ -989,16 +989,15 @@ static void arcmsr_report_sense_info(str
>  
>  	struct scsi_cmnd *pcmd = ccb->pcmd;
>  	struct SENSE_DATA *sensebuffer = (struct SENSE_DATA *)pcmd->sense_buffer;
> -	pcmd->result = DID_OK << 16;
> -	if (sensebuffer) {
> -		int sense_data_length =
> +
> +	pcmd->result = (DRIVER_SENSE << 24) | (DID_OK << 16) | (CHECK_CONDITION << 1);
> +	int sense_data_length =
>  			sizeof(struct SENSE_DATA) < SCSI_SENSE_BUFFERSIZE
>  			? sizeof(struct SENSE_DATA) : SCSI_SENSE_BUFFERSIZE;
> -		memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
> -		memcpy(sensebuffer, ccb->arcmsr_cdb.SenseData, sense_data_length);
> -		sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
> -		sensebuffer->Valid = 1;
> -	}
> +	memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
> +	memcpy(sensebuffer, ccb->arcmsr_cdb.SenseData, sense_data_length);
> +	sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
> +	sensebuffer->Valid = 1;
>  }
>  
>  static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
> 
> 
Hmm. Sorry to be picky, but:

Is there a chance the _no_ sense data will be provided?
If so we'd end up starting the error handler, calling REQUEST SENSE
(which will fail, too), and finally offlining the device.
I'd rather provide a default sense code for these cases.

Plus please use SAM_STAT_CHECK_CONDITION instead of
CHECK_CONDITION << 1.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)

  reply	other threads:[~2014-11-28 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28 10:07 [PATCH 1.1 1/1] arcmsr: Notify has sense data report Ching Huang
2014-11-28 10:14 ` Hannes Reinecke [this message]
2014-11-28 10:29   ` 黃清隆

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=54784B1D.6030308@suse.de \
    --to=hare@suse.de \
    --cc=ching2048@areca.com.tw \
    --cc=dan.carpenter@oracle.com \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=thenzl@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox