From: Peter Oberparleiter Date: Tue, 18 Apr 2017 13:12:05 +0200 Subject: [PATCH] chzdev: Fix ineffective zfcp-lun udev rule Enabling an additional FCP LUN for a given FCP device + WWPN combination in the persistent configuration after an FCP LUN was configured for that FCP device but for a different WWPN will create an ineffective udev rule, resulting in that FCP LUN not being enabled during boot. Example: chzdev -e -p zfcp-lun 0x0000:0x0000000000000000:0x0000000000000000 chzdev -e -p zfcp-lun 0x0000:0x0000000000000001:0x0000000000000000 chzdev -e -p zfcp-lun 0x0000:0x0000000000000000:0x0000000000000001 In this example, the FCP LUN identified by 0x0000:0x0000000000000000:0x0000000000000001 will not be enabled during boot, despite it being shown as persistently configured by lszdev. The reason for this issue is that the function that writes the udev rule relies on the list of rules being sorted, which is not the case in the scenario desribed above. Fix this by sorting the list before writing out the udev rule. Signed-off-by: Peter Oberparleiter --- zdev/src/udev_zfcp_lun.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zdev/src/udev_zfcp_lun.c b/zdev/src/udev_zfcp_lun.c --- a/zdev/src/udev_zfcp_lun.c +++ b/zdev/src/udev_zfcp_lun.c @@ -487,6 +487,8 @@ static exit_code_t write_luns_rule(const char *path, struct util_list *list) char *hba_id; struct setting *s; + sort_zfcp_lun_list(list); + node = util_list_start(list); if (!node) return EXIT_INTERNAL_ERROR; -- 2.10.2