Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1515881 - udev builtin path_id not allowing display of all iscsi paths in /dev/disk/by-path [NEEDINFO]
Summary: udev builtin path_id not allowing display of all iscsi paths in /dev/disk/by-...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.4
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-21 14:29 UTC by John Pittman
Modified: 2019-04-09 16:24 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
jpittman: needinfo? (harald)
jpittman: needinfo? (harald)


Attachments (Terms of Use)

Description John Pittman 2017-11-21 14:29:34 UTC
Description of problem:

The udev builtin, path_id, is not allowing all paths of iscsi connections to be displayed in the /dev/disk/by-path directory.  

Version-Release number of selected component (if applicable):

kernel-3.10.0-693.5.2.el7.x86_64
systemd-219-42.el7.4.x86_64
iscsi-initiator-utils-6.2.0.874-4.el7.x86_64

Reproduction and proposed solution:

- Connect through multiple static ifaces, producing multiple paths to same lun:

[root@localhost ~]# iscsiadm -m iface -I iscsi-ens3 -o new
[root@localhost ~]# iscsiadm -m iface -I iscsi-ens3 -o update -n iface.net_ifacename -v ens3
[root@localhost ~]# iscsiadm -m iface -I iscsi-ens12 -o new
[root@localhost ~]# iscsiadm -m iface -I iscsi-ens12 -o update -n iface.net_ifacename -v ens12
[root@localhost ~]# iscsiadm -m discovery -t st -p 192.168.124.12 -I iscsi-ens3 -I iscsi-ens12 --login

[root@localhost ~]# iscsiadm -m session -P 3 | egrep 'Current Portal|Iface Name|Iface IPaddress|Iface Netdev|scsi disk'
        Current Portal: 192.168.124.12:3260,1
                Iface Name: iscsi-ens3
                Iface IPaddress: 192.168.124.240
                Iface Netdev: ens3
                        Attached scsi disk sdd          State: running
                Iface Name: iscsi-ens12
                Iface IPaddress: 192.168.124.186
                Iface Netdev: ens12
                        Attached scsi disk sde          State: running

[root@localhost ~]# multipath -ll
mpatha (36001405718d1480ebcb4015b5bc3034a) dm-3 LIO-ORG ,lun0            
size=1020M features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 20:0:0:0 sdd 8:64 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 21:0:0:0 sde 8:48 active ready running

- Verify that all paths are not presented in /dev/disk/by-path:

[root@localhost ~]# ls -lah /dev/disk/by-path | egrep 'sde|sdd'
lrwxrwxrwx. 1 root root   9 Nov 20 15:18 ip-192.168.124.12:3260-iscsi-iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.f3618f5b946b-lun-0 -> ../../sde
 
- Apply the below patch.  Adding the parent sysname makes each path/session have a unique path_id, which, in turn, allows the udev rule in /lib/udev/rules.d/60-persistent-storage.rules to display a by-path link for each actual path.
 
[john@dhcp145-120 systemd-219]$ git diff
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index a3b019b..07d837a 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -331,7 +331,7 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **
         }
 
         format_lun_number(parent, &lun);
-        path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun);
+        path_prepend(path, "ip-%s:%s-iscsi-%s-%s-%s", addr, port, target, lun, udev_device_get_sysname(parent));
         if (lun)
                 free(lun);
 out:
 
- After applying patch, verify results:
 
[root@localhost ~]# iscsiadm -m session -P 3 | egrep 'Current Portal|Iface Name|Iface IPaddress|Iface Netdev|scsi disk'
        Current Portal: 192.168.124.12:3260,1
                Iface Name: iscsi-ens3
                Iface IPaddress: 192.168.124.240
                Iface Netdev: ens3
                        Attached scsi disk sde          State: running
                Iface Name: iscsi-ens12
                Iface IPaddress: 192.168.124.186
                Iface Netdev: ens12
                        Attached scsi disk sdd          State: running

[root@localhost ~]# multipath -ll
mpatha (36001405718d1480ebcb4015b5bc3034a) dm-3 LIO-ORG ,lun0            
size=1020M features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 20:0:0:0 sde 8:64 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 21:0:0:0 sdd 8:48 active ready running

[root@localhost ~]# ls -lah /dev/disk/by-path | egrep 'sde|sdd'
lrwxrwxrwx. 1 root root   9 Nov 20 16:50 ip-192.168.124.12:3260-iscsi-iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.f3618f5b946b-lun-0-20:0:0:0 -> ../../sde
lrwxrwxrwx. 1 root root   9 Nov 20 16:50 ip-192.168.124.12:3260-iscsi-iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.f3618f5b946b-lun-0-21:0:0:0 -> ../../sdd

Actual results:

All paths of iscsi connections are not displayed in /dev/disk/by-path

Expected results:

There should be a link in /dev/disk/by-path for each unique path/session to the iscsi target/lun.

Comment 2 John Pittman 2017-11-21 14:51:09 UTC
Patch proposal submitted upstream at https://github.com/systemd/systemd/pull/7409


Note You need to log in before you can comment on or make changes to this bug.