From 30df192634068a45fe5014236fe421dccb4e1393 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Fri, 30 Nov 2012 18:18:17 +0100 Subject: [PATCH] DATA-OUT set pdu->cmdsn appropriately set the cmdsn in the pdu struct so we can compare with maxcmdsn when sending to socket even if data-out pdus do not carry a cmdsn on the wire. if we would not set pdu->cmdsn comparsion with iscsi->maxcmdsn would cause a deadlock after maxcmdsn increases to 2^31. Signed-off-by: Peter Lieven --- lib/iscsi-command.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c index ad8c9a5..3c85da7 100644 --- a/lib/iscsi-command.c +++ b/lib/iscsi-command.c @@ -81,7 +81,11 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu, return -1; } - pdu->scsi_cbdata.task = cmd_pdu->scsi_cbdata.task; + pdu->scsi_cbdata.task = cmd_pdu->scsi_cbdata.task; + /* set the cmdsn in the pdu struct so we can compare with + * maxcmdsn when sending to socket even if data-out pdus + * do not carry a cmdsn on the wire */ + pdu->cmdsn = cmd_pdu->cmdsn; if (tot_len == len) { flags = ISCSI_PDU_SCSI_FINAL;