Blob Blame History Raw
---
 libmultipath/discovery.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Index: multipath-tools-130222/libmultipath/discovery.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/discovery.c
+++ multipath-tools-130222/libmultipath/discovery.c
@@ -889,7 +889,7 @@ nvme_sysfs_pathinfo (struct path * pp)
 {
 	struct udev_device *parent;
 	const char *attr_path = NULL;
-
+	const char *attr;
 
 	attr_path = udev_device_get_sysname(pp->udev);
 	if (!attr_path)
@@ -902,10 +902,17 @@ nvme_sysfs_pathinfo (struct path * pp)
 	pp->sg_id.channel = 0;
 	pp->sg_id.lun = 0;
 
-	parent = udev_device_get_parent(pp->udev);
+	parent = udev_device_get_parent_with_subsystem_devtype(pp->udev,
+							       "nvme", NULL);
 	if (!parent)
 		return 1;
 
+	attr = udev_device_get_sysattr_value(pp->udev, "nsid");
+	pp->sg_id.lun = attr ? atoi(attr) : 0;
+
+	attr = udev_device_get_sysattr_value(parent, "cntlid");
+	pp->sg_id.channel = attr ? atoi(attr) : 0;
+
 	snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME");
 	snprintf(pp->product_id, PATH_PRODUCT_SIZE, "%s",
 		 udev_device_get_sysattr_value(parent, "model"));