fence_scsi: fix registration handling if ISID conflicts #529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
ISID (Initiator Session ID) which belongs to I_T Nexus, changes for RHEL based on the session ID that's used for iSCSI connections. This means that the connection to the same device can be set up with different ISID on reconnects.
If an iSCSI client establishes a connection with a device using an ISID (say X) and registers/reserves with the device using a key, the key is associated with the I_T nexus (with ISID X). Now if a device reconnects for some reason (like client reboots), it establishes a new iSCSI connection (with ISID Y) and fence agent tries to register again. However fence_scsi looks up the reservation key for the device, sees that it matches with the key and skips sending a new registration command assuming that the key belongs to it (ignoring the ISID).
Impact:
This can cause the iSCSI initiator to have no access to the device since it is not registered.
Proposed Fix:
To fix this, the agent needs to clear the old registration and register with the device based on what the active state of the registration/reservation is.
Both (1) and (2) are done in accordance with SCSI spec SPC3 - (1) Section 5.6.10.4.3 "Preempting persistent reservations and registration handling" Section and (2) Section 5.6.10.4.4 "Removing registrations".
If the ISID does not change across reboots, the fix has no impact since the preempt will insert a new entry anyway.