What is Persistent Reservation from OS Perspective

Hi mate,

Good day!

 

If you search Persistent Reservation from internet, we can see couple of articles provided by various storage company.
But if you already looked into this msdn blog article, I assume you are seeking something inside the host OS.
And I hope this article can make sense for you :).

 

Part I. What is Reservation?

 

Reservations may be used to allow a storage array to process commands from a selected set of connections and reject commands from connections outside the selected set. The storage array uniquely identifies connections using protocol specific mechanisms. The reserve command is not something new in SCSI-3, it has existed since at least 1985.

 

Part II. What is Persistent Reservation?

 

Hosts may add or remove connections from the selected set using reservation commands. If the hosts do not cooperate in the reservation protocol, data may be unexpectedly modified and deadlock conditions as well as corruptions may occur.

The persistent reservations mechanism allows multiple hosts communicating through multiple connections to preserve reservation operations across SCSI initiator device failures, which usually involve logical unit resets and involve connection losses.

Persistent reservations shall be retained by the array until released, preempted, or cleared by mechanisms defined in this standard.

 

Part III. Persistent Reservation Architecture

 

1 Reservation Key

 

Before a persistent reservation may be established, host shall register a reservation key for connections with the storage array.
Reservation keys allow:

a) authentication of subsequent persistent reservation commands;
b) identification of other connections that are registered;
c) identification of the reservation key(s) that have an associated persistent reservation;
d) preemption of a persistent reservation from a failing or uncooperative connection; and
e) multiple connections to participate in a persistent reservation.

 

Multiple initiator ports may use the same reservation key value for a logical unit accessed through the same target ports.
An initiator port may use the same reservation key value for a logical unit accessed through different target ports.
The logical unit shall maintain a separate reservation key for each connection, regardless of the reservation key’s value.

 

2 Reservation Commands

 

Persistent Reservation uses 2 commands PERSISTENT RESERVE OUT and PERSISTENT RESERVE IN command to provide the basic mechanism for dynamic contention resolution in systems with multiple initiator ports accessing a logical unit.

 

PERSISTENT RESERVE OUT command uses the Reservation Key to register an connection, to verify the connection being used for the PERSISTENT RESERVE OUT command is registered, and to specify which registrations or persistent reservation to preempt.
PERSISTENT RESERVE IN command uses the Reservation Key to identify which connections are registered and which connection, if any, holds the persistent reservation.

 

3 Operation Status

 

Commands from connections holding a reservation should complete normally.
The behavior of commands from registered connections should be withing the following 2 status:

 

a) allowed: Commands received from connections not holding the reservation or from connections not registered if a registrants only or all registrants type persistent reservation is present should complete normally.
b) conflict: Commands received from connections not holding the reservation or from connections not registered if a registrants only or all registrants type persistent reservation is present shall not be performed and the array shall complete the command with RESERVATION CONFLICT status.

 

 

More Reference: T10 spc4r37