Commit effea17d authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: make invalid rdma_req case into an assert



The wr_id should never be NULL - it will always correspond to a request
we previously posted.  Convert the check to an assert() so we notice if
this ever happens (which would indicate a programming error somewhere
else).

While we're here, add a more robust check to make sure the request is
actually in the correct array of requests for the connection being
polled (also in an assert, since this should never fail in normal
execution).

Change-Id: I855763d7d827fb8cf00a775c7bc2ccb579db8d0f
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 4945edb4
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1427,12 +1427,9 @@ spdk_nvmf_rdma_poll(struct spdk_nvmf_conn *conn)
		}

		rdma_req = (struct spdk_nvmf_rdma_request *)wc[i].wr_id;
		if (rdma_req == NULL) {
			SPDK_ERRLOG("NULL wr_id in RDMA work completion\n");
			error = true;
			continue;
		}

		assert(rdma_req != NULL);
		assert(rdma_req - rdma_conn->reqs >= 0);
		assert(rdma_req - rdma_conn->reqs < (ptrdiff_t)rdma_conn->max_queue_depth);
		req = &rdma_req->req;

		switch (wc[i].opcode) {