From 1f98c40edf199eea79b695772a80e4875c97a647 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 1 Aug 2012 13:30:13 +1000 Subject: [PATCH] DATASN: We have to increment DATASN in each DATA-OUT PDU in a sequence. For writes that span across multiple DATA-OUT segments we have to increment the DATASN field for each segment. We didnt use to, and most targets were perfectly happy, ignoring that the DATASN was constant 0 for every DATAOUT we sent. LIO however does check this and did cause it to reject the libiscsi test tool. (This is something we should write a iscsi test for so we can flag all non-LIO targets as broken and needing to be fixed) Signed-off-by: Ronnie Sahlberg --- include/iscsi-private.h | 1 + lib/scsi-command.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index 7d37b20..d57d5a2 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -182,6 +182,7 @@ struct iscsi_pdu { uint32_t lun; uint32_t itt; uint32_t cmdsn; + uint32_t datasn; enum iscsi_opcode response_opcode; iscsi_command_cb callback; diff --git a/lib/scsi-command.c b/lib/scsi-command.c index aa1682e..bad64ac 100644 --- a/lib/scsi-command.c +++ b/lib/scsi-command.c @@ -120,7 +120,7 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu, iscsi_pdu_set_expstatsn(pdu, iscsi->statsn+1); /* data sn */ - iscsi_pdu_set_datasn(pdu, 0); + iscsi_pdu_set_datasn(pdu, cmd_pdu->datasn++); /* buffer offset */ iscsi_pdu_set_bufferoffset(pdu, offset);