[stgt] [PATCH 2/2] SSC: Add offline/medium-not-present support

Ronnie Sahlberg ronniesahlberg at gmail.com
Thu Jan 26 01:23:43 CET 2012

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.

  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.

ronnie sahlberg

Signed-off-by: Ronnie Sahlberg <ronniesahlberg at gmail.com>
 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)
+	if (cmd->dev->attrs.removable && !cmd->dev->attrs.online) {
+		key = NOT_READY;
+		goto sense;
+	}
 	if (cmd->dev->attrs.readonly) {
 		switch (cmd->scb[0]) {
 		case ERASE:

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list