Skip to content

Commit

Permalink
scsi: iscsi: Add task completion helper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Christie authored and Martin K. Petersen committed Jun 2, 2021
1 parent 6143f6f commit 1486a4f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/scsi/libiscsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1486a4f

Please sign in to comment.