From: Li Zhijian <lizhijian@fujitsu.com>
To: linux-block@vger.kernel.org
Cc: shinichiro.kawasaki@wdc.com, linux-rdma@vger.kernel.org,
Li Zhijian <lizhijian@fujitsu.com>,
Jack Wang <jinpu.wang@ionos.com>, Jason Gunthorpe <jgg@ziepe.ca>,
Leon Romanovsky <leon@kernel.org>,
"Md. Haris Iqbal" <haris.iqbal@ionos.com>
Subject: [PATCH blktests v2 1/2] tests/rnbd: Implement RNBD regression test
Date: Wed, 25 Dec 2024 17:37:50 +0800 [thread overview]
Message-ID: <20241225093751.307267-1-lizhijian@fujitsu.com> (raw)
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 [1].
It's just stupid to connect and disconnect RNBD on localhost and expect
no dmesg exceptions, with some attempts actually succeeding.
Please note that currently, only RTRS over RXE is supported.
[1] https://lore.kernel.org/linux-rdma/20241223025700.292536-1-lizhijian@fujitsu.com/
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
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/001 | 47 +++++++++++++++++++++++++++++++++
tests/rnbd/001.out | 2 ++
tests/rnbd/rc | 66 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 115 insertions(+)
create mode 100755 tests/rnbd/001
create mode 100644 tests/rnbd/001.out
create mode 100644 tests/rnbd/rc
diff --git a/tests/rnbd/001 b/tests/rnbd/001
new file mode 100755
index 000000000000..ef8dff93a94a
--- /dev/null
+++ b/tests/rnbd/001
@@ -0,0 +1,47 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
+#
+# Regression test for the following patch
+# RDMA/ulp: Add missing deinit() call
+#
+# It assists in detecting a 'list_add corruption' kernel warning by repeatedly
+# connecting and disconnecting the RNBD.
+#
+. tests/rnbd/rc
+
+DESCRIPTION="Start Stop RNBD"
+CHECK_DMESG=1
+QUICK=1
+
+requires() {
+ _have_rnbd
+ _have_loop
+}
+
+test_start_stop()
+{
+ _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 &&
+ _stop_rnbd_client &>/dev/null && ((j++))
+ done
+
+ # We expect at least 10% start/stop successfully
+ if [[ $j -lt 10 ]]; then
+ echo "Failed: $j/$i"
+ fi
+
+ _cleanup_rnbd
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+ test_start_stop
+ echo "Test complete"
+}
diff --git a/tests/rnbd/001.out b/tests/rnbd/001.out
new file mode 100644
index 000000000000..c1f9980d0f7b
--- /dev/null
+++ b/tests/rnbd/001.out
@@ -0,0 +1,2 @@
+Running rnbd/001
+Test complete
diff --git a/tests/rnbd/rc b/tests/rnbd/rc
new file mode 100644
index 000000000000..577cdbad61ef
--- /dev/null
+++ b/tests/rnbd/rc
@@ -0,0 +1,66 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
+#
+# RNBD tests.
+
+. common/rc
+. common/multipath-over-rdma
+
+declare RNBD_ENTRY
+
+_have_rnbd() {
+ if [[ "$USE_RXE" != 1 ]]; then
+ SKIP_REASONS+=("Only USE_RXE=1 is supported")
+ fi
+ _have_driver rdma_rxe
+ _have_driver rnbd_server
+ _have_driver rnbd_client
+}
+
+_setup_rnbd() {
+ modprobe -q rnbd_server
+ modprobe -q rnbd_client
+ start_soft_rdma
+ for i in $(rdma_network_interfaces)
+ do
+ ipv4_addr=$(get_ipv4_addr "$i")
+ if [[ -n "${ipv4_addr}" ]]; then
+ def_traddr=${ipv4_addr}
+ fi
+ done
+}
+
+_cleanup_rnbd()
+{
+ stop_soft_rdma
+}
+
+_start_rnbd_client() {
+ local a b
+ local blkdev=$1
+ local before after
+
+ before=$(ls -d /sys/block/rnbd* 2>/dev/null)
+ if ! echo "sessname=blktest path=ip:$def_traddr device_path=$blkdev" > /sys/devices/virtual/rnbd-client/ctl/map_device; then
+ return 1
+ fi
+
+ # Retrieve the newly added rnbd entry
+ after=$(ls -d /sys/block/rnbd* 2>/dev/null)
+ for a in $after
+ do
+ [[ -n "$before" ]] || break
+
+ for b in $before
+ do
+ [[ "$a" = "$b" ]] || break
+ done
+ done
+
+ RNBD_ENTRY=$a
+}
+
+_stop_rnbd_client() {
+ echo "normal" > "$RNBD_ENTRY"/rnbd/unmap_device
+}
--
2.47.0
next reply other threads:[~2024-12-25 9:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-25 9:37 Li Zhijian [this message]
2024-12-25 9:37 ` [PATCH blktests v2 2/2] [NOT-FOR-MERGE] just for testing Li Zhijian
2024-12-26 13:17 ` Shinichiro Kawasaki
2024-12-27 1:33 ` Zhijian Li (Fujitsu)
2024-12-27 5:37 ` Zhijian Li (Fujitsu)
2024-12-27 9:23 ` Zhu Yanjun
2024-12-27 11:25 ` Zhu Yanjun
2024-12-30 2:02 ` Zhijian Li (Fujitsu)
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=20241225093751.307267-1-lizhijian@fujitsu.com \
--to=lizhijian@fujitsu.com \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-rdma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox