Task Management. When we abort a task or a task set, or reset the lun or target
we must also cancel all active tasks. This will trigger all affected tasks to have their callback invoked with SCSI_STATUS_CANCELLED
This commit is contained in:
@@ -1197,6 +1197,10 @@ iscsi_scsi_task_cancel(struct iscsi_context *iscsi,
|
||||
SLIST_REMOVE(&task->in_buffers, ptr);
|
||||
}
|
||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
}
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
return 0;
|
||||
}
|
||||
@@ -1208,9 +1212,48 @@ iscsi_scsi_task_cancel(struct iscsi_context *iscsi,
|
||||
SLIST_REMOVE(&task->in_buffers, ptr);
|
||||
}
|
||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
}
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
iscsi_scsi_cancel_all_tasks(struct iscsi_context *iscsi)
|
||||
{
|
||||
struct iscsi_pdu *pdu;
|
||||
|
||||
for (pdu = iscsi->waitpdu; pdu; pdu = pdu->next) {
|
||||
struct scsi_task *task = iscsi_scsi_get_task_from_pdu(pdu);
|
||||
|
||||
while(task->in_buffers != NULL) {
|
||||
struct scsi_data_buffer *ptr = task->in_buffers;
|
||||
SLIST_REMOVE(&task->in_buffers, ptr);
|
||||
}
|
||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
}
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
}
|
||||
for (pdu = iscsi->outqueue; pdu; pdu = pdu->next) {
|
||||
struct scsi_task *task = iscsi_scsi_get_task_from_pdu(pdu);
|
||||
|
||||
while(task->in_buffers != NULL) {
|
||||
struct scsi_data_buffer *ptr = task->in_buffers;
|
||||
SLIST_REMOVE(&task->in_buffers, ptr);
|
||||
}
|
||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
}
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user