libmultipath: nvme: fix path detection for kernel 4.16
authorMartin Wilck <mwilck@suse.com>
Fri, 14 Sep 2018 12:50:59 +0000 (14:50 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 7 Oct 2018 07:52:06 +0000 (09:52 +0200)
commit7b477629a3c76c138831183321be845545f985cf
tree6e5fe10f8c2200c5cfd44545bcf9e57e34043560
parenta61994d58d1e6d79977a8d9ce1a1bb31bea01d80
libmultipath: nvme: fix path detection for kernel 4.16

The path detection logic of the NVMe code relies on the "slaves"
symlinks from NVMe subsys to controllers in sysfs, which have
been removed in the 4.16 kernel.

With this patch, we use the symlinks on the NVMe subsys level
instead.

Example: a multipathed NVMe subsystem with 2 controllers:

/sys/devices/virtual/nvme-subsystem/nvme-subsys2/nvme2n1
/sys/devices/virtual/nvme-fabrics/ctl/nvme2/nvme2c6n1
/sys/devices/virtual/nvme-fabrics/ctl/nvme3/nvme2c8n1

The controllers are found from the subsystem like this:

/sys/devices/virtual/nvme-subsystem/nvme-subsys2/nvme2 ->
    ../../nvme-fabrics/ctl/nvme2
/sys/devices/virtual/nvme-subsystem/nvme-subsys2/nvme3 ->
    ../../nvme-fabrics/ctl/nvme3

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/foreign/nvme.c