Commit 5e156a6e authored by Jim Harris's avatar Jim Harris
Browse files

nvmf/rdma: fix last_wqe_reached ctx handling



nvmf_rdma_handle_last_wqe_reached() may have freed the qpair, so we
can't set the qpair's ctx to NULL after it returns, we need to do it
before.

We also need to set the qpair's ctx pointer to NULL in the
clean_ibv_events() function.

Setting the ctx pointer to NULL is now done in the exact places that
the STAILQ_REMOVE was done before the recent refactoring.

Fixes: 43f6d338 ("nvmf: remove use of STAILQ for last_wqe events")
Fixes issue #3541.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Ia1acfcc18b1d499174065d869d24d2be91ae1557
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25065


Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent d844e2ec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -840,6 +840,7 @@ nvmf_rdma_qpair_clean_ibv_events(struct spdk_nvmf_rdma_qpair *rqpair)
	if (ctx) {
		ctx->rqpair = NULL;
		/* Memory allocated for ctx is freed in nvmf_rdma_qpair_process_last_wqe_event */
		rqpair->last_wqe_reached_ctx = NULL;
	}
}

@@ -3748,8 +3749,8 @@ nvmf_rdma_qpair_process_last_wqe_event(void *ctx)

	if (rqpair) {
		assert(event_ctx == rqpair->last_wqe_reached_ctx);
		nvmf_rdma_handle_last_wqe_reached(rqpair);
		rqpair->last_wqe_reached_ctx = NULL;
		nvmf_rdma_handle_last_wqe_reached(rqpair);
	}
	free(event_ctx);
}