nvme/031: Add test to check controller deletion after setup
Subsystems (2)
PATCH 1/1 nvme/031: Add test to check controller deletion after setup
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.
---
This is reallly just a resend. The patches this tests for are all in 5.3-rc7 or earlier and it passes on said kernel version.
I've rebased this patch onto the latest blktests as of today with no changes required.
Thanks,
Logan
tests/nvme/031 | 55 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/031.out | 2 ++ 2 files changed, 57 insertions(+) create mode 100755 tests/nvme/031 create mode 100644 tests/nvme/031.out
tests/nvme/031 new file +55 -0
@@ -0,0 +1,55 @@ +#!/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" + + local loop_dev + 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" +}
tests/nvme/031.out new file +2 -0
@@ -0,0 +1,2 @@ +Running nvme/031 +Test complete
--
2.20.1
Looks good Logan,
Quoted 58 lines · Logan Gunthorpe
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 <[email protected]>---
This is reallly just a resend. The patches this tests for are all in 5.3-rc7 or earlier and it passes on said kernel version.
I've rebased this patch onto the latest blktests as of today with no changes required.
Thanks,
Logan
tests/nvme/031 | 55 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/031.out | 2 ++ 2 files changed, 57 insertions(+)create mode 100755 tests/nvme/031
create mode 100644 tests/nvme/031.outtests/nvme/031 new file +28
-0@@ -0,0 +1,55 @@ +#!/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
tests/nvme/031 line 38
Quoted 10 lines
tests/nvme/031 new file +10
-0+ local loop_dev + local port + + echo "Running ${TEST_NAME}" + + _setup_nvmet + + truncate -s 1G "$TMPDIR/img" + + local loop_dev
Duplicate declaration of the local variable ?
Quoted 33 lines
tests/nvme/031 new file +17
-0+ 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" +}tests/nvme/031.out new file +2
-1@@ -0,0 +1,2 @@ +Running nvme/031 +Test complete --2.20.1
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 62 lines · Chaitanya Kulkarni
Quoted 61 lines · Logan Gunthorpe
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 <[email protected]>---
This is reallly just a resend. The patches this tests for are all in 5.3-rc7 or earlier and it passes on said kernel version.
I've rebased this patch onto the latest blktests as of today with no changes required.
Thanks,
Logan
tests/nvme/031 | 55 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/031.out | 2 ++ 2 files changed, 57 insertions(+)create mode 100755 tests/nvme/031
create mode 100644 tests/nvme/031.outtests/nvme/031 new file +31
-0@@ -0,0 +1,55 @@ +#!/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 +
Quoted 8 lines
tests/nvme/031 line 38
Quoted 7 lines
tests/nvme/031 new file +7
-0+ echo "Running ${TEST_NAME}" + + _setup_nvmet + + truncate -s 1G "$TMPDIR/img" + + local loop_devDuplicate declaration of the local variable ?
Oops, yes, nice catch. I'll send an updated patch later this week.
Logan
Hi,
Thanks for the testcase Logan, once passthru patches are applied feel free to post the blktests for the passthru on the mainling list, I'll be happy review.
Quoted 10 lines · Logan Gunthorpe
Quoted 8 lines · Chaitanya Kulkarni
Quoted 8 lines · Logan Gunthorpe
Quoted 7 lines
Quoted 7 lines
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<[email protected]>---