Merge pull request #328 from bytedance/fix_rewrite_immediate_pdu_cmdsn

socket: fix rewrite cmdsn of immediate pdus
This commit is contained in:
Bart Van Assche
2020-05-14 10:37:25 -07:00
committed by GitHub

View File

@@ -105,11 +105,19 @@ iscsi_add_to_outqueue(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
/* queue pdus in ascending order of CmdSN. /* queue pdus in ascending order of CmdSN.
* ensure that pakets with the same CmdSN are kept in FIFO order. * ensure that pakets with the same CmdSN are kept in FIFO order.
* immediate PDUs are queued in front of queue with the CmdSN * immediate PDUs are queued in front of queue with the CmdSN
* of the first element in the outqueue. * of the first cmd pdu in the outqueue.
*/ */
if (pdu->outdata.data[0] & ISCSI_PDU_IMMEDIATE) { if (pdu->outdata.data[0] & ISCSI_PDU_IMMEDIATE) {
iscsi_pdu_set_cmdsn(pdu, current->cmdsn); do {
if ((current->outdata.data[0] & 0x3f) != ISCSI_PDU_DATA_OUT) {
iscsi_pdu_set_cmdsn(pdu, current->cmdsn);
break;
}
current = current->next;
} while (current != NULL);
current = iscsi->outqueue;
} }
do { do {