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:
Ronnie Sahlberg
2012-03-10 12:12:47 +11:00
parent 3f44347dae
commit 50594830bd
7 changed files with 83 additions and 6 deletions

View File

@@ -259,5 +259,7 @@ unsigned char *scsi_task_get_data_in_buffer(struct scsi_task *task, uint32_t pos
unsigned long crc32c(char *buf, int len);
struct scsi_task *iscsi_scsi_get_task_from_pdu(struct iscsi_pdu *pdu);
#endif /* __iscsi_private_h__ */

View File

@@ -462,6 +462,11 @@ enum iscsi_task_mgmt_funcs {
*
* The callback will NOT be invoked if the session is explicitely torn down
* through a call to iscsi_disconnect() or iscsi_destroy_context().
*
* abort_task will also cancel the scsi task. The callback for the scsi task will be invoked with
* SCSI_STATUS_CANCELLED
* abort_task_set, lun_reset, target_warn_reset, target_cold_reset will cancel all tasks. The callback for
* all tasks will be invoked with SCSI_STATUS_CANCELLED
*/
EXTERN int
iscsi_task_mgmt_async(struct iscsi_context *iscsi,
@@ -674,10 +679,9 @@ iscsi_verify10_sync(struct iscsi_context *iscsi, int lun,
EXTERN int scsi_task_add_data_in_buffer(struct scsi_task *task, int len, unsigned char *buf);
/*
* This function is used when you want to cancel a iscsi task.
* The task will be immeidately cancelled and the callback for the task will
* never be invoked.
* The cancellation is only local in libiscsi. If the tast is already in-flight
* This function is used when you want to cancel a scsi task.
* The callback for the task will immediately be invoked with SCSI_STATUS_CANCELLED.
* The cancellation is only local in libiscsi. If the task is already in-flight
* this call will not cancel the task at the target.
* To cancel the task also a the target you need to call the task management functions.
*/
@@ -685,4 +689,14 @@ EXTERN int
iscsi_scsi_task_cancel(struct iscsi_context *iscsi,
struct scsi_task *task);
/*
* This function is used when you want to cancel all scsi tasks.
* The callback for the tasks will immediately be invoked with SCSI_STATUS_CANCELLED.
* The cancellation is only local in libiscsi. If the tasks are already in-flight
* this call will not cancel the tasks at the target.
* To cancel the tasks also a the target you need to call the task management functions.
*/
EXTERN void
iscsi_scsi_cancel_all_tasks(struct iscsi_context *iscsi);
#endif /* __iscsi_h__ */