[PATCH blktests 1/2] nvme/060: suppress state file write error

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Thu Jun 18 18:33:28 PDT 2026


The test case nvme/060 sometimes fails with the message below:

nvme/060 (tr=rdma) (test nvme fabrics target reset)          [failed]
    runtime    ...  27.967s
    --- tests/nvme/060.out	2026-01-19 04:30:04.820982813 +0000
    +++ /home/fedora/blktests/results/nodev_tr_rdma/nvme/060.out.bad	2026-01-19 06:44:49.223643735 +0000
    @@ -1,2 +1,3 @@
     Running nvme/060
    +_: line 1: /sys/kernel/debug/nvmet//blktests-subsystem-1/ctrl1/state: No such file or directory
     Test complete

To reset the test target controller, the test case locates the "state"
file and writes to it. This works in most cases, but the write can
fail: the test case connects and disconnects the target controller's
subsystem in parallel, so the "state" file may disappear after being
located but before the write happens.

Suppress the write error message to avoid this sporadic failure.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
 tests/nvme/060 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/nvme/060 b/tests/nvme/060
index 997512d..9e694af 100755
--- a/tests/nvme/060
+++ b/tests/nvme/060
@@ -19,11 +19,16 @@ set_conditions() {
 	_set_nvme_trtype "$@"
 }
 
+filter_state_write_msg() {
+	grep --invert-match "state: No such file or directory"
+}
+
 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"' _ {} \;
+	find "${dfs_path}" -maxdepth 1 -type d -name 'ctrl*' -exec sh -c \
+	     'echo "fatal" > "$1/state" ' _ {} \; |& filter_state_write_msg
 }
 
 nvmet_reset_loop() {
-- 
2.54.0




More information about the Linux-nvme mailing list