nvme: add nvmf reset/disconnect during traffic test
Sagi Grimberg
maintainerPATCH v2 1/1 nvme: add nvmf reset/disconnect during traffic test
Test traffic controller reset and disconnect during traffic.
---
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
tests/nvme/040 new file +59 -0
@@ -0,0 +1,59 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2022 Sagi Grimberg <[email protected]> +# +# 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" +}
tests/nvme/040.out new file +6 -0
@@ -0,0 +1,6 @@ +Running nvme/040 +starting background fio +resetting controller +deleting controller +stopping background fio +Test complete
tests/nvme/rc +8 -0
@@ -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 +}
Signature · 1 line
2.34.1
Looks good. I’ve tested it on my config.
Quoted 117 lines · Sagi Grimberg
Test traffic controller reset and disconnect during traffic.
Signed-off-by Sagi Grimberg <[email protected]>---
Changes from v1:
- fix copyright
- change subsys name
- fix test cleanup warnings
- don't log device names
- fix shellchecktests/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.outtests/nvme/040 new file +59
-0@@ -0,0 +1,59 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2022 Sagi Grimberg <[email protected]> +# +# 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" +}tests/nvme/040.out new file +6
-0@@ -0,0 +1,6 @@ +Running nvme/040 +starting background fio +resetting controller +deleting controller +stopping background fio +Test completetests/nvme/rc +8
-0@@ -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 +}Signature · 1 line
2.34.1
O
Review
Quoted 10 lines
(quoted diff) +10
-0+ + # 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
do we really need to kill the fio process explicitly ? I think graceful termination of the traffic application should be a part of this test without explicitly killing the process.
I ran the test with commenting above line it runs fine :-
blktests (master) # git diff
tests/nvme/040 +1 -1
@@ -49,7 +49,7 @@ test() { _nvme_delete_ctrl ${nvmedev} echo "stopping background fio" - { kill $!; wait; } &> /dev/null +#{ kill $!; wait; } &> /dev/null _remove_nvmet_subsystem_from_port "${port}" "${subsys}" _remove_nvmet_subsystem "${subsys}"
blktests (master) # ./check nvme/040
nvme/040 (test nvme fabrics controller reset/disconnect operation during I/O) [passed]
runtime 8.119s ... 8.084s
blktests (master) #
-ck
Quoted 35 lines · Chaitanya Kulkarni
O
Review
Quoted 10 lines
(quoted diff) +10
-0+ + # 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/nulldo we really need to kill the fio process explicitly ? I think graceful termination of the traffic application should be a part of this test without explicitly killing the process.
I ran the test with commenting above line it runs fine :-
blktests (master) # git diff
tests/nvme/040 +1
-1@@ -49,7 +49,7 @@ test() { _nvme_delete_ctrl ${nvmedev} echo "stopping background fio" - { kill $!; wait; } &> /dev/null +#{ kill $!; wait; } &> /dev/null _remove_nvmet_subsystem_from_port "${port}" "${subsys}" _remove_nvmet_subsystem "${subsys}"blktests (master) # ./check nvme/040
nvme/040 (test nvme fabrics controller reset/disconnect operation during I/O) [passed]
Quoted 4 lines
runtime 8.119s ... 8.084sblktests (master) #
-ck
Sagi, what do you think on this comment?
To keep this test case consistent with nvme/032, it would be the better to keep the kill and wait. But we may not need to stick to it if it does better testing without the kill and wait.
Signature · 1 line
Shin'ichiro Kawasaki
Sagi Grimberg
maintainerQuoted 39 lines
Quoted 39 lines
O
Review
Quoted 10 lines
(quoted diff) +10
-0+ + # 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/nulldo we really need to kill the fio process explicitly ? I think graceful termination of the traffic application should be a part of this test without explicitly killing the process.
I ran the test with commenting above line it runs fine :-
blktests (master) # git diff
tests/nvme/040 +1
-1@@ -49,7 +49,7 @@ test() { _nvme_delete_ctrl ${nvmedev} echo "stopping background fio" - { kill $!; wait; } &> /dev/null +#{ kill $!; wait; } &> /dev/null _remove_nvmet_subsystem_from_port "${port}" "${subsys}" _remove_nvmet_subsystem "${subsys}"blktests (master) # ./check nvme/040
nvme/040 (test nvme fabrics controller reset/disconnect operation during I/O) [passed]runtime 8.119s ... 8.084sblktests (master) #
Quoted 7 lines
Quoted 1 line
-ck
Sagi, what do you think on this comment?
To keep this test case consistent with nvme/032, it would be the better to keep the kill and wait. But we may not need to stick to it if it does better testing without the kill and wait.
I don't particularly care. Can you remove it when applying?
Quoted 43 lines · Sagi Grimberg
Quoted 43 lines
Quoted 36 lines
O
Review
Quoted 10 lines
(quoted diff) +10
-0+ + # 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/nulldo we really need to kill the fio process explicitly ? I think graceful termination of the traffic application should be a part of this test without explicitly killing the process.
I ran the test with commenting above line it runs fine :-
blktests (master) # git diff
tests/nvme/040 +1
-1@@ -49,7 +49,7 @@ test() { _nvme_delete_ctrl ${nvmedev} echo "stopping background fio" - { kill $!; wait; } &> /dev/null +#{ kill $!; wait; } &> /dev/null _remove_nvmet_subsystem_from_port "${port}" "${subsys}" _remove_nvmet_subsystem "${subsys}"blktests (master) # ./check nvme/040
nvme/040 (test nvme fabrics controller reset/disconnect operation during I/O) [passed]Quoted 4 lines
runtime 8.119s ... 8.084sblktests (master) #
-ck
Sagi, what do you think on this comment?
Quoted 5 lines
Quoted 3 lines
To keep this test case consistent with nvme/032, it would be the better to keep the kill and wait. But we may not need to stick to it if it does better testing without the kill and wait.
I don't particularly care. Can you remove it when applying?
Sure, I've applied with the edit.
Signature · 1 line
Shin'ichiro Kawasaki