diff mbox series

[24/40] scsi: be2iscsi: check for running task under back_lock

Message ID 20210403232333.212927-25-michael.christie@oracle.com
State New
Headers show
Series iscsi lock and refcount fix ups | expand

Commit Message

Mike Christie April 3, 2021, 11:23 p.m. UTC
The tasks's sc is cleared when it's going to be sent back to scsi-ml.
This is done under the back block in __iscsi_free_task, so we must set
and check this under the same lock.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/be2iscsi/be_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 99eae2add8da..4181769d7303 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -216,12 +216,12 @@  static char const *cqe_desc[] = {
 
 static int beiscsi_eh_abort(struct scsi_cmnd *sc)
 {
-	struct iscsi_task *abrt_task = (struct iscsi_task *)sc->SCp.ptr;
 	struct iscsi_cls_session *cls_session;
 	struct beiscsi_io_task *abrt_io_task;
 	struct beiscsi_conn *beiscsi_conn;
 	struct iscsi_session *session;
 	struct invldt_cmd_tbl inv_tbl;
+	struct iscsi_task *abrt_task;
 	struct beiscsi_hba *phba;
 	struct iscsi_conn *conn;
 	int rc;
@@ -231,7 +231,8 @@  static int beiscsi_eh_abort(struct scsi_cmnd *sc)
 
 	/* check if we raced, task just got cleaned up under us */
 	spin_lock_bh(&session->back_lock);
-	if (!abrt_task || !abrt_task->sc) {
+	abrt_task = scsi_cmd_priv(sc);
+	if (!abrt_task->sc) {
 		spin_unlock_bh(&session->back_lock);
 		return SUCCESS;
 	}