1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2019 Intel Corporation 4# All rights reserved. 5# 6testdir=$(readlink -f $(dirname $0)) 7rootdir=$(readlink -f $testdir/../../..) 8source $rootdir/test/common/autotest_common.sh 9source $rootdir/test/nvmf/common.sh 10 11MALLOC_BDEV_SIZE=64 12MALLOC_BLOCK_SIZE=512 13 14nvmftestinit 15nvmfappstart -m 0xF 16 17trap 'process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT 18 19$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0 20 21# We cannot configure the bdev with an incredibly high latency up front because connect will not work properly. 22$rpc_py bdev_delay_create -b Malloc0 -d Delay0 -r 30 -t 30 -w 30 -n 30 23 24$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 25$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s $NVMF_SERIAL 26$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Delay0 27$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT 28 29$NVME_CONNECT "${NVME_HOST[@]}" -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" 30 31waitforserial "$NVMF_SERIAL" 32 33# Once our timed out I/O complete, we will still have 10 sec of I/O. 34$rootdir/scripts/fio-wrapper -p nvmf -i 4096 -d 1 -t write -r 60 -v & 35fio_pid=$! 36 37sleep 3 38 39# The kernel initiator has a default timeout of 30 seconds. delay for 31 to trigger initiator reconnect. 40$rpc_py bdev_delay_update_latency Delay0 avg_read 31000000 41$rpc_py bdev_delay_update_latency Delay0 avg_write 31000000 42$rpc_py bdev_delay_update_latency Delay0 p99_read 31000000 43$rpc_py bdev_delay_update_latency Delay0 p99_write 310000000 44 45sleep 3 46 47# Reset these values so that subsequent I/O will complete in a timely manner. 48$rpc_py bdev_delay_update_latency Delay0 avg_read 30 49$rpc_py bdev_delay_update_latency Delay0 avg_write 30 50$rpc_py bdev_delay_update_latency Delay0 p99_read 30 51$rpc_py bdev_delay_update_latency Delay0 p99_write 30 52 53fio_status=0 54wait $fio_pid || fio_status=$? 55 56nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" 57waitforserial_disconnect "$NVMF_SERIAL" 58 59if [ $fio_status -eq 0 ]; then 60 echo "nvmf hotplug test: fio successful as expected" 61else 62 echo "nvmf hotplug test: fio failed, expected success" 63 nvmftestfini 64 exit 1 65fi 66 67$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1 68 69rm -f ./local-job0-0-verify.state 70 71trap - SIGINT SIGTERM EXIT 72 73nvmftestfini 74