mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 03:31:26 +00:00
Fix write resuduals handling on data receive error
By default data receive error it should be assumed that no data received, not that all data received as it is currently git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5138 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2028,6 +2028,9 @@ struct scst_cmd {
|
||||
/* Set if cmd was pre-alloced by target driver */
|
||||
unsigned int pre_alloced:1;
|
||||
|
||||
/* Set if scst_cmd_set_write_not_received_data_len() was called */
|
||||
unsigned int write_not_received_set:1;
|
||||
|
||||
/**************************************************************/
|
||||
|
||||
/* cmd's async flags */
|
||||
|
||||
@@ -2943,6 +2943,8 @@ void scst_cmd_set_write_not_received_data_len(struct scst_cmd *cmd,
|
||||
{
|
||||
TRACE_ENTRY();
|
||||
|
||||
cmd->write_not_received_set = 1;
|
||||
|
||||
if (!cmd->expected_values_set) {
|
||||
/*
|
||||
* No expected values set, so no residuals processing.
|
||||
|
||||
@@ -1520,6 +1520,9 @@ void scst_rx_data(struct scst_cmd *cmd, int status,
|
||||
break;
|
||||
|
||||
case SCST_RX_STATUS_ERROR_SENSE_SET:
|
||||
if (!cmd->write_not_received_set)
|
||||
scst_cmd_set_write_not_received_data_len(cmd,
|
||||
cmd->expected_transfer_len);
|
||||
scst_set_cmd_abnormal_done_state(cmd);
|
||||
pref_context = SCST_CONTEXT_THREAD;
|
||||
break;
|
||||
@@ -1528,6 +1531,9 @@ void scst_rx_data(struct scst_cmd *cmd, int status,
|
||||
set_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags);
|
||||
/* go through */
|
||||
case SCST_RX_STATUS_ERROR:
|
||||
if (!cmd->write_not_received_set)
|
||||
scst_cmd_set_write_not_received_data_len(cmd,
|
||||
cmd->expected_transfer_len);
|
||||
scst_set_cmd_error(cmd,
|
||||
SCST_LOAD_SENSE(scst_sense_hardw_error));
|
||||
scst_set_cmd_abnormal_done_state(cmd);
|
||||
@@ -1537,6 +1543,9 @@ void scst_rx_data(struct scst_cmd *cmd, int status,
|
||||
default:
|
||||
PRINT_ERROR("scst_rx_data() received unknown status %x",
|
||||
status);
|
||||
if (!cmd->write_not_received_set)
|
||||
scst_cmd_set_write_not_received_data_len(cmd,
|
||||
cmd->expected_transfer_len);
|
||||
scst_set_cmd_abnormal_done_state(cmd);
|
||||
pref_context = SCST_CONTEXT_THREAD;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user