Allows the caller to force a SCSI device to release all current reservations, clear all current commands, and return to an initial state.
The SCIORESET operation allows the caller to force a SCSI device to release all current reservations, clear all current commands, and return to an initial state. This operation is used by system management routines to force a SCSI controller to release a competing SCSI initiator's reservation in a multi-initiator environment.
This operation actually executes a SCSI bus device reset (BDR) message to the selected SCSI controller on the selected adapter. The BDR message is directed to a SCSI ID. Therefore, all logical unit numbers (LUNs) associated with that SCSI ID are affected by the execution of the BDR.
For the operation to work effectively, a SCSI Reserve command should be issued after the SCIORESET operation through the appropriate SCSI device driver. Typically, the SCSI device driver open logic issues a SCSI Reserve command. This prevents another initiator from claiming the device.
There is a finite amount of time between the release of all reservations (by a SCIORESET operation) and the time the device is again reserved (by a SCSI Reserve command from the host). During this interval, another SCSI initiator can reserve the device instead. If this occurs, the SCSI Reserve command from this host fails and the device remains reserved by a competing initiator. The capability needed to prevent or recover from this event is beyond the SCSI adapter device driver and SCSI device driver components.
The arg parameter to the SCIORESET operation allows the caller to specify the SCSI ID of the device to be reset. The least significant byte in the arg parameter is the LUN ID of the LUN on the SCSI controller. The device indicated by the LUN ID should have been successfully started by a call to the SCIOSTART operation. The next least significant byte is the SCSI ID. The remaining two bytes are reserved and must be set to a value of 0.
open SCSI adapter device driver SCIOSTART SCSI ID=1, LUN=0 SCIORESET SCSI ID=1, LUN=0 (to free any reservations) SCIOSTOP SCSI ID=1, LUN=0 close SCSI adapter device driver open SCSI device driver (normal open) for SCSI ID=1, LUN=0 ... Use device as normal ...
open SCSI device driver (with SC_FORCED_OPEN flag) for SCSI ID=1, LUN=0 ...Use the device as normal.
Both examples assume that the SCSI device driver open call executes a SCSI Reserve command on the selected device.
The SCSI adapter device driver performs normal error-recovery procedures during execution of this command. For example, if the BDR message causes the SCSI bus to hang, a SCSI bus reset will be initiated to clear the condition.
When completed successfully, this operation returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to one of the following values:
The rmt SCSI device driver, scdisk SCSI device driver, SCSI Adapter device driver.