Bug 2164871

Summary: multipathd doesn't automatically make sure a device with a persistent reservation is registered on all paths
Product: Red Hat Enterprise Linux 8 Reporter: Ben Marzinski <bmarzins>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Lin Li <lilin>
Severity: medium Docs Contact: Apurva Bhide <abhide>
Priority: medium    
Version: 8.7CC: abhide, agk, bmarzins, heinzm, lilin, msnitzer, prajnoha, storage-qe, zkabelac
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: device-mapper-multipath-0.8.4-39.el8 Doc Type: Bug Fix
Doc Text:
.`multipathd` adds the persistent reservation registration key to all paths Previously, when the `multipathd` daemon started and it recognized a registration key for the persistent reservations on one path of an existing multipath device, not all paths of that device had the registration key. As a consequence, if new paths appeared to a multipath device with persistent reservations while `multipathd` was stopped, persistent reservations were not set up on those. This allowed IO processing on the paths, even if they were supposed to be forbidden by the reservation key. With this fix, if `multipathd` finds a persistent reservation registration key on any device path, it adds the key to all active paths. As a result, multipath devices now have persistent reservations set up correctly on all the paths, even if path devices first appear while `multipathd` is not running.
Story Points: ---
Clone Of: 2164869 Environment:
Last Closed: 2023-11-14 15:37:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2164869    
Bug Blocks:    

Description Ben Marzinski 2023-01-26 19:02:03 UTC
+++ 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:

Comment 8 Lin Li 2023-04-24 14:55:52 UTC
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

Comment 16 errata-xmlrpc 2023-11-14 15:37:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (device-mapper-multipath bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:7076