Re: [PATCH 10/18] scsi: implement reserved command handling

Bart Van Assche
2021-05-05T00:47:45Z

On 5/3/21 8:03 AM, Hannes Reinecke wrote:
> struct scsi_cmnd *scsi_get_internal_cmd(struct scsi_device *sdev,
> unsigned int op, blk_mq_req_flags_t flags)
> @@ -2005,6 +2009,10 @@ struct scsi_cmnd *scsi_get_internal_cmd(struct scsi_device *sdev,
>
> WARN_ON_ONCE(((op & REQ_OP_MASK) != REQ_OP_SCSI_IN) &&
> ((op & REQ_OP_MASK) != REQ_OP_SCSI_OUT));
> +
> + if (sdev->host->nr_reserved_cmds)
> + flags |= BLK_MQ_REQ_RESERVED;
> +
> rq = blk_mq_alloc_request(sdev->request_queue, op, flags);
> if (IS_ERR(rq))
> return NULL;

Can the if-statement be removed such that scsi_get_internal_cmd() fails
if sdev->host->nr_reserved_cmds == 0? I'm concerned that otherwise it
will be very hard to determine which requests are internal and which
ones not from inside a blk_mq_tagset_busy_iter() callback.

Thanks,

Bart.