Skip to content

Commit

Permalink
scsi: mpt3sas: check command status before attempting abort
Browse files Browse the repository at this point in the history
When attempting a command abort we should check the command status prior
to sending the abort; the command might've been completed already.

Signed-off-by: Hannes Reinecke <[email protected]>
Signed-off-by: Suganath Prabu S <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
hreinecke authored and martinkpetersen committed Jan 11, 2018
1 parent 12e7c67 commit 9961c9b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/scsi/mpt3sas/mpt3sas_scsih.c
Original file line number Diff line number Diff line change
Expand Up @@ -2771,16 +2771,21 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, uint channel,
return (!rc) ? SUCCESS : FAILED;
}

if (type == MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
scsi_lookup = mpt3sas_get_st_from_smid(ioc, smid_task);
if (!scsi_lookup)
return FAILED;
if (scsi_lookup->cb_idx == 0xFF)
return SUCCESS;
}

smid = mpt3sas_base_get_smid_hpr(ioc, ioc->tm_cb_idx);
if (!smid) {
pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
ioc->name, __func__);
return FAILED;
}

if (type == MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK)
scsi_lookup = mpt3sas_get_st_from_smid(ioc, smid_task);

dtmprintk(ioc, pr_info(MPT3SAS_FMT
"sending tm: handle(0x%04x), task_type(0x%02x), smid(%d)\n",
ioc->name, handle, type, smid_task));
Expand Down

0 comments on commit 9961c9b

Please sign in to comment.