Fix race between queueing the pdu and update the task data
After we have called iscsi_queue_pdu from iscsi_scsi_command_async the pdu might have already completed if we are using multithreading so we should not dereference pdu at that point. Move the assignment of task->cmdsn and task->itt we need for task management into iscsi_pdu_set_cmdsn instead. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -800,6 +800,11 @@ iscsi_pdu_set_cmdsn(struct iscsi_pdu *pdu, uint32_t cmdsn)
|
||||
{
|
||||
scsi_set_uint32(&pdu->outdata.data[24], cmdsn);
|
||||
pdu->cmdsn = cmdsn;
|
||||
if (pdu->scsi_cbdata.task) {
|
||||
/* remember cmdsn and itt so we can use task management */
|
||||
pdu->scsi_cbdata.task->cmdsn = pdu->cmdsn;
|
||||
pdu->scsi_cbdata.task->itt = pdu->itt;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user