[PATCH blktests] nvme: delete all namespaces in _remove_nvmet_subsystem()
Yi Zhang
yi.zhang at redhat.com
Thu Nov 21 18:18:08 PST 2024
Tested-by: Yi Zhang <yi.zhang at redhat.com>
On Wed, Nov 20, 2024 at 6:20 PM Shin'ichiro Kawasaki
<shinichiro.kawasaki at wdc.com> wrote:
>
> From: Hannes Reinecke <hare at suse.de>
>
> 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 67e25d71bc58 ("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 at suse.de>
> [Shin'ichiro: resolved conflicts]
> Fixes: 67e25d71bc58 ("nvme/052: do not create namespace when setting up the target")
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
> ---
> This patch is a part of the ANA support work by Hannes. It was once included in
> the first series of the work, but it was dropped from the series to be included
> in the later series [1]. After the second series of the work was applied, Yi
> Zhang found nvme/052 fails [2]. It turned out that this patch is required for
> the one of the patches in the second series, which is the commit 67e25d71bc58
> ("nvme/052: do not create namespace when setting up the target").
>
> Of note is that this patch also prepares for one of the new test cases to be
> included in the third series [3].
>
> [1] https://lore.kernel.org/linux-nvme/20241024010025.2216242-14-shinichiro.kawasaki@wdc.com/
> [2] https://lore.kernel.org/linux-nvme/20241120024925.1397864-1-yi.zhang@redhat.com/
> [3] https://github.com/kawasaki/blktests/commit/31091d116eaea4e7d5ad3cf76e106d1085209c07
>
> common/nvme | 5 ++++-
> tests/nvme/016 | 5 -----
> tests/nvme/017 | 5 -----
> 3 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/common/nvme b/common/nvme
> index 688193b..fd472fe 100644
> --- a/common/nvme
> +++ b/common/nvme
> @@ -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}"
> }
> diff --git a/tests/nvme/016 b/tests/nvme/016
> index dd3cb44..95b0df4 100755
> --- a/tests/nvme/016
> +++ b/tests/nvme/016
> @@ -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"
> diff --git a/tests/nvme/017 b/tests/nvme/017
> index a22c748..3483929 100755
> --- a/tests/nvme/017
> +++ b/tests/nvme/017
> @@ -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)"
> --
> 2.47.0
>
--
Best Regards,
Yi Zhang
More information about the Linux-nvme
mailing list