+++ This bug was initially created as a clone of Bug #2164869 +++ Description of problem: If a multipath device has a SCSI PR registration on some paths, but not all, when multipathd first discovers the device, it doesn't always add registrations to all the paths. Specifically, when multipathd starts up, if there is an existing device with a SCSI PR key registered on only some of the paths, it will not register the PR key to the other paths. This can happen if a new path to a multipath device with a SCSI PR registration appears while multipathd isn't running. Also, if no paths are active when multipathd creates the multipath device, multipathd will not realize that the device has a SCSI PR registration, and will not add registrations to the existing paths, if a new path appears, even if that path does have a SCSI PR key registered to it. Version-Release number of selected component (if applicable): All How reproducible: Always Steps to Reproduce: 1. Add "reservation_key file" to /etc/multipath.conf to set up automatic reservation key tracking. 2. create a multipath device with multiple paths 3. stop multipathd 4. run "mpathpersist -oGS 1234 <multipath_device>" to register the key 1234 to all the multipath device paths, and track the key. 5. run "mpathpersist -ik <multipath_device>" to verify that you see multiple copies of the key "1234" registered. 6. run "sg_persist -oGK 1234 <path_device" to remove the key from one of the paths. 7. run "mpathpersist -ik <multipath_device>" to verify that there is one fewer copies of the key registered. 8. start multipathd 9. run "mpathpersist -ik <multipath_device>" Actual results: The number of copies of the key 1234 registered is one fewer than the number of paths. Expected results: The number of copies of the key 1234 registered is equal to the number of paths. Additional info:
Verified on device-mapper-multipath-0.8.4-39.el8 1. Add "reservation_key file" to /etc/multipath.conf to set up automatic reservation key tracking. [root@storageqe-05 ~]# cat /etc/multipath.conf defaults { user_friendly_names yes find_multipaths yes enable_foreign "^$" reservation_key file } 2. create a multipath device with multiple paths [root@storageqe-05 ~]# multipath -ll 360a98000324669436c2b45666c567869 360a98000324669436c2b45666c567869 dm-5 NETAPP,LUN size=2.0G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw |-+- policy='service-time 0' prio=50 status=active | |- 1:0:0:2 sdl 8:176 active ready running | `- 4:0:1:2 sdh 8:112 active ready running `-+- policy='service-time 0' prio=10 status=enabled |- 1:0:1:2 sdp 8:240 active ready running `- 4:0:0:2 sdd 8:48 active ready running 3.run "mpathpersist -oGS 1234 <multipath_device>" to register the key 1234 to all the multipath device paths, and track the key. [root@storageqe-05 ~]# mpathpersist -oGS 1234 /dev/mapper/360a98000324669436c2b45666c567869 4.run "mpathpersist -ik <multipath_device>" to verify that you see multiple copies of the key "1234" registered. [root@storageqe-05 ~]# mpathpersist -ik /dev/mapper/360a98000324669436c2b45666c567869 PR generation=0x4, 4 registered reservation keys follow: 0x1234 0x1234 0x1234 0x1234 5.stop mulitpathd [root@storageqe-05 ~]# service multipathd stop 6.run "sg_persist -oGK 1234 <path_device" to remove the key from one of the paths. [root@storageqe-05 ~]# sg_persist -oGK 1234 /dev/sdd NETAPP LUN 820a Peripheral device type: disk 7.run "mpathpersist -ik <multipath_device>" to verify that there is one fewer copies of the key registered. [root@storageqe-05 ~]# mpathpersist -ik /dev/mapper/360a98000324669436c2b45666c567869 PR generation=0x6, 3 registered reservation keys follow: 0x1234 0x1234 0x1234 8.start multipathd [root@storageqe-05 ~]# service multipathd restart Redirecting to /bin/systemctl restart multipathd.service 9.run "mpathpersist -ik <multipath_device>" [root@storageqe-05 ~]# mpathpersist -ik /dev/mapper/360a98000324669436c2b45666c567869 PR generation=0xa, 4 registered reservation keys follow: 0x1234 0x1234 0x1234 0x1234 Test result: The number of copies of the key 1234 registered is equal to the number of paths. Redirecting to /bin/systemctl stop multipathd.service