]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nvme/rc: do not cleanup external managed loop device
authorDaniel Wagner <dwagner@suse.de>
Tue, 26 Mar 2024 13:13:53 +0000 (14:13 +0100)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 29 Mar 2024 05:36:25 +0000 (14:36 +0900)
If the test setups a loop device itself (not created by
_nvmet_target_setup), _nvmet_target_cleanup should not cleanup the block
device automatically.

Because _nvmet_target_cleanup has no way to figure this out by itself if
it is managed or not, the caller needs to pass in the block device type.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/nvme/rc

index 4ad6cb640627b4366d984bae872692222fd0ac7c..9d47c737f9b060f61ac4823df4695f5fcf630306 100644 (file)
@@ -855,9 +855,14 @@ _nvmet_target_cleanup() {
        local port
        local blkdev
        local subsysnqn="${def_subsysnqn}"
+       local blkdev_type=""
 
        while [[ $# -gt 0 ]]; do
                case $1 in
+                       --blkdev)
+                               blkdev_type="$2"
+                               shift 2
+                               ;;
                        --subsysnqn)
                                subsysnqn="$2"
                                shift 2
@@ -878,7 +883,9 @@ _nvmet_target_cleanup() {
        _remove_nvmet_subsystem "${subsysnqn}"
        _remove_nvmet_host "${def_hostnqn}"
 
-       _cleanup_blkdev
+       if [[ "${blkdev_type}" == "device" ]]; then
+               _cleanup_blkdev
+       fi
 }
 
 _nvmet_passthru_target_setup() {