Skip to content

Commit

Permalink
nvme: delete all namespaces in _remove_nvmet_subsystem()
Browse files Browse the repository at this point in the history
A subsystem might have more than one namespace, so delete all of them in
_remove_nvmet_subsystem().

This change was to be made before the commit 67e25d7 ("nvme/052: do
not create namespace when setting up the target"), which assumes that
_remove_nvmet_subsystem() delets all namespaces. However, commit order
was modified then the test case nvme/052 now fails without this commit.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[Shin'ichiro: resolved conflicts]
Fixes: 67e25d7 ("nvme/052: do not create namespace when setting up the target")
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
  • Loading branch information
hreinecke authored and kawasaki committed Nov 23, 2024
1 parent 4e22221 commit 83781f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 4 additions & 1 deletion common/nvme
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,10 @@ _remove_nvmet_subsystem() {
local nvmet_subsystem="$1"
local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"

_remove_nvmet_ns "${nvmet_subsystem}" "${def_nsid}"
for n in "${subsys_path}/namespaces/"*; do
[ -d "${n}" ] || continue
_remove_nvmet_ns "${nvmet_subsystem}" "${n##*/}"
done
rm -f "${subsys_path}"/allowed_hosts/*
rmdir "${subsys_path}"
}
Expand Down
5 changes: 0 additions & 5 deletions tests/nvme/016
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_port "${port}"

for ((i = iterations; i > 1; i--)); do
nsid=$((def_nsid + i - 1))
_remove_nvmet_ns "${def_subsysnqn}" "${nsid}"
done

_remove_nvmet_subsystem "${def_subsysnqn}"

echo "Test complete"
Expand Down
5 changes: 0 additions & 5 deletions tests/nvme/017
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_port "${port}"

for ((i = iterations; i > 1; i--)); do
nsid=$((def_nsid + i - 1))
_remove_nvmet_ns "${def_subsysnqn}" "${nsid}"
done

_remove_nvmet_subsystem "${def_subsysnqn}"

rm "$(_nvme_def_file_path)"
Expand Down

0 comments on commit 83781f2

Please sign in to comment.