Convert qedi to check for task->sc instead of SCp.ptr and use the task lock when grabbing a ref to the task. Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx> --- drivers/scsi/qedi/qedi_fw.c | 2 +- drivers/scsi/qedi/qedi_iscsi.c | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index e28dc249c9f0..de5133be1c4b 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -594,7 +594,7 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, goto error; } - if (!sc_cmd->SCp.ptr) { + if (!task->sc) { QEDI_WARN(&qedi->dbg_ctx, "SCp.ptr is NULL, returned in another context.\n"); goto error; diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 0f3704c4c985..77f0445c0198 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -47,15 +47,10 @@ static int qedi_eh_abort(struct scsi_cmnd *cmd) { struct Scsi_Host *shost = cmd->device->host; struct qedi_ctx *qedi = iscsi_host_priv(shost); - struct iscsi_cls_session *cls_session; - struct iscsi_session *session; struct qedi_conn *qedi_conn; struct iscsi_task *task; int rc; - cls_session = starget_to_session(scsi_target(cmd->device)); - session = cls_session->dd_data; - if (qedi_do_not_recover) { QEDI_ERR(&qedi->dbg_ctx, "dont send cleanup/abort %d\n", qedi_do_not_recover); @@ -63,15 +58,15 @@ static int qedi_eh_abort(struct scsi_cmnd *cmd) } /* check if we raced, task just got cleaned up under us */ - spin_lock_bh(&session->back_lock); - task = (struct iscsi_task *)cmd->SCp.ptr; - if (!task || !task->sc) { - spin_unlock_bh(&session->back_lock); + task = scsi_cmd_priv(cmd); + spin_lock_bh(&task->lock); + if (!task->sc || iscsi_task_is_completed(task)) { + spin_unlock_bh(&task->lock); return SUCCESS; } __iscsi_get_task(task); - spin_unlock_bh(&session->back_lock); + spin_unlock_bh(&task->lock); qedi_conn = task->conn->dd_data; set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); -- 2.25.1