[bug report] most of blktests nvme/ failed on the latest linux tree

Daniel Wagner dwagner at suse.de
Wed Jul 5 02:11:39 PDT 2023


On Fri, Jun 30, 2023 at 08:48:55AM +0000, Shinichiro Kawasaki wrote:
> diff --git a/fabrics.c b/fabrics.c
> index ac240cad..2eeea48c 100644
> --- a/fabrics.c
> +++ b/fabrics.c
> @@ -677,6 +677,26 @@ static int nvme_read_volatile_config(nvme_root_t r)
>  	return ret;
>  }
>  
> +char *nvmf_hostid_from_hostnqn(const char *hostnqn)
> +{
> +	const char *uuid;
> +	const char *hostid_from_file;
> +
> +	if (!hostnqn)
> +		return NULL;
> +
> +	uuid = strstr(hostnqn, "uuid:");
> +	if (!uuid)
> +		return NULL;
> +	uuid += strlen("uuid:");
> +
> +	hostid_from_file = nvmf_hostid_from_file();
> +	if (hostid_from_file && strcmp(uuid, hostid_from_file))
> +		fprintf(stderr, "warning: use generated hostid instead of hostid file\n");
> +
> +	return strdup(uuid);
> +}

Maybe we should move the check after ...


>  int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
>  {
>  	char *subsysnqn = NVME_DISC_SUBSYS_NAME;
> @@ -753,8 +773,10 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
>  	hostid_arg = hostid;
>  	if (!hostnqn)
>  		hostnqn = hnqn = nvmf_hostnqn_from_file();
> -	if (!hostnqn)
> +	if (!hostnqn) {
>  		hostnqn = hnqn = nvmf_hostnqn_generate();
> +		hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
> +	}
>  	if (!hostid)
>  		hostid = hid = nvmf_hostid_from_file();

... here so that we also catch the case when the /etc/nvme/hostnqn and /etc/nvme/hostid
do not match



More information about the Linux-nvme mailing list