Linux-Raid Archives on lore.kernel.org
 help / color / 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	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] super-intel: correctly recognize NVMe device during assemble
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Tkaczyk, Mariusz @ 2021-02-05  9:17 UTC (permalink / raw)
  To: Lidong Zhong, jes; +Cc: linux-raid, david.chang, Shchirskyi, Oleksandr

Hello,
Thanks for the patch but we sent similar solution recently, see:
https://lore.kernel.org/linux-raid/20210115152824.51793-1-
oleksandr.shchirskyi@intel.com/
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@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;
>   }
>

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

* Re: [RFC PATCH] super-intel: correctly recognize NVMe device during assemble
  2021-02-05  9:17 ` Tkaczyk, Mariusz
@ 2021-02-07  3:35   ` Zhong Lidong
  0 siblings, 0 replies; 3+ messages in thread
From: Zhong Lidong @ 2021-02-07  3:35 UTC (permalink / raw)
  To: Tkaczyk, Mariusz, jes; +Cc: linux-raid, david.chang, Shchirskyi, Oleksandr

Hi Mariusz,

Sorry I didn't pay attention to the patch you sent to the list and thank
you for letting me know the situation. Please ignore my patch then.

Regards,
Lidong

On 2/5/21 5:17 PM, Tkaczyk, Mariusz wrote:
> Hello,
> Thanks for the patch but we sent similar solution recently, see:
> https://lore.kernel.org/linux-raid/20210115152824.51793-1-
> oleksandr.shchirskyi@intel.com/
> 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@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;
>>   }
>>
> 


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

end of thread, back to index

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

Linux-Raid Archives on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-raid/0 linux-raid/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-raid linux-raid/ https://lore.kernel.org/linux-raid \
		linux-raid@vger.kernel.org
	public-inbox-index linux-raid

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-raid


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git