block: add test for io hang due to blk-iolatency
PATCH 1/1 block: add test for io hang due to blk-iolatency
Add test for verifying io hang when enabling blk-iolatency after a few IOs have been done.
This is a regression test for
"blk-iolatency: fix IO hang due to negative inflight counter".
--- tests/block/022 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/block/022.out | 2 ++ 2 files changed, 44 insertions(+) create mode 100755 tests/block/022 create mode 100644 tests/block/022.out
tests/block/022 new file +42 -0
@@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Bo Liu <[email protected]> +# +# This test is a regression test for io hang due to blk-iolatency, the patch is +# "blk-iolatency: fix IO hang due to negative inflight counter" + +. tests/block/rc +. common/cgroup +. common/null_blk +DESCRIPTION="This test will demonstrate io hang due to blk-iolatency" + +requires() { + _have_null_blk && _have_cgroup2_controller_file io io.latency +} + +test() { + local CGROUP2_DIR + local dir + echo "Running ${TEST_NAME}" + + if ! _init_null_blk queue_mode=2; then + return 1 + fi + + _init_cgroup2 + dir=$(_cgroup2_base_dir) + + echo $$ > ${CGROUP2_DIR}/cgroup.procs + xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0 + + # target=1s + echo "`cat /sys/block/nullb0/dev` target=1000000" > ${CGROUP2_DIR}/io.latency + + xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0 + + echo $$ > ${dir}/cgroup.procs + _exit_cgroup2 + _exit_null_blk + + echo "Test complete" +}
tests/block/022.out new file +2 -0
@@ -0,0 +1,2 @@ +Running block/022 +Test complete
Signature · 1 line
2.20.1.2.gb21ebb6
Thanks for the test Liu, please see my inline comments.
From: [email protected] <[email protected]> on behalf of Liu Bo <[email protected]>
Sent: Tuesday, January 29, 2019 3:54 PM
To: [email protected]
Subject: [PATCH blktests] block: add test for io hang due to blk-iolatency
Add test for verifying io hang when enabling blk-iolatency after a few
IOs have been done.
This is a regression test for
"blk-iolatency: fix IO hang due to negative inflight counter".
---
tests/block/022 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/block/022.out | 2 ++
2 files changed, 44 insertions(+)
create mode 100755 tests/block/022
create mode 100644 tests/block/022.out
tests/block/022 new file +14 -0
@@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Bo Liu <[email protected]> +# +# This test is a regression test for io hang due to blk-iolatency, the patch is +# "blk-iolatency: fix IO hang due to negative inflight counter" + +. tests/block/rc +. common/cgroup +. common/null_blk +DESCRIPTION="This test will demonstrate io hang due to blk-iolatency" + +requires() { + _have_null_blk && _have_cgroup2_controller_file io io.latency
need to add _have_program xfs_io here.
+}
+
+test() {
+ local CGROUP2_DIR
+ local dir
+ echo "Running ${TEST_NAME}"
+
+ if ! _init_null_blk queue_mode=2; then
may be print a error message here and/or skip the test instred of just return ? + return 1
+ fi
+
+ _init_cgroup2
+ dir=$(_cgroup2_base_dir)
+
I'm little bit confused, CGROUP2_DIR is not initialize or its an environment variable ? + echo $$ > ${CGROUP2_DIR}/cgroup.procs
+ xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
+
+ # target=1s
+ echo "cat /sys/block/nullb0/dev target=1000000" > ${CGROUP2_DIR}/io.latency +
+ xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0
+
+ echo $$ > ${dir}/cgroup.procs
+ _exit_cgroup2
+ _exit_null_blk
+
+ echo "Test complete"
+}
tests/block/022.out new file +2 -0
@@ -0,0 +1,2 @@ +Running block/022 +Test complete
Signature · 1 line
2.20.1.2.gb21ebb6
Quoted 41 lines · Chaitanya Kulkarni
Thanks for the test Liu, please see my inline comments.
From: [email protected] <[email protected]> on behalf of Liu Bo <[email protected]>
Sent: Tuesday, January 29, 2019 3:54 PM
To: [email protected]
Subject: [PATCH blktests] block: add test for io hang due to blk-iolatency
Add test for verifying io hang when enabling blk-iolatency after a few
IOs have been done.This is a regression test for
"blk-iolatency: fix IO hang due to negative inflight counter".Signed-off-by Liu Bo <[email protected]>---
tests/block/022 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/block/022.out | 2 ++2 files changed, 44 insertions(+)create mode 100755 tests/block/022
create mode 100644 tests/block/022.outtests/block/022 new file +14
-0@@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Bo Liu <[email protected]> +# +# This test is a regression test for io hang due to blk-iolatency, the patch is +# "blk-iolatency: fix IO hang due to negative inflight counter" + +. tests/block/rc +. common/cgroup +. common/null_blk +DESCRIPTION="This test will demonstrate io hang due to blk-iolatency" + +requires() { + _have_null_blk && _have_cgroup2_controller_file io io.latency
Quoted 1 line
need to add
_have_programxfs_iohere.
OK.
Quoted 9 lines
tests/block/022 new file +8
-0+} + +test() { + local CGROUP2_DIR + local dir + echo "Running ${TEST_NAME}" + + if ! _init_null_blk queue_mode=2; thenmay be print a error message here and/or skip the test instred of just return ?
Sure.
Quoted 7 lines
+ return 1
+ fitests/block/022 new file +4
-0+ + _init_cgroup2 + dir=$(_cgroup2_base_dir) +I'm little bit confused,
CGROUP2_DIRis not initialize or its an environment variable ?
It's defined in _init_cgroup2, but I'll add a comment for that.
thanks,
-liubo
Quoted 25 lines
+ echo $$ > ${CGROUP2_DIR}/cgroup.procs
+xfs_io-f -d -c "pwrite 0 4k"/dev/nullb0tests/block/022 new file +12
-0+ + # target=1s + echo "`cat /sys/block/nullb0/dev` target=1000000" > ${CGROUP2_DIR}/io.latency + + xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0 + + echo $$ > ${dir}/cgroup.procs + _exit_cgroup2 + _exit_null_blk + + echo "Test complete" +}tests/block/022.out new file +2
-0@@ -0,0 +1,2 @@ +Running block/022 +Test completeSignature · 1 line
2.20.1.2.gb21ebb6