From: Daniel Wagner <wagi@kernel.org>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Chaitanya Kulkarni <kch@nvidia.com>,
linux-block@vger.kernel.org, Daniel Wagner <wagi@kernel.org>
Subject: [PATCH blktests v2 3/4] nvme/060: add test nvme fabrics target resetting during I/O
Date: Tue, 08 Apr 2025 18:25:59 +0200 [thread overview]
Message-ID: <20250408-test-target-v2-3-e9e2512586f8@kernel.org> (raw)
In-Reply-To: <20250408-test-target-v2-0-e9e2512586f8@kernel.org>
Newer kernel support to reset the target via the debugfs. Add a new test
case which exercises this interface.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Daniel Wagner <wagi@kernel.org>
---
tests/nvme/060 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/060.out | 2 ++
2 files changed, 64 insertions(+)
diff --git a/tests/nvme/060 b/tests/nvme/060
new file mode 100755
index 0000000000000000000000000000000000000000..293b03cd0ef6a75722c6b86fccbbc931d6f5e3a1
--- /dev/null
+++ b/tests/nvme/060
@@ -0,0 +1,62 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Daniel Wagner, SUSE Labs
+#
+# Test nvme fabrics controller reset/disconnect/reconnect.
+
+. tests/nvme/rc
+
+DESCRIPTION="test nvme fabrics target reset"
+
+requires() {
+ _nvme_requires
+ _have_loop
+ _require_nvme_trtype_is_fabrics
+ _have_kernel_option NVME_TARGET_DEBUGF
+}
+
+set_conditions() {
+ _set_nvme_trtype "$@"
+}
+
+nvmet_debug_trigger_reset() {
+ local nvmet_subsystem="$1"
+ local dfs_path="${NVMET_DFS}/${nvmet_subsystem}"
+
+ find "${dfs_path}" -maxdepth 1 -type d -name 'ctrl*' -exec sh -c 'echo "fatal" > "$1/state"' _ {} \;
+}
+
+nvmet_reset_loop() {
+ while true; do
+ nvmet_debug_trigger_reset "${def_subsysnqn}"
+ sleep 2
+ done
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
+ _nvmet_target_setup
+
+ nvmet_reset_loop &
+ reset_loop_pid=$!
+
+ # Reset the host in different states e.g when the host is in the
+ # connected or connecting state.
+ #
+ # The target reset is triggered with an even number timeout, while the
+ # host reconnects with an odd number timeout.
+ for ((i = 0; i <= 5; i++)); do
+ _nvme_connect_subsys --keep-alive-tmo 1 --reconnect-delay 1
+ sleep 3
+ _nvme_disconnect_subsys >> "$FULL" 2>&1
+ done
+
+ { kill "${reset_loop_pid}"; wait; } &> /dev/null
+
+ _nvmet_target_cleanup
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/060.out b/tests/nvme/060.out
new file mode 100644
index 0000000000000000000000000000000000000000..517ff2dfcfd41c4088991e669af9fef52bde570b
--- /dev/null
+++ b/tests/nvme/060.out
@@ -0,0 +1,2 @@
+Running nvme/060
+Test complete
--
2.49.0
next prev parent reply other threads:[~2025-04-08 16:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 16:25 [PATCH blktests v2 0/4] blktests: add target test cases Daniel Wagner
2025-04-08 16:25 ` [PATCH blktests v2 1/4] common/nvme: add debug nvmet path variable Daniel Wagner
2025-04-08 16:25 ` [PATCH blktests v2 2/4] common/nvme: move nvmf_wait_for_state to common code Daniel Wagner
2025-04-08 16:25 ` Daniel Wagner [this message]
2025-04-09 17:59 ` [PATCH blktests v2 3/4] nvme/060: add test nvme fabrics target resetting during I/O Daniel Wagner
2025-04-14 12:10 ` Shinichiro Kawasaki
2025-04-08 16:26 ` [PATCH blktests v2 4/4] nvme/061: add test teardown and setup fabrics target " Daniel Wagner
2025-04-14 12:18 ` Shinichiro Kawasaki
2025-04-14 13:27 ` Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250408-test-target-v2-3-e9e2512586f8@kernel.org \
--to=wagi@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.