Re: [PATCH 03/22] scsi: add scsi_{get,put}_internal_cmd() helper

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

 



On 2020-06-28 23:32, Hannes Reinecke wrote:
> On 6/28/20 5:08 PM, Bart Van Assche wrote:
>> On 2020-06-28 02:02, Hannes Reinecke wrote:
>>> On 6/28/20 5:48 AM, Bart Van Assche wrote:
>>>> On 2020-06-25 07:01, Hannes Reinecke wrote:
>>>>> +/**
>>>>> + * scsi_put_internal_cmd - free an internal SCSI command
>>>>> + * @scmd: SCSI command to be freed
>>>>> + */
>>>>> +void scsi_put_internal_cmd(struct scsi_cmnd *scmd)
>>>>> +{
>>>>> +    struct request *rq = blk_mq_rq_from_pdu(scmd);
>>>>> +
>>>>> +    if (blk_rq_is_internal(rq))
>>>>> +        blk_mq_free_request(rq);
>>>>> +}
>>>>> +EXPORT_SYMBOL_GPL(scsi_put_internal_cmd);
>>>>
>>>> How about triggering a warning for the !blk_rq_is_internal(rq) case
>>>> instead of silently ignoring regular SCSI commands?
>>>>
>>> That's by design.
>>> Some drivers have a common routine for freeing up commands, so it'd be
>>> quite tricky to separate these two cases out at the driver level.
>>> So it's far easier to call the common routine for all commands, and
>>> let this function do the right thing for all commands.
>>
>> That sounds fair to me, but is an example available in this patch series
>> of a call to scsi_put_internal_cmd() from such a common routine? It
>> seems to me that all calls to scsi_put_internal_cmd() introduced in this
>> patch series happen from code paths that handle internal commands only?
>>
> aacraid.
> The function aac_fib_free() is called unconditionally for every fib, and
> doesn't have the means to differentiate between 'normal' and 'internal'
> commands.

Please make scsi_put_internal_cmd() complain if it is invoked for
anything else than an internal command and surround the
scsi_put_internal_cmd() call in aacraid with if (blk_rq_is_internal(rq))
{ ... }.

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux