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:
There was an error in the reproducer instructions. The actual steps are: 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. run "mpathpersist -oGS 1234 <multipath_device>" to register the key 1234 to all the multipath device paths, and track the key. 4. run "mpathpersist -ik <multipath_device>" to verify that you see multiple copies of the key "1234" registered. 5. stop mulitpathd 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>"
Verified on device-mapper-multipath-0.8.7-21.el9 [root@storageqe-05 ~]# rpm -qa | grep multipath device-mapper-multipath-libs-0.8.7-21.el9.x86_64 device-mapper-multipath-0.8.7-21.el9.x86_64 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 reservation_key file } 2. create a multipath device with multiple paths [root@storageqe-05 ~]# multipath -ll 360a98000324669436c2b45666c567867 360a98000324669436c2b45666c567867 dm-4 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 | |- 3:0:0:1 sdk 8:160 active ready running | `- 4:0:1:1 sdg 8:96 active ready running `-+- policy='service-time 0' prio=10 status=enabled |- 3:0:1:1 sdo 8:224 active ready running `- 4:0:0:1 sdc 8:32 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/360a98000324669436c2b45666c567867 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/360a98000324669436c2b45666c567867 PR generation=0x4, 4 registered reservation keys follow: 0x1234 0x1234 0x1234 0x1234 5. stop mulitpathd [root@storageqe-05 ~]# service multipathd stop Redirecting to /bin/systemctl stop multipathd.service 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/sdc 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/360a98000324669436c2b45666c567867 PR generation=0x5, 3 registered reservation keys follow: 0x1234 0x1234 0x1234 8. start multipathd [root@storageqe-05 ~]# service multipathd restart 9. run "mpathpersist -ik <multipath_device>" [root@storageqe-05 ~]# mpathpersist -ik /dev/mapper/360a98000324669436c2b45666c567867 PR generation=0x9, 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.