diff mbox series

[blktests,v4,2/2] tests/rnbd: Implement RNBD regression test

Message ID 20250107060810.91111-2-lizhijian@fujitsu.com (mailing list archive)
State New
Headers show
Series [blktests,v4,1/2] tests/rnbd: Add a basic RNBD test | expand

Commit Message

Li Zhijian Jan. 7, 2025, 6:08 a.m. UTC
This test case has been in my possession for quite some time.
I am upstreaming it now because it has once again detected a regression in
a recent kernel release[0].

It's just stupid to connect and disconnect RNBD on localhost and expect
no dmesg exceptions, with some attempts actually succeeding.

rnbd/002 (Start Stop RNBD repeatedly)                        [passed]
    runtime                   13.252s  ...  13.099s
    start/stop success ratio  100/100  ...  100/100

[0] https://lore.kernel.org/linux-rdma/20241223025700.292536-1-lizhijian@fujitsu.com/

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
V4:
  - Fix a typo and update the passed condition # Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
  - rename test_start_stop() to test_start_stop_repeatedly()

V3:
  - Always stop the rnbd regardless of the result of start

V2:
  - address comments from Shinichiro
  - minor fixes

Copy to the RDMA/rtrs guys:

Cc: Jack Wang <jinpu.wang@ionos.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
---
 tests/rnbd/002     | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/rnbd/002.out |  2 ++
 2 files changed, 49 insertions(+)
 create mode 100755 tests/rnbd/002
 create mode 100644 tests/rnbd/002.out

Comments

Jinpu Wang Jan. 7, 2025, 7:38 a.m. UTC | #1
On Tue, Jan 7, 2025 at 7:08 AM Li Zhijian <lizhijian@fujitsu.com> wrote:
>
> This test case has been in my possession for quite some time.
> I am upstreaming it now because it has once again detected a regression in
> a recent kernel release[0].
>
> It's just stupid to connect and disconnect RNBD on localhost and expect
> no dmesg exceptions, with some attempts actually succeeding.
>
> rnbd/002 (Start Stop RNBD repeatedly)                        [passed]
>     runtime                   13.252s  ...  13.099s
>     start/stop success ratio  100/100  ...  100/100
>
> [0] https://lore.kernel.org/linux-rdma/20241223025700.292536-1-lizhijian@fujitsu.com/
>
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Thx for the patch, LGTM
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
> ---
> V4:
>   - Fix a typo and update the passed condition # Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>   - rename test_start_stop() to test_start_stop_repeatedly()
>
> V3:
>   - Always stop the rnbd regardless of the result of start
>
> V2:
>   - address comments from Shinichiro
>   - minor fixes
>
> Copy to the RDMA/rtrs guys:
>
> Cc: Jack Wang <jinpu.wang@ionos.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
> ---
>  tests/rnbd/002     | 47 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/rnbd/002.out |  2 ++
>  2 files changed, 49 insertions(+)
>  create mode 100755 tests/rnbd/002
>  create mode 100644 tests/rnbd/002.out
>
> diff --git a/tests/rnbd/002 b/tests/rnbd/002
> new file mode 100755
> index 000000000000..7d7da9401974
> --- /dev/null
> +++ b/tests/rnbd/002
> @@ -0,0 +1,47 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
> +#
> +# Commit 667db86bcbe8 ("RDMA/rtrs: Register ib event handler") introduced a
> +# new element .deinit but never used it at all that lead to a
> +# 'list_add corruption' kernel warning.
> +#
> +# This test is intended to check whether the current kernel is affected.
> +# The following patch resolves this issue.
> +#  RDMA/rtrs: Add missing deinit() call
> +#
> +. tests/rnbd/rc
> +
> +DESCRIPTION="Start Stop RNBD repeatedly"
> +CHECK_DMESG=1
> +QUICK=1
> +
> +requires() {
> +       _have_rnbd
> +       _have_loop
> +}
> +
> +test_start_stop_repeatedly()
> +{
> +       _setup_rnbd || return
> +
> +       local loop_dev i j=0
> +       loop_dev="$(losetup -f)"
> +
> +       for ((i=0;i<100;i++))
> +       do
> +               _start_rnbd_client "${loop_dev}" &>/dev/null
> +               # Always stop it so that the next start has change to work
> +               _stop_rnbd_client &>/dev/null && ((j++))
> +       done
> +
> +       TEST_RUN["start/stop success ratio"]="${j}/${i}"
> +
> +       _cleanup_rnbd
> +}
> +
> +test() {
> +       echo "Running ${TEST_NAME}"
> +       test_start_stop_repeatedly
> +       echo "Test complete"
> +}
> diff --git a/tests/rnbd/002.out b/tests/rnbd/002.out
> new file mode 100644
> index 000000000000..2f055b8c82f9
> --- /dev/null
> +++ b/tests/rnbd/002.out
> @@ -0,0 +1,2 @@
> +Running rnbd/002
> +Test complete
> --
> 2.47.0
>
diff mbox series

Patch

diff --git a/tests/rnbd/002 b/tests/rnbd/002
new file mode 100755
index 000000000000..7d7da9401974
--- /dev/null
+++ b/tests/rnbd/002
@@ -0,0 +1,47 @@ 
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
+#
+# Commit 667db86bcbe8 ("RDMA/rtrs: Register ib event handler") introduced a
+# new element .deinit but never used it at all that lead to a
+# 'list_add corruption' kernel warning.
+#
+# This test is intended to check whether the current kernel is affected.
+# The following patch resolves this issue.
+#  RDMA/rtrs: Add missing deinit() call
+#
+. tests/rnbd/rc
+
+DESCRIPTION="Start Stop RNBD repeatedly"
+CHECK_DMESG=1
+QUICK=1
+
+requires() {
+	_have_rnbd
+	_have_loop
+}
+
+test_start_stop_repeatedly()
+{
+	_setup_rnbd || return
+
+	local loop_dev i j=0
+	loop_dev="$(losetup -f)"
+
+	for ((i=0;i<100;i++))
+	do
+		_start_rnbd_client "${loop_dev}" &>/dev/null
+		# Always stop it so that the next start has change to work
+		_stop_rnbd_client &>/dev/null && ((j++))
+	done
+
+	TEST_RUN["start/stop success ratio"]="${j}/${i}"
+
+	_cleanup_rnbd
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+	test_start_stop_repeatedly
+	echo "Test complete"
+}
diff --git a/tests/rnbd/002.out b/tests/rnbd/002.out
new file mode 100644
index 000000000000..2f055b8c82f9
--- /dev/null
+++ b/tests/rnbd/002.out
@@ -0,0 +1,2 @@ 
+Running rnbd/002
+Test complete