For Offline SSC devices, return NOT_READY/MEDIUM_NOT_PRESENT for opcodes that access the media so that we emulate a tape drive with no tape mounted. See SSC 4 GENERAL CONCEPTS Mounted is the state of a volume when the device is physically capable of processing commands that cause the medium to be moved. A volume is demounted when it is being loaded, threaded, unloaded, unthreaded, or when not attached to the device. Ready is the state of the logical unit when medium access and non-medium access commands may be processed. The logical unit is not ready when no volume is mounted or, from the SCSI initiator device perspective, whenever any medium access command reports CHECK CONDITION status and a NOT READY sense key. regards ronnie sahlberg Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> --- usr/ssc.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/usr/ssc.c b/usr/ssc.c index 8177483..92d6b2c 100644 --- a/usr/ssc.c +++ b/usr/ssc.c @@ -96,6 +96,12 @@ static int ssc_rw(int host_no, struct scsi_cmd *cmd) if (ret) return SAM_STAT_RESERVATION_CONFLICT; + if (cmd->dev->attrs.removable && !cmd->dev->attrs.online) { + key = NOT_READY; + asc = ASC_MEDIUM_NOT_PRESENT; + goto sense; + } + if (cmd->dev->attrs.readonly) { switch (cmd->scb[0]) { case ERASE: -- 1.7.3.1 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html