On 4/15/21 7:04 PM, Mike Christie wrote: > This adds a helper to detect if a cmd has completed but not yet freed. > > Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx> > --- > include/scsi/libiscsi.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > 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, > Reviewed-by: Lee Duncan <lduncan@xxxxxxxx>