[PATCH blktests 5/7] nvme: delete all ana_groups when removing a port
Shin'ichiro Kawasaki
shinichiro.kawasaki at wdc.com
Fri Nov 29 05:26:15 PST 2024
From: Hannes Reinecke <hare at suse.de>
A port might have several ANA groups, and we have to remove all
ANA groups with a group id other than 1, otherwise we cannot
remove the port itself.
Signed-off-by: Hannes Reinecke <hare at suse.de>
[Shin'ichiro: fixed shellcheck warning]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
common/nvme | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/common/nvme b/common/nvme
index dfd9876..8bce403 100644
--- a/common/nvme
+++ b/common/nvme
@@ -491,6 +491,8 @@ _setup_nvmet_port_ana() {
_remove_nvmet_port() {
local port="$1"
+ local cfsport="${NVMET_CFS}/ports/${port}"
+ local a
if [[ "${nvme_trtype}" == "fc" ]]; then
_nvme_fcloop_del_tport "$(_remote_wwnn "$port")" \
@@ -499,7 +501,11 @@ _remove_nvmet_port() {
"$(_remote_wwnn "$port")" \
"$(_remote_wwpn "$port")"
fi
- rmdir "${NVMET_CFS}/ports/${port}"
+ for a in "${cfsport}/ana_groups/"*; do
+ [[ "${a##*/}" == "1" ]] && continue
+ rmdir "${a}"
+ done
+ rmdir "${cfsport}"
}
_create_nvmet_ns() {
--
2.47.0
More information about the Linux-nvme
mailing list