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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-02-22 15:06:31 -07:00
parent 4945edb449
commit effea17dad

View File

@ -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) {