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
This commit is contained in:
Warner Losh 2024-05-13 14:53:48 -06:00
parent da4230af3f
commit 5a178b831a

View File

@ -414,10 +414,12 @@ static void
nvme_qpair_complete_tracker(struct nvme_tracker *tr, nvme_qpair_complete_tracker(struct nvme_tracker *tr,
struct nvme_completion *cpl, error_print_t print_on_error) 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; struct nvme_request *req;
bool retry, error, retriable; bool retry, error, retriable;
mtx_assert(&qpair->lock, MA_NOTOWNED);
req = tr->req; req = tr->req;
error = nvme_completion_is_error(cpl); error = nvme_completion_is_error(cpl);
retriable = nvme_completion_is_retry(cpl); retriable = nvme_completion_is_retry(cpl);
@ -486,11 +488,12 @@ nvme_qpair_manual_complete_tracker(
error_print_t print_on_error) error_print_t print_on_error)
{ {
struct nvme_completion cpl; struct nvme_completion cpl;
struct nvme_qpair * qpair = tr->qpair;
mtx_assert(&qpair->lock, MA_NOTOWNED);
memset(&cpl, 0, sizeof(cpl)); memset(&cpl, 0, sizeof(cpl));
struct nvme_qpair * qpair = tr->qpair;
cpl.sqid = qpair->id; cpl.sqid = qpair->id;
cpl.cid = tr->cid; cpl.cid = tr->cid;
cpl.status |= NVMEF(NVME_STATUS_SCT, sct); cpl.status |= NVMEF(NVME_STATUS_SCT, sct);