How to clear persistent reservations on Linux

First option is when you have HDLM installed.

Clear reservation(s) with HDLM
dlmpr for Linux exists at least in HDLM Version 5.7 but you have to install HDLM (or extract the file by from the rpm Package)

Clear reservation(s) with Linux native tool
sg_persist (available in the sg3_utils package) can read, set and release reservations.

Example script:

Show actual reservations:
#sg_persist -r /dev/sdh

HITACHI OPEN-V 5009

Peripheral device type: disk

PR generation=0xe, Reservation follows:

Key=0xe0ca9d0a27d92

scope: LU_SCOPE, type: Exclusive Access, registrants only

Set an additional reservation with sg_persist (otherwise sg_persist cannot delete the one set without sg_persist):

#sg_persist --out --register --param-sark=123abc /dev/sdh

Now there are two reservations on the same device:

#sg_persist -i -k /dev/sdh
HITACHI OPEN-V 5009
Peripheral device type: disk
PR generation=0x13, 2 registered reservation keys follow:
0xe0ca9d0a27d92
0x123abc

Clear all reservations:
#sg_persist -C -K 123abc --out /dev/sdh

All reservations are cleared:
#sg_persist -i -k /dev/sdk
HITACHI OPEN-V 5009
Peripheral device type: disk
PR generation=0x10, there are NO registered reservation keys