Skip to content

Commit be50d2e

Browse files
dsavitskiytiagolobocastro
authored andcommitted
nvmf: duplicate qid retry fix
Signed-off-by: Dmitry Savitskiy <dmitry.savitskiy@datacore.com> Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
1 parent e5f7aa4 commit be50d2e

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/nvmf/ctrlr.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#define NVMF_CTRLR_RESET_SHN_TIMEOUT_IN_MS (NVMF_CC_RESET_SHN_TIMEOUT_IN_MS + 5000)
3333

34-
#define DUPLICATE_QID_RETRY_US 1000
34+
#define DUPLICATE_QID_RETRY_US 10000
3535

3636
/*
3737
* Report the SPDK version as the firmware revision.
@@ -302,15 +302,16 @@ nvmf_ctrlr_add_qpair(struct spdk_nvmf_qpair *qpair,
302302

303303
if (spdk_bit_array_get(ctrlr->qpair_mask, qpair->qid)) {
304304
if (qpair->connect_req != NULL) {
305-
SPDK_ERRLOG("Got I/O connect with duplicate QID %u\n", qpair->qid);
305+
SPDK_ERRLOG("Got I/O connect with duplicate QID %u on ctrlr %p [%s]\n",
306+
qpair->qid, ctrlr, ctrlr->hostnqn);
306307
rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
307308
rsp->status.sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
308309
qpair->connect_req = NULL;
309310
qpair->ctrlr = NULL;
310311
spdk_nvmf_request_complete(req);
311312
} else {
312-
SPDK_WARNLOG("Duplicate QID detected, re-check in %dus\n",
313-
DUPLICATE_QID_RETRY_US);
313+
SPDK_WARNLOG("Duplicate QID %u detected on ctrlr %p [%s], re-check in %dus\n",
314+
qpair->qid, ctrlr, ctrlr->hostnqn, DUPLICATE_QID_RETRY_US);
314315
qpair->connect_req = req;
315316
/* Set qpair->ctrlr here so that we'll have it when the poller expires. */
316317
nvmf_qpair_set_ctrlr(qpair, ctrlr);
@@ -320,6 +321,15 @@ nvmf_ctrlr_add_qpair(struct spdk_nvmf_qpair *qpair,
320321
return;
321322
}
322323

324+
/* Reset `connect_req` after a retry.
325+
* (Note it shares the union with `first_fused_req`).
326+
*/
327+
if (qpair->connect_req != NULL) {
328+
SPDK_WARNLOG("Added QID %u on ctrlr %p [%s] after duplicate QID retry\n",
329+
qpair->qid, ctrlr, ctrlr->hostnqn);
330+
qpair->connect_req = NULL;
331+
}
332+
323333
SPDK_DTRACE_PROBE4_TICKS(nvmf_ctrlr_add_qpair, qpair, qpair->qid, ctrlr->subsys->subnqn,
324334
ctrlr->hostnqn);
325335
nvmf_qpair_set_ctrlr(qpair, ctrlr);
@@ -4409,7 +4419,8 @@ nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
44094419
} else if (spdk_unlikely(req->qpair->first_fused_req != NULL)) {
44104420
struct spdk_nvme_cpl *fused_response = &req->qpair->first_fused_req->rsp->nvme_cpl;
44114421

4412-
SPDK_ERRLOG("Expected second of fused commands - failing first of fused commands\n");
4422+
SPDK_ERRLOG("Ctrlr %p [%s]: Expected second of fused commands - failing first of fused commands: qpair id %u\n",
4423+
req->qpair->ctrlr, req->qpair->ctrlr ? req->qpair->ctrlr->hostnqn : "<null>", req->qpair->qid);
44134424

44144425
/* abort req->qpair->first_fused_request and continue with new command */
44154426
fused_response->status.sc = SPDK_NVME_SC_ABORTED_MISSING_FUSED;

0 commit comments

Comments
 (0)