[PATCH 14/16] nvme-auth: have dhchap_auth_work wait for queues auth to complete

Hannes Reinecke hare at suse.de
Tue Nov 8 23:44:04 PST 2022


On 11/9/22 04:44, Sagi Grimberg wrote:
> It triggered the queue authentication work elements in parallel, but
> the ctrl authentication work itself completes when all of them
> completes. Hence wait for queues auth completions.
> 
> This also makes nvme_auth_stop simply a sync cancel of ctrl
> dhchap_auth_work.
> 
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
>   drivers/nvme/host/auth.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
> index 0159179c2455..e88d6254f2f5 100644
> --- a/drivers/nvme/host/auth.c
> +++ b/drivers/nvme/host/auth.c
> @@ -924,6 +924,12 @@ static void nvme_dhchap_auth_work(struct work_struct *work)
>   	 * Failure is a soft-state; credentials remain valid until
>   	 * the controller terminates the connection.
>   	 */
> +	for (q = 1; q < ctrl->queue_count; q++) {
> +		ret = nvme_auth_wait(ctrl, q);
> +		if (ret)
> +			dev_warn(ctrl->device,
> +				 "qid %d: authentication failed\n", q);
> +	}
>   }
>   
Don't we need to clear the dhchap context here?

>   int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl)
> @@ -974,12 +980,7 @@ EXPORT_SYMBOL_GPL(nvme_auth_init_ctrl);
>   
>   void nvme_auth_stop(struct nvme_ctrl *ctrl)
>   {
> -	struct nvme_dhchap_queue_context *chap;
> -	int i;
> -
>   	cancel_work_sync(&ctrl->dhchap_auth_work);
> -	nvme_foreach_dhchap(i, chap, ctrl)
> -		cancel_work_sync(&chap->auth_work);
>   }
>   EXPORT_SYMBOL_GPL(nvme_auth_stop);
>   
Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman




More information about the Linux-nvme mailing list