teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0429-udev-path_id-introduce-support-for-NVMe-devices-4169.patch

803fb7
From ee5aadde983315e72a82241dee95c0e041af15f4 Mon Sep 17 00:00:00 2001
803fb7
From: Michal Sekletar <msekleta@redhat.com>
803fb7
Date: Fri, 6 Jan 2017 17:30:53 +0100
803fb7
Subject: [PATCH] udev/path_id: introduce support for NVMe devices (#4169)
803fb7
803fb7
This appends the nvme name and namespace identifier attribute the the
803fb7
PCI path for by-path links. Symlinks like the following are now present:
803fb7
803fb7
lrwxrwxrwx. 1 root root 13 Sep 16 12:12 pci-0000:01:00.0-nvme-1 -> ../../nvme0n1
803fb7
lrwxrwxrwx. 1 root root 15 Sep 16 12:12 pci-0000:01:00.0-nvme-1-part1 -> ../../nvme0n1p1
803fb7
803fb7
Cc: Michal Sekletar <sekletar.m@gmail.com>
803fb7
Signed-off-by: Keith Busch <keith.busch@intel.com>
803fb7
803fb7
Cherry-picked from: b4c6f71b827d41a4af8007b735edf21ef7609f99
803fb7
Resolves: #1373150
803fb7
---
803fb7
 src/udev/udev-builtin-path_id.c | 9 +++++++++
803fb7
 1 file changed, 9 insertions(+)
803fb7
803fb7
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
803fb7
index a3b019bfc..88a812ff5 100644
803fb7
--- a/src/udev/udev-builtin-path_id.c
803fb7
+++ b/src/udev/udev-builtin-path_id.c
803fb7
@@ -709,6 +709,15 @@ restart:
803fb7
                         parent = skip_subsystem(parent, "scm");
803fb7
                         supported_transport = true;
803fb7
                         supported_parent = true;
803fb7
+                } else if (streq(subsys, "nvme")) {
803fb7
+                        const char *nsid = udev_device_get_sysattr_value(dev, "nsid");
803fb7
+
803fb7
+                        if (nsid) {
803fb7
+                                path_prepend(&path, "nvme-%s", nsid);
803fb7
+                                parent = skip_subsystem(parent, "nvme");
803fb7
+                                supported_parent = true;
803fb7
+                                supported_transport = true;
803fb7
+                        }
803fb7
                 }
803fb7
 
803fb7
                 parent = udev_device_get_parent(parent);