[PATCH 07/12] nvme: Implement In-Band authentication

Sagi Grimberg sagi at grimberg.me
Tue Sep 14 00:06:09 PDT 2021


>>> @@ -361,11 +366,13 @@ static inline void nvme_end_req(struct request
>>> *req)
>>>      void nvme_complete_rq(struct request *req)
>>>    {
>>> +    struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
>>> +
>>>        trace_nvme_complete_rq(req);
>>>        nvme_cleanup_cmd(req);
>>>    -    if (nvme_req(req)->ctrl->kas)
>>> -        nvme_req(req)->ctrl->comp_seen = true;
>>> +    if (ctrl->kas)
>>> +        ctrl->comp_seen = true;
>>>          switch (nvme_decide_disposition(req)) {
>>>        case COMPLETE:
>>> @@ -377,6 +384,15 @@ void nvme_complete_rq(struct request *req)
>>>        case FAILOVER:
>>>            nvme_failover_req(req);
>>>            return;
>>> +    case AUTHENTICATE:
>>> +#ifdef CONFIG_NVME_AUTH
>>> +        if (nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
>>> +            queue_work(nvme_wq, &ctrl->dhchap_auth_work);
>>
>> Why is the state change here and not in nvme_dhchap_auth_work?
>>
> Because switching to 'resetting' is an easy way to synchronize with the
> admin queue.

Maybe fold this into nvme_authenticate_ctrl? in case someone adds/moves
this in the future and forgets the ctrl state serialization?



More information about the Linux-nvme mailing list