new file mode 100755
@@ -0,0 +1,39 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
+#
+# Basic RNBD test
+#
+. 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
+ loop_dev="$(losetup -f)"
+
+ if _start_rnbd_client "${loop_dev}"; then
+ sleep 0.5
+ _stop_rnbd_client || echo "Failed to disconnect rnbd"
+ else
+ echo "Failed to connect rnbd"
+ fi
+
+ _cleanup_rnbd
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+ test_start_stop
+ echo "Test complete"
+}
new file mode 100644
@@ -0,0 +1,2 @@
+Running rnbd/001
+Test complete
new file mode 100644
@@ -0,0 +1,51 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (c) 2024 FUJITSU LIMITED. All Rights Reserved.
+#
+# RNBD tests.
+
+. common/rc
+. common/multipath-over-rdma
+
+_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() {
+ 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
+}
+
+_stop_rnbd_client() {
+ local s sessions
+
+ sessions=$(ls -d /sys/block/rnbd* 2>/dev/null)
+ for s in $sessions
+ do
+ grep -qx blktest "$s"/rnbd/session && echo "normal" > "$s"/rnbd/unmap_device
+ done
+}
+
+_start_rnbd_client() {
+ local blkdev=$1
+
+ # Stop potential remaining blktest sessions first
+ _stop_rnbd_client
+ echo "sessname=blktest path=ip:$def_traddr device_path=$blkdev" > /sys/devices/virtual/rnbd-client/ctl/map_device
+}