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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux