[PATCH blktests 1/2] nvme: Add _setup_nvmet_port_marginal

John Meneghini jmeneghi at redhat.com
Wed Aug 12 12:03:00 PDT 2026


Good job Jesse. These tests work!

Reviewed-by: John Meneghini <jmeneghi at redhat.com>
Tested-by: John Meneghini <jmeneghi at redhat.com>

On 8/12/26 13:45, Jesse Taube wrote:
> Adds functionality to set up a NVME port in marginal state.
> This is useful for testing the behavior of the NVME driver when a port
> is in a marginal state.
> 
> Signed-off-by: Jesse Taube <jtaubepe at redhat.com>
> ---
>   common/nvme | 30 ++++++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)
> 
> diff --git a/common/nvme b/common/nvme
> index f399937..d389e18 100644
> --- a/common/nvme
> +++ b/common/nvme
> @@ -153,6 +153,15 @@ _nvme_fcloop_add_tport() {
>   	echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/add_target_port
>   }
>   
> +_nvme_fcloop_set_rport_marginal() {
> +	local wwnn="$1"
> +	local wwpn="$2"
> +	local marginal="$3"
> +	local loopctl=/sys/class/fcloop/ctl
> +
> +	echo "wwnn=${wwnn},wwpn=${wwpn},marginal=${marginal}" > ${loopctl}/set_marginal_rport
> +}
> +
>   _nvme_fcloop_del_rport() {
>   	local local_wwnn="$1"
>   	local local_wwpn="$2"
> @@ -763,6 +772,27 @@ _create_nvmet_port() {
>   	echo "${port}"
>   }
>   
> +_setup_nvmet_port_marginal() {
> +	local -i port="$1"
> +	local state="${2}"
> +
> +	if [[ ! "${nvme_trtype}" == "fc" ]]; then
> +		echo "FAIL _setup_nvmet_port_marginal() only supports fc transport"
> +		exit 1
> +	fi
> +
> +	if [[ "${state}" == "live" ]]; then
> +		_nvme_fcloop_set_rport_marginal "$(_remote_wwnn $port)" \
> +					"$(_remote_wwpn $port)" 0
> +	elif [[ "${state}" == "marginal" ]]; then
> +		_nvme_fcloop_set_rport_marginal "$(_remote_wwnn $port)" \
> +					"$(_remote_wwpn $port)" 1
> +	else
> +		echo "FAIL _setup_nvmet_port_marginal() invalid state: ${state}"
> +		exit 1
> +	fi
> +}
> +
>   _setup_nvmet_port_ana() {
>   	local port="$1"
>   	local anagrpid="${2:-$def_anagrpid}"




More information about the Linux-nvme mailing list