Serving commands, whose expected data len is less, than maximum, fixed. Particularly, it affected READ CAPACITY(16) from Linux initiators

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@26 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2006-11-02 12:10:53 +00:00
parent 10f5c77231
commit 40d6dbbe6c
3 changed files with 17 additions and 8 deletions

View 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",

View 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;
}

View 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) &&