[PATCH blktests 5/7] nvme: delete all ana_groups when removing a port
Chaitanya Kulkarni
chaitanyak at nvidia.com
Mon Dec 2 20:58:18 PST 2024
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> 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>
instead of local variable a it could be something meaningful ..
irrespective of that :-
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>
-ck
> ---
> 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() {
More information about the Linux-nvme
mailing list