All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sun Ke <sunke32@huawei.com>
To: <linux-block@vger.kernel.org>, <osandov@fb.com>
Cc: <sunke32@huawei.com>
Subject: [PATCH blktests] Add mount and clear_sock test for nbd by netlink
Date: Mon, 24 Feb 2020 12:27:03 +0800	[thread overview]
Message-ID: <20200224042703.31587-1-sunke32@huawei.com> (raw)

This test case catches regressions fixed by commit 92b5c8f0063e4 "nbd:
replace kill_bdev() with __invalidate_device() again". The nbd device is
connected by netlink interface.

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 tests/nbd/004     | 30 ++++++++++++++++++++++++++++++
 tests/nbd/004.out |  1 +
 tests/nbd/rc      | 10 ++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 tests/nbd/004
 create mode 100644 tests/nbd/004.out

diff --git a/tests/nbd/004 b/tests/nbd/004
new file mode 100644
index 0000000..324c903
--- /dev/null
+++ b/tests/nbd/004
@@ -0,0 +1,30 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2020 Sun Ke
+#
+# Regression test for commit 2b5c8f0063e4 ("nbd: replace kill_bdev() with
+# __invalidate_device() again").
+
+. tests/nbd/rc
+
+DESCRIPTION="connected by netlink, mount/unmount concurrently with NBD_CLEAR_SOCK"
+QUICK=1
+
+requires() {
+	_have_nbd && _have_src_program mount_clear_sock
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	_start_nbd_server_netlink
+	nbd-client localhost 8000 /dev/nbd0 >> "$FULL" 2>&1
+	mkfs.ext4 /dev/nbd0 >> "$FULL" 2>&1
+
+	mkdir -p "${TMPDIR}/mnt"
+	src/mount_clear_sock /dev/nbd0 "${TMPDIR}/mnt" ext4 5000
+
+	nbd-client -d /dev/nbd0 >> "$FULL" 2>&1
+	rm -rf "${TMPDIR}/mnt"
+	_stop_nbd_server_netlink
+}
diff --git a/tests/nbd/004.out b/tests/nbd/004.out
new file mode 100644
index 0000000..01a875a
--- /dev/null
+++ b/tests/nbd/004.out
@@ -0,0 +1 @@
+Running nbd/004
diff --git a/tests/nbd/rc b/tests/nbd/rc
index 9d0e3d1..767043a 100644
--- a/tests/nbd/rc
+++ b/tests/nbd/rc
@@ -76,3 +76,13 @@ _stop_nbd_server() {
 	rm -f "${TMPDIR}/nbd.pid"
 	rm -f "${TMPDIR}/export"
 }
+
+_start_nbd_server_netlink() {
+	truncate -s 10G "${TMPDIR}/export"
+	nbd-server 8000 "${TMPDIR}/export" >> "$FULL" 2>&1
+}
+
+_stop_nbd_server_netlink() {
+	pkill -SIGTERM -f 8000
+	rm -f "${TMPDIR}/export"
+}
-- 
2.13.6


                 reply	other threads:[~2020-02-24  4:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200224042703.31587-1-sunke32@huawei.com \
    --to=sunke32@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=osandov@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.