mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 09:41:54 +09:00
tcm_loop: Set residual field for SCSI commands
commit 6cf3fa6918 upstream.
If the target core signals an over- or under-run, tcm_loop should call
scsi_set_resid() to tell the SCSI midlayer about the residual data length.
The difference can be seen by doing something like
strace -eioctl sg_raw -r 1024 /dev/sda 8 0 0 0 1 0 > /dev/null
and looking at the "resid=" part of the SG_IO ioctl -- after this patch,
the field is correctly reported as 512.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bb4b47099d
commit
bbcf567a1c
@@ -905,6 +905,9 @@ static int tcm_loop_queue_data_in(struct se_cmd *se_cmd)
|
||||
|
||||
sc->result = SAM_STAT_GOOD;
|
||||
set_host_byte(sc, DID_OK);
|
||||
if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) ||
|
||||
(se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT))
|
||||
scsi_set_resid(sc, se_cmd->residual_count);
|
||||
sc->scsi_done(sc);
|
||||
return 0;
|
||||
}
|
||||
@@ -930,6 +933,9 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd)
|
||||
sc->result = se_cmd->scsi_status;
|
||||
|
||||
set_host_byte(sc, DID_OK);
|
||||
if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) ||
|
||||
(se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT))
|
||||
scsi_set_resid(sc, se_cmd->residual_count);
|
||||
sc->scsi_done(sc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user