[PATCH] nvme-fabrics: allow to queue requests for live queues

Sagi Grimberg sagi at grimberg.me
Tue Jul 28 02:49:52 EDT 2020


>> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
>> index 4ec4829d6233..2e7838f42e36 100644
>> --- a/drivers/nvme/host/fabrics.c
>> +++ b/drivers/nvme/host/fabrics.c
>> @@ -564,21 +564,13 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, 
>> struct request *rq,
>>   {
>>       struct nvme_request *req = nvme_req(rq);
>> -    /*
>> -     * If we are in some state of setup or teardown only allow
>> -     * internally generated commands.
>> -     */
>> -    if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD))
> "if (!blk_rq_is_passthrough(rq))" should not delete. Because if we delete,
> the normal io will be send to target, the target can not treat the io
> if the queue is not NVME_CTRL_LIVE.

Sure it does, the only reason for us to deny this I/O, is if the queue
is not live. The controller state should only _advise_ us if we need to
look at the queue state.

>> -        return false;
>> -
>>       /*
>>        * Only allow commands on a live queue, except for the connect 
>> command,
>>        * which is require to set the queue live in the appropinquate 
>> states.
>>        */
>>       switch (ctrl->state) {
>> -    case NVME_CTRL_NEW:
>>       case NVME_CTRL_CONNECTING:
>> -        if (nvme_is_fabrics(req->cmd) &&
>> +        if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
> If nvme_is_fabrics(req->cmd) is true, blk_rq_is_passthrough(rq) must
> be ture. why need add check blk_rq_is_passthrough(rq)?

req->cmd is only valid for passthru commands, hence we need to check for
that before we reference req->cmd.



More information about the Linux-nvme mailing list