diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 62d27e439180..b11bdc44dc40 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -414,10 +414,12 @@ static void nvme_qpair_complete_tracker(struct nvme_tracker *tr, struct nvme_completion *cpl, error_print_t print_on_error) { - struct nvme_qpair * qpair = tr->qpair; + struct nvme_qpair *qpair = tr->qpair; struct nvme_request *req; bool retry, error, retriable; + mtx_assert(&qpair->lock, MA_NOTOWNED); + req = tr->req; error = nvme_completion_is_error(cpl); retriable = nvme_completion_is_retry(cpl); @@ -486,11 +488,12 @@ nvme_qpair_manual_complete_tracker( error_print_t print_on_error) { struct nvme_completion cpl; + struct nvme_qpair * qpair = tr->qpair; + + mtx_assert(&qpair->lock, MA_NOTOWNED); memset(&cpl, 0, sizeof(cpl)); - struct nvme_qpair * qpair = tr->qpair; - cpl.sqid = qpair->id; cpl.cid = tr->cid; cpl.status |= NVMEF(NVME_STATUS_SCT, sct);