From 242201d2c9bfda2e8fd40ef173d880a5bfc89790 Mon Sep 17 00:00:00 2001 From: Maciej Szwed Date: Tue, 21 Aug 2018 10:02:26 +0200 Subject: [PATCH] nvmf: update the IBV state only for QP related events qp_context is only available for QP related events. For other events we should not update ibv state as we try to access null object data field. Signed-off-by: Maciej Szwed Change-Id: Id8d2fee090d9a40c7e00c866914c2eb164e7587c Reviewed-on: https://review.gerrithub.io/422941 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/nvmf/rdma.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index cc8b77cf64..905fece5de 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -2107,15 +2107,15 @@ spdk_nvmf_process_ib_event(struct spdk_nvmf_rdma_device *device) rqpair = event.element.qp->qp_context; - /* This call is thread-safe. Immediately update the IBV state on error notification. */ - spdk_nvmf_rdma_update_ibv_state(rqpair); - switch (event.event_type) { case IBV_EVENT_QP_FATAL: case IBV_EVENT_QP_LAST_WQE_REACHED: + /* This call is thread-safe. Immediately update the IBV state on error notification. */ + spdk_nvmf_rdma_update_ibv_state(rqpair); + spdk_thread_send_msg(rqpair->qpair.group->thread, _spdk_nvmf_rdma_qp_error, rqpair); break; - case IBV_EVENT_SQ_DRAINED: { + case IBV_EVENT_SQ_DRAINED: /* This event occurs frequently in both error and non-error states. * Check if the qpair is in an error state before sending a message. * Note that we're not on the correct thread to access the qpair, but @@ -2126,14 +2126,14 @@ spdk_nvmf_process_ib_event(struct spdk_nvmf_rdma_device *device) spdk_thread_send_msg(rqpair->qpair.group->thread, _spdk_nvmf_rdma_qp_error, rqpair); } break; - - } - case IBV_EVENT_CQ_ERR: case IBV_EVENT_QP_REQ_ERR: case IBV_EVENT_QP_ACCESS_ERR: case IBV_EVENT_COMM_EST: case IBV_EVENT_PATH_MIG: case IBV_EVENT_PATH_MIG_ERR: + spdk_nvmf_rdma_update_ibv_state(rqpair); + break; + case IBV_EVENT_CQ_ERR: case IBV_EVENT_DEVICE_FATAL: case IBV_EVENT_PORT_ACTIVE: case IBV_EVENT_PORT_ERR: