iSCSI target fixes for iSCSIResiduals tests causing libiscsi test suite to hang

Signed-off-by: Utkarsh Mani Tripathi <utkarsh.tripathi@mayadata.io>
This commit is contained in:
Utkarsh Mani Tripathi
2019-11-18 15:16:41 +05:30
parent f3ef8c973d
commit 1dbc82435f
4 changed files with 30 additions and 1 deletions

View File

@@ -126,6 +126,11 @@ func bsPerformCommand(bs api.BackingStore, cmd *api.SCSICommand) (err error, key
}
cmd.InSDBBuffer.Resid = uint32(length)
copy(cmd.InSDBBuffer.Buffer, rbuf)
if cmd.InSDBBuffer.Length < uint32(length) {
key = ILLEGAL_REQUEST
asc = ASC_INVALID_FIELD_IN_CDB
goto sense
}
case api.PRE_FETCH_10, api.PRE_FETCH_16:
err = bs.DataAdvise(int64(offset), tl, util.POSIX_FADV_WILLNEED)
if err != nil {