[PATCH blktests 06/15] nvme: fix fc port clean up failure

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Wed Oct 23 18:00:16 PDT 2024


Commit "nvme: sanitize transport parameter in _create_nvmet_port()"
modified the wwnn and the wwpn names to be calculated based on port ID.
However, this port dependent wwnn and wwpn calculation was not reflected
to the clean up steps. This made the test case nvme/031 fail. To avoid
the failure, add clean up steps based on the port ID.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
 common/nvme | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/common/nvme b/common/nvme
index 3e388c2..2ef9fd8 100644
--- a/common/nvme
+++ b/common/nvme
@@ -183,6 +183,12 @@ _cleanup_nvmet() {
 	for port in "${NVMET_CFS}"/ports/*; do
 		name=$(basename "${port}")
 		echo "WARNING: Test did not clean up port: ${name}"
+		if [[ "${nvme_trtype}" == "fc" ]]; then
+			_cleanup_fcloop "$(_local_wwnn "$port")" \
+					"$(_local_wwpn "$port")" \
+					"$(_remote_wwnn "$port")" \
+					"$(_remote_wwpn "$port")"
+		fi
 		rm -f "${port}"/subsystems/*
 		rmdir "${port}"
 	done
@@ -206,8 +212,6 @@ _cleanup_nvmet() {
 	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 2>/dev/null
 	fi
 	modprobe -rq nvme-"${nvme_trtype}" 2>/dev/null
@@ -493,6 +497,13 @@ _create_nvmet_port() {
 
 _remove_nvmet_port() {
 	local port="$1"
+
+	if [[ "${nvme_trtype}" == "fc" ]]; then
+		_cleanup_fcloop "$(_local_wwnn "$port")" \
+				"$(_local_wwpn "$port")" \
+				"$(_remote_wwnn "$port")" \
+				"$(_remote_wwpn "$port")"
+	fi
 	rmdir "${NVMET_CFS}/ports/${port}"
 }
 
-- 
2.45.2




More information about the Linux-nvme mailing list