On Tue, Feb 21, 2017 at 5:57 PM, Hannes Reinecke <hare@xxxxxxx> wrote: > When attempting a command abort we should check the command status > prior to sending the abort; the command might've been completed > already. I think we are already taking care of this. Before calling 'mpt3sas_scsih_issue_tm()' function in 'scsih_abort()' we are already verifying whether the scmd exists in the driver's scsi_lookup table or not. if exits then we are issuing the task abort TM to Firmware otherwise we will return success status from scsih_abort() without issuing task abort TM to Firmware as shown below, smid = _scsih_scsi_lookup_find_by_scmd(ioc, scmd); if (!smid) { scmd->result = DID_RESET << 16; r = SUCCESS; goto out; } Thanks, Sreekanth > > Signed-off-by: Hannes Reinecke <hare@xxxxxxxx> > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > --- > drivers/scsi/mpt3sas/mpt3sas_scsih.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c > index 6bc9291..1c45fb3 100644 > --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c > +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c > @@ -2261,6 +2261,14 @@ struct _sas_node * > 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", > @@ -2268,9 +2276,6 @@ struct _sas_node * > 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)); > -- > 1.8.5.6 >