[PATCH] nvme: authentication error are always non-retryable

Hannes Reinecke hare at suse.de
Sun Feb 25 23:49:50 PST 2024


On 2/26/24 08:44, Hannes Reinecke wrote:
> On 2/23/24 14:29, Daniel Wagner wrote:
>> On Fri, Feb 23, 2024 at 11:58:04AM +0100, hare at kernel.org wrote:
>>> From: Hannes Reinecke <hare at suse.de>
>>>
>>> Any authentication errors which are generated internally are always
>>> non-retryable, so set the DNR bit to ensure they are not retried.
>>
>> This still keeps nvme-fc in the retry loop. It fails with -126 which is
>> -ENOKEY:
>>
>> [ 2267.185691] nvme nvme0: qid 0: no key
>> [ 2267.187596] nvme nvme0: qid 0: authentication setup failed
>> [ 2267.188866] nvme nvme0: NVME-FC{0}: create_assoc failed, assoc_id 
>> 2a3022dff0fe0000 ret -126
>>
> Aw. Bugger.
> Of course we do retry, as negative transport errors are considered 
> retryable. Curiously enough, negative _NVMe_ errors are considered 
> non-retryable. Hmph. We may want to work on that.
> 
So we'll need this one on top:

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 2b66fa5cd43f..2b1bac54010c 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -475,13 +475,15 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
                 if (ret) {
                         dev_warn(ctrl->device,
                                  "qid 0: authentication setup failed\n");
+                       ret = NVME_SC_AUTH_REQUIRED | NVME_SC_DNR;
                         goto out_free_data;
                 }
                 ret = nvme_auth_wait(ctrl, 0);
-               if (ret)
+               if (ret) {
                         dev_warn(ctrl->device,
                                  "qid 0: authentication failed\n");
-               else
+                       ret = NVME_SC_AUTH_REQUIRED | NVME_SC_DNR;
+               } else
                         dev_info(ctrl->device,
                                  "qid 0: authenticated\n");
         }

I'll send a proper patch.

Cheers,

Hannes




More information about the Linux-nvme mailing list