bdev_nvme: check for admin queue failures.

This will allow us to reset the controller when we get disconnect events
from the underying transports.

Change-Id: I825985219f98ff65cfcf7581757bd26db5bd08ba
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473762
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Seth Howell 2019-11-08 15:22:37 -07:00 committed by Tomasz Zawadzki
parent d786a7eccf
commit a816afaaaf
2 changed files with 34 additions and 8 deletions

View File

@ -211,9 +211,19 @@ bdev_nvme_poll(void *arg)
static int
bdev_nvme_poll_adminq(void *arg)
{
int32_t rc;
struct spdk_nvme_ctrlr *ctrlr = arg;
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr;
return spdk_nvme_ctrlr_process_admin_completions(ctrlr);
rc = spdk_nvme_ctrlr_process_admin_completions(ctrlr);
if (rc < 0) {
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(spdk_nvme_ctrlr_get_transport_id(ctrlr));
assert(nvme_bdev_ctrlr != NULL);
bdev_nvme_reset(nvme_bdev_ctrlr, NULL);
}
return rc;
}
static void

View File

@ -10,21 +10,37 @@ MALLOC_BLOCK_SIZE=512
rpc_py="$rootdir/scripts/rpc.py"
function tgt_init()
{
nvmfappstart "-m 0xF"
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
}
nvmftestinit
timing_enter bdevperf
nvmfappstart "-m 0xF"
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
tgt_init
echo "[Nvme]" > $testdir/bdevperf.conf
echo " TransportID \"trtype:$TEST_TRANSPORT adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme0" >> $testdir/bdevperf.conf
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 128 -o 4096 -w verify -t 1
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 128 -o 4096 -w verify -t 15 -f &
bdevperfpid=$!
sleep 3
kill -9 $nvmfpid
sleep 3
tgt_init
wait $bdevperfpid
sync
rm -rf $testdir/bdevperf.conf
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1