linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] super-intel: correctly recognize NVMe device during assemble
@ 2021-02-05  7:11 Lidong Zhong
  2021-02-05  9:17 ` Tkaczyk, Mariusz
  0 siblings, 1 reply; 3+ messages in thread
From: Lidong Zhong @ 2021-02-05  7:11 UTC (permalink / raw)
  To: jes; +Cc: linux-raid, david.chang

We had a customer report the following error while assembling the raid
device, which is created from Intel VMD configuration of RBSU(bios).
> sudo /sbin/mdadm -v --incremental --export /dev/nvme0n1 --offroot
/dev/disk/by-id/nvme-eui.355634304e2000530025384500000001
/dev/disk/by-id/nvme-MZXL5800HBHQ-000H3_S5V4NE0N200053
[sudo] password for root:
mdadm: /dev/nvme0n1 is not attached to Intel(R) RAID controller.
mdadm: No OROM/EFI properties for /dev/nvme0n1
mdadm: no RAID superblock on /dev/nvme0n1

It's because in function path_attached_to_hba(), the string of disk
doesn't match hba and thus it fails to be recognized as a valid device.
The following is the debug output with this patch applied.
mdadm: hba: /sys/devices/pci0000:c0/0000:c0:00.5/pci10002:00 - disk:
/sys/devices/virtual/nvme-subsystem/nvme-subsys0
mdadm: NVME:tmp_path:
/sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0
mdadm: NVME:tmp_path:
/sys/devices/virtual/nvme-subsystem/nvme-subsys0/nvme0 - real_disk_path:
/sys/devices/pci0000:c0/0000:c0:00.5/pci10002:00/10002:00:04.0/10002:03:00.0/nvme/nvme0

Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
Reported-by: David Chang <david.chang@hpe.com>
---
 platform-intel.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/platform-intel.c b/platform-intel.c
index f1f6d4c..e3c12a3 100644
--- a/platform-intel.c
+++ b/platform-intel.c
@@ -707,6 +707,17 @@ int path_attached_to_hba(const char *disk_path, const char *hba_path)
 		rc = 1;
 	else
 		rc = 0;
+	if (0 == rc && strstr(disk_path, "nvme-subsys")) {
+		char tmp_path[PATH_MAX], *real_disk_path;
+		int len = strlen(disk_path);
+		snprintf(tmp_path,"%s/nvme%c",disk_path, disk_path[len-1]);
+		real_disk_path = realpath(tmp_path, NULL);
+		if (real_disk_path) {
+			if (strncmp(real_disk_path, hba_path, strlen(hba_path)) == 0)
+				rc = 1;
+			free(real_disk_path);
+		}
+    }
 
 	return rc;
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-07  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05  7:11 [RFC PATCH] super-intel: correctly recognize NVMe device during assemble Lidong Zhong
2021-02-05  9:17 ` Tkaczyk, Mariusz
2021-02-07  3:35   ` Zhong Lidong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).