nvme: Don't pass admin qpair through timeout callback
Instead, pass NULL when an ADMIN command times out. We don't expose the admin queue to the user. Change-Id: If0768d329a689f6f7c3734c9d419e680d7378ed1 Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
b9feeb03c1
commit
ee460db71f
@ -421,6 +421,8 @@ struct spdk_nvme_qpair;
|
|||||||
/**
|
/**
|
||||||
* Signature for the callback function invoked when a timeout is
|
* Signature for the callback function invoked when a timeout is
|
||||||
* detected on a request.
|
* detected on a request.
|
||||||
|
* For timeouts detected on the admin queue pair, the qpair returned
|
||||||
|
* here will be NULL.
|
||||||
*/
|
*/
|
||||||
typedef void (*spdk_nvme_timeout_cb)(void *cb_arg,
|
typedef void (*spdk_nvme_timeout_cb)(void *cb_arg,
|
||||||
struct spdk_nvme_ctrlr *ctrlr,
|
struct spdk_nvme_ctrlr *ctrlr,
|
||||||
@ -592,6 +594,7 @@ int spdk_nvme_ctrlr_cmd_get_log_page(struct spdk_nvme_ctrlr *ctrlr,
|
|||||||
*
|
*
|
||||||
* \param ctrlr NVMe controller to which the command was submitted.
|
* \param ctrlr NVMe controller to which the command was submitted.
|
||||||
* \param qpair NVMe queue pair to which the command was submitted.
|
* \param qpair NVMe queue pair to which the command was submitted.
|
||||||
|
* For admin commands, pass NULL for the qpair.
|
||||||
* \param cid Command ID of the command to abort.
|
* \param cid Command ID of the command to abort.
|
||||||
* \param cb_fn Callback function to invoke when the abort has completed.
|
* \param cb_fn Callback function to invoke when the abort has completed.
|
||||||
* \param cb_arg Argument to pass to the callback function.\
|
* \param cb_arg Argument to pass to the callback function.\
|
||||||
|
@ -399,7 +399,13 @@ spdk_nvme_ctrlr_cmd_abort(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair
|
|||||||
int rc;
|
int rc;
|
||||||
struct nvme_request *req;
|
struct nvme_request *req;
|
||||||
struct spdk_nvme_cmd *cmd;
|
struct spdk_nvme_cmd *cmd;
|
||||||
uint16_t sqid = qpair->id;
|
uint16_t sqid;
|
||||||
|
|
||||||
|
if (qpair) {
|
||||||
|
sqid = qpair->id;
|
||||||
|
} else {
|
||||||
|
sqid = ctrlr->adminq->id; /* 0 */
|
||||||
|
}
|
||||||
|
|
||||||
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
|
nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);
|
||||||
req = nvme_allocate_request_null(cb_fn, cb_arg);
|
req = nvme_allocate_request_null(cb_fn, cb_arg);
|
||||||
|
@ -1823,13 +1823,21 @@ nvme_pcie_qpair_check_timeout(struct spdk_nvme_qpair *qpair)
|
|||||||
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
|
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
|
||||||
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
|
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
|
||||||
|
|
||||||
|
/* We don't want to expose the admin queue to the user,
|
||||||
|
* so when we're timing out admin commands set the
|
||||||
|
* qpair to NULL.
|
||||||
|
*/
|
||||||
|
if (qpair == ctrlr->adminq) {
|
||||||
|
qpair = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
t02 = spdk_get_ticks();
|
t02 = spdk_get_ticks();
|
||||||
TAILQ_FOREACH_SAFE(tr, &pqpair->outstanding_tr, tq_list, tmp) {
|
TAILQ_FOREACH_SAFE(tr, &pqpair->outstanding_tr, tq_list, tmp) {
|
||||||
if (tr->timed_out) {
|
if (tr->timed_out) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qpair == ctrlr->adminq &&
|
if (qpair == NULL &&
|
||||||
tr->req->cmd.opc == SPDK_NVME_OPC_ASYNC_EVENT_REQUEST) {
|
tr->req->cmd.opc == SPDK_NVME_OPC_ASYNC_EVENT_REQUEST) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user