From 20eaf85dd4c2528ede2b6c01a9a780ce686a9bb5 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 2 Jan 2011 19:31:49 +1100 Subject: [PATCH] Handle InitialR2T=Yes correctly when sendign data to a target and wait for a R2T before sending the first block of data. We should now honour, and handle the case of ImmediateData=No InitialR2T=Yes correctly for targets that are limited on receiveing data too fast. --- lib/scsi-command.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/scsi-command.c b/lib/scsi-command.c index 8a2a98e..b324264 100644 --- a/lib/scsi-command.c +++ b/lib/scsi-command.c @@ -263,8 +263,10 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun, } } - if (pdu->nidata.size > 0) { - /* We have more data to send, so dont flag this PDU as final */ + if (pdu->nidata.size > 0 && iscsi->use_initial_r2t == ISCSI_INITIAL_R2T_NO) { + /* We have more data to send, and we are allowed to send + * unsolicited data, so dont flag this PDU as final. + */ flags &= ~ISCSI_PDU_SCSI_FINAL; } break;