diff mbox series

[v2,01/28] scsi: iscsi: Add task completion helper

Message ID 20210525181821.7617-2-michael.christie@oracle.com
State New
Headers show
Series [v2,01/28] scsi: iscsi: Add task completion helper | expand

Commit Message

Mike Christie May 25, 2021, 6:17 p.m. UTC
This adds a helper to detect if a cmd has completed but not yet freed.

Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 include/scsi/libiscsi.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Martin K. Petersen June 8, 2021, 3:05 a.m. UTC | #1
On Tue, 25 May 2021 13:17:54 -0500, Mike Christie wrote:

> This adds a helper to detect if a cmd has completed but not yet freed.


Applied to 5.14/scsi-queue, thanks!

[01/28] scsi: iscsi: Add task completion helper
        https://git.kernel.org/mkp/scsi/c/1486a4f5c2f3
[02/28] scsi: iscsi: Stop queueing during ep_disconnect
        https://git.kernel.org/mkp/scsi/c/891e2639deae
[03/28] scsi: iscsi: Drop suspend calls from ep_disconnect
        https://git.kernel.org/mkp/scsi/c/27e986289e73
[04/28] scsi: iscsi: Force immediate failure during shutdown
        https://git.kernel.org/mkp/scsi/c/06c203a5566b
[05/28] scsi: iscsi: Use system_unbound_wq for destroy_work
        https://git.kernel.org/mkp/scsi/c/b25b957d2db1
[06/28] scsi: iscsi: Rel ref after iscsi_lookup_endpoint
        https://git.kernel.org/mkp/scsi/c/9e5fe1700896
[07/28] scsi: iscsi: Fix in-kernel conn failure handling
        https://git.kernel.org/mkp/scsi/c/23d6fefbb3f6
[08/28] scsi: iscsi_tcp: Set no linger
        https://git.kernel.org/mkp/scsi/c/c0920cd36f17
[09/28] scsi: iscsi_tcp: Start socket shutdown during conn stop
        https://git.kernel.org/mkp/scsi/c/788b71c54f21
[10/28] scsi: iscsi: Add iscsi_cls_conn refcount helpers
        https://git.kernel.org/mkp/scsi/c/b1d19e8c92cf
[11/28] scsi: iscsi: Have abort handler get ref to conn
        https://git.kernel.org/mkp/scsi/c/d39df158518c
[12/28] scsi: iscsi: Get ref to conn during reset handling
        https://git.kernel.org/mkp/scsi/c/fda290c5ae98
[13/28] scsi: iscsi: Fix conn use after free during resets
        https://git.kernel.org/mkp/scsi/c/ec29d0ac29be
[14/28] scsi: iscsi: Fix shost->max_id use
        https://git.kernel.org/mkp/scsi/c/bdd4aad7ff92
[15/28] scsi: iscsi: Fix completion check during abort races
        https://git.kernel.org/mkp/scsi/c/f6f964574470
[16/28] scsi: iscsi: Flush block work before unblock
        https://git.kernel.org/mkp/scsi/c/7ce9fc5ecde0
[17/28] scsi: iscsi: Hold task ref during TMF timeout handling
        https://git.kernel.org/mkp/scsi/c/99b0603313ee
[18/28] scsi: iscsi: Move pool freeing
        https://git.kernel.org/mkp/scsi/c/a1f3486b3b09
[19/28] scsi: qedi: Fix null ref during abort handling
        https://git.kernel.org/mkp/scsi/c/5777b7f0f03c
[20/28] scsi: qedi: Fix race during abort timeouts
        https://git.kernel.org/mkp/scsi/c/2ce002366a3f
[21/28] scsi: qedi: Fix use after free during abort cleanup
        https://git.kernel.org/mkp/scsi/c/5b04d050cde4
[22/28] scsi: qedi: Fix TMF tid allocation
        https://git.kernel.org/mkp/scsi/c/f7eea75262fc
[23/28] scsi: qedi: Use GFP_NOIO for TMF allocation
        https://git.kernel.org/mkp/scsi/c/140d63b73f42
[24/28] scsi: qedi: Fix TMF session block/unblock use
        https://git.kernel.org/mkp/scsi/c/2819b4ae2873
[25/28] scsi: qedi: Fix cleanup session block/unblock use
        https://git.kernel.org/mkp/scsi/c/0c72191da686
[26/28] scsi: qedi: Pass send_iscsi_tmf task to abort
        https://git.kernel.org/mkp/scsi/c/60a0d379f11b
[27/28] scsi: qedi: Complete TMF works before disconnect
        https://git.kernel.org/mkp/scsi/c/b40f3894e39e
[28/28] scsi: qedi: Wake up if cmd_cleanup_req is set
        https://git.kernel.org/mkp/scsi/c/ed1b86ba0fba

-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

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,