]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nvme/rc: Cleanup fc resource before module unloading
authorDaniel Wagner <dwagner@suse.de>
Wed, 3 May 2023 08:38:16 +0000 (10:38 +0200)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 6 Jun 2023 04:09:46 +0000 (13:09 +0900)
Cleanup all fc resources before unloading the module, so it the
operations are in reverse order how we setup them.

Also unload the nvme-fcloop after usage.

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

index b40722eefb48b6ec6c66fa4797a2500aa30370c0..3fe14dee2301a84b7a4fb4761f73835d2ec65723 100644 (file)
@@ -287,6 +287,11 @@ _cleanup_nvmet() {
        shopt -u nullglob
        trap SIGINT
 
+       if [[ "${nvme_trtype}" == "fc" ]]; then
+               _cleanup_fcloop "${def_local_wwnn}" "${def_local_wwpn}" \
+                               "${def_remote_wwnn}" "${def_remote_wwpn}"
+               modprobe -rq nvme-fcloop
+       fi
        modprobe -rq nvme-"${nvme_trtype}" 2>/dev/null
        if [[ "${nvme_trtype}" != "loop" ]]; then
                modprobe -rq nvmet-"${nvme_trtype}" 2>/dev/null
@@ -295,10 +300,6 @@ _cleanup_nvmet() {
        if [[ "${nvme_trtype}" == "rdma" ]]; then
                stop_soft_rdma
        fi
-       if [[ "${nvme_trtype}" == "fc" ]]; then
-               _cleanup_fcloop "${def_local_wwnn}" "${def_local_wwpn}" \
-                               "${def_remote_wwnn}" "${def_remote_wwpn}"
-       fi
 }
 
 _setup_nvmet() {