diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 23f4d69b0..5711e7b2d 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -830,7 +830,7 @@ nvme_pcie_ctrlr_free_bars(struct nvme_pcie_ctrlr *pctrlr) return -1; } - if (addr) { + if (addr && spdk_process_is_primary()) { /* NOTE: addr may have been remapped here. We're relying on DPDK to call * munmap internally. */ diff --git a/test/nvme/nvme.sh b/test/nvme/nvme.sh index 13dfe2b06..7ba4a7703 100755 --- a/test/nvme/nvme.sh +++ b/test/nvme/nvme.sh @@ -42,13 +42,23 @@ function nvme_fio_test() { } function nvme_multi_secondary() { - $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 & + # Primary process exits last + $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 5 -c 0x1 & pid0=$! $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x2 & pid1=$! $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x4 wait $pid0 wait $pid1 + + # Secondary process exits last + $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 & + pid0=$! + $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x2 & + pid1=$! + $SPDK_EXAMPLE_DIR/perf -i 0 -q 16 -w read -o 4096 -t 5 -c 0x4 + wait $pid0 + wait $pid1 } if [ $(uname) = Linux ]; then