[PATCH blktests v1 1/1] nvme: Introduce nvmet_target_{setup/cleanup} common code

Daniel Wagner dwagner at suse.de
Fri Aug 18 05:10:02 PDT 2023


> +_nvmet_target_cleanup() {
> +	local ports
> +	local port
> +	local blkdev
> +
> +	_get_nvmet_ports "${def_subsysnqn}" ports
> +
> +	for port in "${ports[@]}"; do
> +		_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
> +	done
> +	_remove_nvmet_subsystem "${def_subsysnqn}"
> +	_remove_nvmet_port "${port}"

_remove_nvmet_port should be also be part of the loop.

> +	_remove_nvmet_host "${def_hostnqn}"
> +
> +	blkdev="$(losetup -l | awk '$6 == "'"${def_file_path}"'" { print $1 }')"
> +	if [[ -n "${blkdev}" ]] ; then
> +		losetup -d "${blkdev}"
> +	fi
> +	rm "${def_file_path}"
> +}
> +



More information about the Linux-nvme mailing list