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 Jun 28, 2023 / 10:24, Sagi Grimberg wrote:
> 
> > > Yi,
> > > 
> > > Do you have hostnqn and hostid files in your /etc/nvme directory?
> > > 
> > 
> > No, only one discovery.conf there.
> > 
> > # ls /etc/nvme/
> > discovery.conf
> 
> So the hostid is generated every time if it is not passed.
> We should probably revert the patch and add it back when
> blktests are passing.

I also observe the many failures of blktests nvme test group test cases using
kernel on the nvme-6.5 branch at git hash 99160af413b4. I see many kernel
messages "nvme_fabrics: found same hostid XXX but different hostnqn YYY". So the
commit ae8bd606e09b ("nvme-fabrics: prevent overriding of existing host") looks
the trigger.

I looked in nvme-cli code. When it generates hostnqn, it does not set hostid.
A quick dirty patch below for nvme-cli avoided the failures for nvme_trtype=loop
condition. If this is the fix approach, the kernel commit will need
corresponding change in the nvme-cli side.


diff --git a/fabrics.c b/fabrics.c
index ac240cad..f1981206 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -753,8 +753,13 @@ 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) {
+		char *uuid;
 		hostnqn = hnqn = nvmf_hostnqn_generate();
+		uuid = strstr(hostnqn, "uuid:");
+		if (uuid)
+			hostid = hid = strdup(uuid + strlen("uuid:"));
+	}
 	if (!hostid)
 		hostid = hid = nvmf_hostid_from_file();
 	h = nvme_lookup_host(r, hostnqn, hostid);
@@ -966,8 +971,13 @@ int nvmf_connect(const char *desc, int argc, char **argv)
 
 	if (!hostnqn)
 		hostnqn = hnqn = nvmf_hostnqn_from_file();
-	if (!hostnqn)
+	if (!hostnqn) {
+		char *uuid;
 		hostnqn = hnqn = nvmf_hostnqn_generate();
+		uuid = strstr(hostnqn, "uuid:");
+		if (uuid)
+			hostid = hid = strdup(uuid + strlen("uuid:"));
+	}
 	if (!hostid)
 		hostid = hid = nvmf_hostid_from_file();
 	h = nvme_lookup_host(r, hostnqn, hostid);







[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