Skip to content

Commit 48dae46

Browse files
hreineckekeithbusch
authored andcommitted
nvme: enable retries for authentication commands
Authentication commands might trigger a lengthy computation on the controller or even a callout to an external entity. In these cases the controller might return a status without the DNR bit set, indicating that the command should be retried. This patch enables retries for authentication commands by setting NVME_SUBMIT_RETRY for __nvme_submit_sync_cmd(). Reported-by: Martin George <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent bd2687f commit 48dae46

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

drivers/nvme/host/auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid,
5858
void *data, size_t data_len, bool auth_send)
5959
{
6060
struct nvme_command cmd = {};
61-
nvme_submit_flags_t flags = 0;
61+
nvme_submit_flags_t flags = NVME_SUBMIT_RETRY;
6262
struct request_queue *q = ctrl->fabrics_q;
6363
int ret;
6464

drivers/nvme/host/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,8 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
10701070
if (IS_ERR(req))
10711071
return PTR_ERR(req);
10721072
nvme_init_request(req, cmd);
1073+
if (flags & NVME_SUBMIT_RETRY)
1074+
req->cmd_flags &= ~REQ_FAILFAST_DRIVER;
10731075

10741076
if (buffer && bufflen) {
10751077
ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL);

drivers/nvme/host/nvme.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,8 @@ enum {
849849
NVME_SUBMIT_NOWAIT = (__force nvme_submit_flags_t)(1 << 1),
850850
/* Set BLK_MQ_REQ_RESERVED when allocating request */
851851
NVME_SUBMIT_RESERVED = (__force nvme_submit_flags_t)(1 << 2),
852+
/* Retry command when NVME_SC_DNR is not set in the result */
853+
NVME_SUBMIT_RETRY = (__force nvme_submit_flags_t)(1 << 3),
852854
};
853855

854856
int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,

0 commit comments

Comments
 (0)