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:
Ronnie Sahlberg
2025-04-26 11:55:47 +10:00
parent d5e3bf6175
commit eb19863f77
3 changed files with 7 additions and 6 deletions

View File

@@ -149,7 +149,7 @@ iscsi_add_to_outqueue(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
finished:
iscsi_mt_spin_unlock(&iscsi->iscsi_lock);
/* TODO QQQ need to immediately send for the non multithreading case too
* and for the Windows API too */
#if defined(HAVE_MULTITHREADING) && defined(HAVE_PTHREAD)