diff mbox series

[blktests,v3] nvme/031: Add test to check controller deletion after setup

Message ID 20190911172021.5760-1-logang@deltatee.com (mailing list archive)
State New, archived
Headers show
Series [blktests,v3] nvme/031: Add test to check controller deletion after setup | expand

Commit Message

Logan Gunthorpe Sept. 11, 2019, 5:20 p.m. UTC
A number of bug fixes have been submitted to the kernel to
fix bugs when a controller is removed immediately after it is
set up. This new test ensures this doesn't regress.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
---

Changes for v3:
 * Drops the double loop_dev declaration (per Chaitanya)
 * Collected Sagi's reviewed-by tag

 tests/nvme/031     | 54 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/031.out |  2 ++
 2 files changed, 56 insertions(+)
 create mode 100755 tests/nvme/031
 create mode 100644 tests/nvme/031.out

--
2.20.1

Comments

Chaitanya Kulkarni Sept. 11, 2019, 8:38 p.m. UTC | #1
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

On 09/11/2019 10:20 AM, Logan Gunthorpe wrote:
> A number of bug fixes have been submitted to the kernel to
> fix bugs when a controller is removed immediately after it is
> set up. This new test ensures this doesn't regress.
>
> Signed-off-by: Logan Gunthorpe<logang@deltatee.com>
> Reviewed-by: Sagi Grimberg<sagi@grimberg.me>
> ---
>
> Changes for v3:
Omar Sandoval Oct. 15, 2019, 11:08 p.m. UTC | #2
On Wed, Sep 11, 2019 at 11:20:21AM -0600, Logan Gunthorpe wrote:
> A number of bug fixes have been submitted to the kernel to
> fix bugs when a controller is removed immediately after it is
> set up. This new test ensures this doesn't regress.
> 
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> ---
> 
> Changes for v3:
>  * Drops the double loop_dev declaration (per Chaitanya)
>  * Collected Sagi's reviewed-by tag
> 
>  tests/nvme/031     | 54 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/031.out |  2 ++
>  2 files changed, 56 insertions(+)
>  create mode 100755 tests/nvme/031
>  create mode 100644 tests/nvme/031.out

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/nvme/031 b/tests/nvme/031
new file mode 100755
index 000000000000..892f20bad9a7
--- /dev/null
+++ b/tests/nvme/031
@@ -0,0 +1,54 @@ 
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Logan Gunthorpe
+#
+# Regression test for the following patches:
+#    nvme: fix controller removal race with scan work
+#    nvme: fix regression upon hot device removal and insertion
+#    nvme-core: Fix extra device_put() call on error path
+#    nvmet-loop: Flush nvme_delete_wq when removing the port
+#    nvmet: Fix use-after-free bug when a port is removed
+#
+# All these patches fix issues related to deleting a controller
+# immediately after setting it up.
+
+. tests/nvme/rc
+
+DESCRIPTION="test deletion of NVMeOF controllers immediately after setup"
+QUICK=1
+
+requires() {
+	_have_program nvme &&
+	_have_modules loop nvme-loop nvmet &&
+	_have_configfs
+}
+
+test() {
+	local subsys="blktests-subsystem-"
+	local iterations=10
+	local loop_dev
+	local port
+
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+
+	truncate -s 1G "$TMPDIR/img"
+
+	loop_dev="$(losetup -f --show "$TMPDIR/img")"
+
+	port="$(_create_nvmet_port "loop")"
+
+	for ((i = 0; i < iterations; i++)); do
+		_create_nvmet_subsystem "${subsys}$i" "${loop_dev}"
+		_add_nvmet_subsys_to_port "${port}" "${subsys}$i"
+		nvme connect -t loop -n "${subsys}$i"
+		nvme disconnect -n "${subsys}$i" >> "${FULL}" 2>&1
+		_remove_nvmet_subsystem_from_port "${port}" "${subsys}$i"
+		_remove_nvmet_subsystem "${subsys}$i"
+	done
+
+	_remove_nvmet_port "${port}"
+
+	echo "Test complete"
+}
diff --git a/tests/nvme/031.out b/tests/nvme/031.out
new file mode 100644
index 000000000000..ae902bdd36d4
--- /dev/null
+++ b/tests/nvme/031.out
@@ -0,0 +1,2 @@ 
+Running nvme/031
+Test complete