From 619ab1a70065d4589594d8869739b973309c3d65 Mon Sep 17 00:00:00 2001 From: GangCao Date: Thu, 15 Jun 2017 02:02:54 -0400 Subject: [PATCH] nvme: no need to send abort notification for died application Change-Id: I7005159b2c4cc71c249cfdc4adbf8500f006fb1c Signed-off-by: GangCao Reviewed-on: https://review.gerrithub.io/365646 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/nvme/nvme_ctrlr.c | 3 +++ lib/nvme/nvme_internal.h | 6 ++++++ lib/nvme/nvme_pcie.c | 10 ++++++---- lib/nvme/nvme_qpair.c | 1 + test/lib/nvme/nvme.sh | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 618aa7430..14faed869 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -986,6 +986,9 @@ nvme_ctrlr_cleanup_process(struct spdk_nvme_ctrlr_process *proc) * qpairs to be deleted. */ qpair->in_completion_context = 0; + + qpair->no_deletion_notification_needed = 1; + spdk_nvme_ctrlr_free_io_qpair(qpair); } diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index a42e613fd..f0ccd9391 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -262,6 +262,12 @@ struct spdk_nvme_qpair { uint8_t in_completion_context : 1; uint8_t delete_after_completion_context: 1; + /* + * Set when no deletion notification is needed. For example, the process + * which allocated this qpair exited unexpectedly. + */ + uint8_t no_deletion_notification_needed: 1; + struct spdk_nvme_ctrlr *ctrlr; /* List entry for spdk_nvme_ctrlr::active_io_qpairs */ diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index c696f6287..a83754ee5 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -1474,11 +1474,13 @@ nvme_pcie_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ return -1; } - /* Complete any I/O in the completion queue */ - nvme_pcie_qpair_process_completions(qpair, 0); + if (qpair->no_deletion_notification_needed == 0) { + /* Complete any I/O in the completion queue */ + nvme_pcie_qpair_process_completions(qpair, 0); - /* Abort the rest of the I/O */ - nvme_pcie_qpair_abort_trackers(qpair, 1); + /* Abort the rest of the I/O */ + nvme_pcie_qpair_abort_trackers(qpair, 1); + } /* Delete the completion queue */ status.done = false; diff --git a/lib/nvme/nvme_qpair.c b/lib/nvme/nvme_qpair.c index ffd119e8f..40274f884 100644 --- a/lib/nvme/nvme_qpair.c +++ b/lib/nvme/nvme_qpair.c @@ -392,6 +392,7 @@ nvme_qpair_init(struct spdk_nvme_qpair *qpair, uint16_t id, qpair->in_completion_context = 0; qpair->delete_after_completion_context = 0; + qpair->no_deletion_notification_needed = 0; qpair->ctrlr = ctrlr; qpair->trtype = ctrlr->trid.trtype; diff --git a/test/lib/nvme/nvme.sh b/test/lib/nvme/nvme.sh index 831f578ae..a52905f99 100755 --- a/test/lib/nvme/nvme.sh +++ b/test/lib/nvme/nvme.sh @@ -88,7 +88,7 @@ if [ $(uname -s) = Linux ] && [ $SPDK_TEST_NVME_MULTIPROCESS -eq 1 ]; then kill -9 $! count=0 while [ $count -le 2 ]; do - $rootdir/examples/nvme/perf/perf -i 0 -q 1 -w read -s 4096 -t 1 -c 0xf0 + $rootdir/examples/nvme/perf/perf -i 0 -q 1 -w read -s 4096 -t 1 -c 0xf count=$(($count + 1)) done count=0