From 5a178b831a9fe8c51e406355f0164d01627cf1f4 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 13 May 2024 14:53:48 -0600 Subject: [PATCH] nvme: Add locking asserts nvme_qpair_complete_tracker and nvme_qpair_manual_complete_tracker have to be called without the qpair lock, so assert its unowned. Sponsored by: Netflix --- sys/dev/nvme/nvme_qpair.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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);