From a3cb1debb07847b375626b971bbae3e0c3bc0166 Mon Sep 17 00:00:00 2001 From: Marcin Dziegielewski Date: Thu, 22 Aug 2019 17:55:46 +0200 Subject: [PATCH] test/ocf: change backend device in persistent-metadata test This patch is related to issue #815. To avoid hung and re-enable testing this part of ocf, this patch changes backed device from aio to nvme. Hung in this test was caused by implementation of AIO bdev and bdev layer. All AIO bdevs are using the same shared context with limited queue depth, so in some cases AIO can return NOMEM status. It's ok when we have more than one IO from bdev layer perspective, if not we will stuck because nothing will triger retry io procedure. This patch only enables testing and are not fixing root cause of hung. To prevent before unexpected behavior of this and next one test we need to clear ocf metadata on nvme device. This patch also reenables this test in CI. Signed-off-by: Marcin Dziegielewski Change-Id: Ibab4aefb9aaf33d725db20345bd5c09c1e5eebdd Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463605 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Broadcom SPDK FC-NVMe CI Reviewed-by: Vitaliy Mysak --- test/ocf/management/persistent-metadata.sh | 61 +++++++++++++--------- test/ocf/ocf.sh | 3 +- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/test/ocf/management/persistent-metadata.sh b/test/ocf/management/persistent-metadata.sh index ea8c7c1b7..ea41974b9 100755 --- a/test/ocf/management/persistent-metadata.sh +++ b/test/ocf/management/persistent-metadata.sh @@ -2,29 +2,40 @@ curdir=$(dirname $(readlink -f "$BASH_SOURCE")) rootdir=$(readlink -f $curdir/../../..) +source $rootdir/scripts/common.sh source $rootdir/test/common/autotest_common.sh +function clear_nvme() +{ + # Clear metadata on NVMe device + $rootdir/scripts/setup.sh reset + sleep 1 + name=$(get_nvme_name_from_bdf $1) + mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w) + if [ "$mountpoints" != "0" ]; then + $rootdir/scripts/setup.sh + exit 1 + fi + dd if=/dev/zero of=/dev/$name bs=1M count=1000 oflag=direct + $rootdir/scripts/setup.sh +} + rpc_py=$rootdir/scripts/rpc.py -rm -f aio* -truncate -s 128M aio0 -truncate -s 128M aio1 -truncate -s 128M aio2 -truncate -s 128M aio3 -truncate -s 128M aio4 -truncate -s 128M aio5 -truncate -s 128M aio6 +nvme_cfg=$($rootdir/scripts/gen_nvme.sh) -echo " -[AIO] - AIO ./aio0 aio0 512 - AIO ./aio1 aio1 512 - AIO ./aio2 aio2 512 - AIO ./aio3 aio3 512 - AIO ./aio4 aio4 512 - AIO ./aio5 aio5 512 - AIO ./aio6 aio6 512 -" > $curdir/config +config=" +$nvme_cfg + +[Split] + Split Nvme0n1 7 128 +" +echo "$config" > $curdir/config + +# Clear only nvme device which we will use in test +bdf=$($rootdir/scripts/gen_nvme.sh --json | jq '.config[0].params.traddr' | sed s/\"//g) + +clear_nvme $bdf $rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config & spdk_pid=$! @@ -33,10 +44,10 @@ waitforlisten $spdk_pid # Create ocf on persistent storage -$rpc_py construct_ocf_bdev ocfWT wt aio0 aio1 -$rpc_py construct_ocf_bdev ocfPT pt aio2 aio3 -$rpc_py construct_ocf_bdev ocfWB0 wb aio4 aio5 -$rpc_py construct_ocf_bdev ocfWB1 wb aio4 aio6 +$rpc_py construct_ocf_bdev ocfWT wt Nvme0n1p0 Nvme0n1p1 +$rpc_py construct_ocf_bdev ocfPT pt Nvme0n1p2 Nvme0n1p3 +$rpc_py construct_ocf_bdev ocfWB0 wb Nvme0n1p4 Nvme0n1p5 +$rpc_py construct_ocf_bdev ocfWB1 wb Nvme0n1p4 Nvme0n1p6 # Sorting bdevs because we dont guarantee that they are going to be # in the same order after shutdown @@ -50,7 +61,7 @@ killprocess $spdk_pid $rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config & spdk_pid=$! -trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT +trap 'killprocess $spdk_pid; rm -f $curdir/config ocf_bdevs ocf_bdevs_verify; exit 1' SIGINT SIGTERM EXIT waitforlisten $spdk_pid @@ -63,4 +74,6 @@ diff ocf_bdevs ocf_bdevs_verify trap - SIGINT SIGTERM EXIT killprocess $spdk_pid -rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify +rm -f $curdir/config ocf_bdevs ocf_bdevs_verify + +clear_nvme $bdf diff --git a/test/ocf/ocf.sh b/test/ocf/ocf.sh index d7716a30b..6498d1c26 100755 --- a/test/ocf/ocf.sh +++ b/test/ocf/ocf.sh @@ -18,8 +18,7 @@ suite "$testdir/integrity/fio-modes.sh" suite "$testdir/integrity/bdevperf-iotypes.sh" suite "$testdir/management/create-destruct.sh" suite "$testdir/management/multicore.sh" -# disabled due to intermittent failures. See github isssue #815 -#suite "$testdir/management/persistent-metadata.sh" +suite "$testdir/management/persistent-metadata.sh" timing_exit ocf report_test_completion "ocf"