Commit dbecab8d authored by Changpeng Liu's avatar Changpeng Liu Committed by Konrad Sztyber
Browse files

nvme/pcie: make `nvme_pcie_ctrlr_delete_io_qpair` call trace multi-process safe



When a secondary process exit without deleting allocated IO
queue pair, then a new secondary process will do cleanup for
previous allocated queue pair, then segment fault will happen
due to `stat` inside IO queue pair data strucutre can't be
accessed in this cleanup process.

Fix issue #2565.

Change-Id: I01a037642683901941b5268ac20d17b78b6c6350
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13537


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent ee8167e3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1018,7 +1018,7 @@ nvme_pcie_qpair_destroy(struct spdk_nvme_qpair *qpair)

	nvme_qpair_deinit(qpair);

	if (!pqpair->shared_stats) {
	if (!pqpair->shared_stats && (qpair->active_proc == nvme_ctrlr_get_current_process(qpair->ctrlr))) {
		if (qpair->id) {
			free(pqpair->stat);
		} else {
@@ -1125,7 +1125,9 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_
	/* Now that the submission queue is deleted, the device is supposed to have
	 * completed any outstanding I/O. Try to complete them. If they don't complete,
	 * they'll be marked as aborted and completed below. */
	if (qpair->active_proc == nvme_ctrlr_get_current_process(ctrlr)) {
		nvme_pcie_qpair_process_completions(qpair, 0);
	}

	memset(status, 0, sizeof(*status));
	/* Delete the completion queue */