On 02/17/2017 01:38 PM, Christoph Hellwig wrote:
> On Fri, Feb 17, 2017 at 09:23:10AM +0100, Hannes Reinecke wrote:
>> The mpt3sas driver requires a reserved command space to handle
>> SCSI passthrough commands.
>>
>> Signed-off-by: Hannes Reinecke <[email protected]>
>> ---
>>  drivers/scsi/mpt3sas/mpt3sas_base.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
>> b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> index e9470a3..97189ad 100644
>> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
>> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
>> @@ -2360,6 +2360,8 @@ struct scsiio_tracker *
>>      } else {
>>              u32 unique_tag = blk_mq_unique_tag(scmd->request);
>>              u16 tag = blk_mq_unique_tag_to_tag(unique_tag);
>> +
>> +            WARN_ON(tag < ioc->shost->reserved_cmds);
>>              request = scsi_cmd_priv(scmd);
>>              smid = tag + 1;
>>      }
>> @@ -3521,7 +3523,8 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
>>      /* set the scsi host can_queue depth
>>       * with some internal commands that could be outstanding
>>       */
>> -    ioc->shost->can_queue = ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT;
>> +    ioc->shost->reserved_cmds = INTERNAL_SCSIIO_CMDS_COUNT;
>> +    ioc->shost->can_queue = ioc->scsiio_depth - ioc->shost->reserved_cmds;
> 
> You're never allocating a reserved request.  Just remove the number of
> reserved cmds from can_queue and you can use them on your own.
> 
> So I don't think you'll actually need to use reserved request here,
> but instead you should set up can_queue properly earlier in the series.
> 
Well, once I'm switching over to embedded commands I'll have to
integrate with SCSI midlayer to actually _allocate_ the tracker
structure for me.
At the same time the midlayer should _not_ use that structure for normal
I/O; which sounds suspiciously like reserved commands to me ...
Oh well; guess I'll have to do it, then.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                            zSeries & Storage
[email protected]                                  +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

Reply via email to