summaryrefslogtreecommitdiff
path: root/include/scsi
diff options
context:
space:
mode:
authorMike Christie <michael.christie@oracle.com>2021-05-25 13:17:54 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2021-06-02 01:28:19 -0400
commit1486a4f5c2f35da5743b56037b8bbfb4eb38fa61 (patch)
tree161639ea6840416688901c6135d8c29d3e6f3372 /include/scsi
parent6143f6f6205267b7cd741e1d9ff1fec2cbbe4edf (diff)
scsi: iscsi: Add task completion helper
This adds a helper to detect if a cmd has completed but is not yet freed. Link: https://lore.kernel.org/r/20210525181821.7617-2-michael.christie@oracle.com Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libiscsi.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 02f966e9358f..8c6d358a8abc 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -145,6 +145,13 @@ static inline void* iscsi_next_hdr(struct iscsi_task *task)
return (void*)task->hdr + task->hdr_len;
}
+static inline bool iscsi_task_is_completed(struct iscsi_task *task)
+{
+ return task->state == ISCSI_TASK_COMPLETED ||
+ task->state == ISCSI_TASK_ABRT_TMF ||
+ task->state == ISCSI_TASK_ABRT_SESS_RECOV;
+}
+
/* Connection's states */
enum {
ISCSI_CONN_INITIAL_STAGE,