Bug 1894103

Summary: mpathpersist doe not clear reservation keys if --param-sark is set to zeroes
Product: Red Hat Enterprise Linux 8 Reporter: Roman Hodain <rhodain>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Lin Li <lilin>
Severity: high Docs Contact:
Priority: high    
Version: 8.2CC: agk, bmarzins, heinzm, jbrassow, knoel, lilin, msnitzer, pbonzini, prajnoha, zkabelac
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: device-mapper-multipath-0.8.4-6.el8 Doc Type: Bug Fix
Doc Text:
Cause: mpathpersist requires a non-zero Service Action Reservation Key when run with the Register and Ignore command Consequence: mpathpersist works differently than sg_persist, which allows Register and Ignore command with a missing or zero valued Service Action Reservation Key Fix: mpathpersist now allow Register and Ignore command with a missing or zero valued Service Action Reservation Key Result: The Register and Ignore command works the same on sg_persist and mpathpersist.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:06:46 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:    
Bug Blocks: 1892576, 1898049    

Description Roman Hodain 2020-11-03 14:48:09 UTC
Description of problem:
When mpathpersist register-ignore is used for unregistering a key, it fails with error:

    Nov 03 14:37:59 | 3600c0ff00050b9fda179aa5e01000000: configured reservation key doesn't match: 0x123aaa
    PR out: command failed

The muletipath is configued with option "reservation_key file"

Version-Release number of selected component (if applicable):
device-mapper-multipath-0.8.3-3.el8.x86_64

How reproducible:
100%

Steps to Reproduce:

Regiter a key:

    # mpathpersist --out --register --param-sark=123456 /dev/mapper/3600c0ff00050b9fda179aa5e01000000

List the keys:
    # mpathpersist -i -k  /dev/mapper/3600c0ff00050b9fda179aa5e01000000
      PR generation=0xbfc, 	4 registered reservation keys follow:
        0x123456
        0x123456
        0x123456
        0x123456

Register another key (not needed, but it shows that the reregistration works)
    # mpathpersist --out --register-ignore --param-sark 123aaa /dev/mapper/3600c0ff00050b9fda179aa5e01000000

List the keys again:
    # mpathpersist -i -k  /dev/mapper/3600c0ff00050b9fda179aa5e01000000
      PR generation=0xc00, 	4 registered reservation keys follow:
        0x123aaa
        0x123aaa
        0x123aaa
        0x123aaa

Reregistrage without registration keys or with zeroes

    # mpathpersist --out --register-ignore --param-sark 000000 /dev/mapper/3600c0ff00050b9fda179aa5e01000000
    Nov 03 14:37:59 | 3600c0ff00050b9fda179aa5e01000000: configured reservation key doesn't match: 0x123aaa
    PR out: command failed

Actual results:
The key is not unregistred and the command fails.

Expected results:
The keys are remove from the device.

Additional info:
The sg_presist commands work as expected with omiting the key also with the 000000 key. This issue causes failure of Microsoft Clusters running as a guest on the hypevisor as qemu uses mpathpersist lib for delegating the requests from the guest. The MS cluster uses register-ignore with zero key for removing the key. This issue affects scsi reservation feature on the layered products.

Comment 2 Ben Marzinski 2020-11-05 19:20:30 UTC
Thanks for the heads up.

Comment 15 Lin Li 2021-01-06 03:46:43 UTC
Reproduced on device-mapper-multipath-0.8.3-3.el8
1,[root@storageqe-05 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.3-3.el8.x86_64
device-mapper-multipath-0.8.3-3.el8.x86_64

2,Edit /etc/multipath.conf 
defaults {
        reservation_key file
}

3,[root@storageqe-05 ~]# multipath -ll
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:1:1 sdg 8:96  active ready running
| `- 4:0:0:1 sdk 8:160 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 3:0:0:1 sdc 8:32  active ready running
  `- 4:0:1:1 sdo 8:224 active ready running

4,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567867
  PR generation=0x0, 	0 registered reservation key.

5,[root@storageqe-05 ~]# mpathpersist --out --register --param-sark=123456 /dev/mapper/360a98000324669436c2b45666c567867

6,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567867  
PR generation=0x4, 	4 registered reservation keys follow:
    0x123456
    0x123456
    0x123456
    0x123456
 
7,[root@storageqe-05 ~]# mpathpersist --out --register-ignore --param-sark 123aaa /dev/mapper/360a98000324669436c2b45666c567867

8,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567867  
PR generation=0x8, 	4 registered reservation keys follow:
    0x123aaa
    0x123aaa
    0x123aaa
    0x123aaa

9,[root@storageqe-05 ~]# mpathpersist --out --register-ignore --param-sark 000000 /dev/mapper/360a98000324669436c2b45666c567867
Jan 05 20:07:38 | 360a98000324669436c2b45666c567867: configured reservation key doesn't match: 0x123aaa
PR out: command failed      
<-------------------------------------the command failed



Verified on device-mapper-multipath-0.8.4-7.el8
1,[root@storageqe-05 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-7.el8.x86_64
device-mapper-multipath-devel-0.8.4-7.el8.x86_64
device-mapper-multipath-0.8.4-7.el8.x86_64

2,Edit /etc/multipath.conf 
defaults {
        reservation_key file
}

3,[root@storageqe-05 ~]# multipath -ll
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
| |- 3:0:1:2 sdh 8:112 active ready running
| `- 4:0:0:2 sdl 8:176 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 3:0:0:2 sdd 8:48  active ready running
  `- 4:0:1:2 sdp 8:240 active ready running


4,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567869
  PR generation=0x0, 	0 registered reservation key.

5,[root@storageqe-05 ~]# mpathpersist --out --register --param-sark=123456 /dev/mapper/360a98000324669436c2b45666c567869

6,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567869  
PR generation=0x4, 	4 registered reservation keys follow:
    0x123456
    0x123456
    0x123456
    0x123456
 
7,[root@storageqe-05 ~]# mpathpersist --out --register-ignore --param-sark 123aaa /dev/mapper/360a98000324669436c2b45666c567869
 
8,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567869  
PR generation=0x8, 	4 registered reservation keys follow:
    0x123aaa
    0x123aaa
    0x123aaa
    0x123aaa

9,[root@storageqe-05 ~]# mpathpersist --out --register-ignore --param-sark 000000 /dev/mapper/360a98000324669436c2b45666c567869

10,[root@storageqe-05 ~]# echo $?
0   <----------------------------the command success

11,[root@storageqe-05 ~]# mpathpersist -i -k  /dev/mapper/360a98000324669436c2b45666c567869  
PR generation=0xc, 	0 registered reservation key.
 <----------------------------mpathpersist  cleared reservation keys if --param-sark is set to zeroes




Test result:mpathpersist now allow Register and Ignore command with a missing or zero valued Service Action Reservation Key

Comment 17 errata-xmlrpc 2021-05-18 15:06:46 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/RHEA-2021:1685

Comment 19 Red Hat Bugzilla 2023-09-15 00:50:38 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days