Serving commands, whose expected data len is less, than maximum, fixed. Particularly...
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 2 Nov 2006 12:10:53 +0000 (12:10 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 2 Nov 2006 12:10:53 +0000 (12:10 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@26 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_cdbprobe.h
scst/src/scst_lib.c
scst/src/scst_targ.c

index f16a630..ad56345 100644 (file)
@@ -385,8 +385,8 @@ static const struct scst_sdbops scst_scsi_op_table[] = {
         SCST_DATA_WRITE, 4, SCST_UNKNOWN_LENGTH, 1, 0},        /*N2! */
        {0x93, " M              ", "ERASE(16)",
         SCST_DATA_NONE, 0, SCST_LONG_TIMEOUT, 0, 0},
-       {0x9E, "M               ", "SERVICE ACTION IN",
-        SCST_DATA_READ, 4, 0, 0, 0},
+       {0x9E, "O               ", "SERVICE ACTION IN",
+        SCST_DATA_READ, 0, 0, 0, 0},
 
        /* 12-bytes length CDB */
        {0xA0, "VVVVVVVVVV  M   ", "REPORT LUN",
index 43497c3..d87dcdd 100644 (file)
@@ -1485,9 +1485,8 @@ int scst_get_cdb_info(const uint8_t *cdb_p, int dev_type,
                }
        }
        if (!info_p->transfer_len) {
-               TRACE(TRACE_SCSI,
-                     "Warning! transfer_len 0, direction %d change on " "%d",
-                     info_p->direction, SCST_DATA_NONE);
+               TRACE_DBG("Warning! transfer_len 0, direction %d change on %d",
+                       info_p->direction, SCST_DATA_NONE);
                info_p->direction = SCST_DATA_NONE;
        }
 
index 26e9ef0..b90bf64 100644 (file)
@@ -374,15 +374,25 @@ static int scst_parse_cmd(struct scst_cmd *cmd)
                TRACE_DBG("Dev handler %s parse() returned %d",
                        dev->handler->name, state);
 
-               if (cmd->data_len == -1)
-                       cmd->data_len = cmd->bufflen;
-
                if (state == SCST_CMD_STATE_DEFAULT)
                        state = SCST_CMD_STATE_PREPARE_SPACE;
        }
        else
                state = SCST_CMD_STATE_PREPARE_SPACE;
 
+       if (scst_cmd_is_expected_set(cmd)) {
+               if (cmd->expected_transfer_len < cmd->bufflen) {
+                       TRACE(TRACE_SCSI, "cmd->expected_transfer_len(%d) < "
+                               "cmd->bufflen(%d), using expected_transfer_len "
+                               "instead", cmd->expected_transfer_len,
+                               cmd->bufflen);
+                       cmd->bufflen = cmd->expected_transfer_len;
+               }
+       }
+
+       if (cmd->data_len == -1)
+               cmd->data_len = cmd->bufflen;
+
 #ifdef EXTRACHECKS
        if (state != SCST_CMD_STATE_NEED_THREAD_CTX) {
                if (((cmd->data_direction == SCST_DATA_UNKNOWN) &&