[PATCH blktests v2] nvme: add nvmf reset/disconnect during traffic test
Sagi Grimberg
sagi at grimberg.me
Thu Jun 30 08:44:44 PDT 2022
Test traffic controller reset and disconnect during traffic.
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
Changes from v1:
- fix copyright
- change subsys name
- fix test cleanup warnings
- don't log device names
- fix shellcheck
tests/nvme/040 | 59 ++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/040.out | 6 +++++
tests/nvme/rc | 8 +++++++
3 files changed, 73 insertions(+)
create mode 100755 tests/nvme/040
create mode 100644 tests/nvme/040.out
diff --git a/tests/nvme/040 b/tests/nvme/040
new file mode 100755
index 000000000000..d259784698d9
--- /dev/null
+++ b/tests/nvme/040
@@ -0,0 +1,59 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Sagi Grimberg <sagi at grimberg.me>
+#
+# Test nvme fabrics controller reset/disconnect/reconnect operation during I/O
+# This test is somewhat similar to test 032 but for fabrics controllers.
+
+. tests/nvme/rc
+
+DESCRIPTION="test nvme fabrics controller reset/disconnect operation during I/O"
+
+requires() {
+ _nvme_requires
+ _have_loop
+ _have_fio
+ _require_nvme_trtype_is_fabrics
+}
+
+test() {
+ local subsys="blktests-subsystem-1"
+ local port
+ local loop_dev
+ local nvmedev
+
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+ truncate -s 1G "$TMPDIR/img"
+ loop_dev="$(losetup -f --show "$TMPDIR/img")"
+
+ port="$(_create_nvmet_port "${nvme_trtype}")"
+ _create_nvmet_subsystem "${subsys}" "${loop_dev}"
+ _add_nvmet_subsys_to_port "${port}" "${subsys}"
+ _nvme_connect_subsys "${nvme_trtype}" "${subsys}"
+ udevadm settle
+ nvmedev=$(_find_nvme_dev "${subsys}")
+
+ # start fio job
+ echo "starting background fio"
+ _run_fio_rand_io --filename="${nvmedev}n1" --size=1g \
+ --group_reporting --ramp_time=5 &> /dev/null &
+ sleep 5
+
+ # do reset/remove operation
+ echo "resetting controller"
+ _nvme_reset_ctrl ${nvmedev}
+ sleep 1
+ echo "deleting controller"
+ _nvme_delete_ctrl ${nvmedev}
+
+ echo "stopping background fio"
+ { kill $!; wait; } &> /dev/null
+
+ _remove_nvmet_subsystem_from_port "${port}" "${subsys}"
+ _remove_nvmet_subsystem "${subsys}"
+ _remove_nvmet_port "${port}"
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/040.out b/tests/nvme/040.out
new file mode 100644
index 000000000000..50d02d4e3cd0
--- /dev/null
+++ b/tests/nvme/040.out
@@ -0,0 +1,6 @@
+Running nvme/040
+starting background fio
+resetting controller
+deleting controller
+stopping background fio
+Test complete
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 4bebbc762cbb..dfea7f3a0da4 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -447,3 +447,11 @@ _nvme_disable_err_inject()
echo 0 > /sys/kernel/debug/"$1"/fault_inject/probability
echo 0 > /sys/kernel/debug/"$1"/fault_inject/times
}
+
+_nvme_reset_ctrl() {
+ echo 1 > /sys/class/nvme/"$1"/reset_controller
+}
+
+_nvme_delete_ctrl() {
+ echo 1 > /sys/class/nvme/"$1"/delete_controller
+}
--
2.34.1
More information about the Linux-nvme
mailing list