Hello,
Thanks for the patch but we sent similar solution recently, see:
https://lore.kernel.org/linux-raid/20210115152824.51793-1-
oleksandr.shchirskyi@xxxxxxxxx/
For namespaces exposed via nvme-subsystem, autorebuild scenarios won't
work because /dev/disk/by-path link doesn't exist.
Our patch fixes mdadm --detail-platform output additionally, this part is
missed here.
Mariusz
On 05.02.2021 08:11, Lidong Zhong wrote:
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@xxxxxxxx>
Reported-by: David Chang <david.chang@xxxxxxx>
---
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;
}