From patchwork Thu Jan 4 12:57:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suganath Prabu S X-Patchwork-Id: 10144703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C8C56034B for ; Thu, 4 Jan 2018 12:58:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE96E2817F for ; Thu, 4 Jan 2018 12:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E386528639; Thu, 4 Jan 2018 12:58:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92E572817F for ; Thu, 4 Jan 2018 12:58:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbeADM57 (ORCPT ); Thu, 4 Jan 2018 07:57:59 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:41745 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752858AbeADM5x (ORCPT ); Thu, 4 Jan 2018 07:57:53 -0500 Received: by mail-qk0-f195.google.com with SMTP id a8so1767153qkb.8 for ; Thu, 04 Jan 2018 04:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SQtfnRfYzlDkr//EWsj0Ddmdc7q6Yu8Gbz3MPfynIls=; b=R4GHoeonXUbger7hnMWCK/zDwjlhFhriGKFRtYgQfcJ/oYiUwjpmYa/NfvaUUXni5Q ljyzqDtgkSV2scQnXQt3fc8NDxhTKuLz7zMl99ThTyzRO1RDSyuNzy1JxG5AaLsWegoe qY2x7h9X9ZodwezRA7pwGCv653gKbmdmPdCIE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SQtfnRfYzlDkr//EWsj0Ddmdc7q6Yu8Gbz3MPfynIls=; b=s1bV4iNa/K6Qt6Xk9Angw+3I3wg9Ww8rl9J7yE5sJoGK5V8qaP0xuz2qf0dynRcYDn 9AUxAITeKdE/xhgdvI1TJ7NZ+nSN4rFdiHC8y+NBqVRDvNnfYw64/Dv6vMgJtl4XEdrz afPig1U6EFAkSFCPVX/2ouZhMOs11ZeyJkNZV3FsUSQvYjVURtok075AyuQ0LZoXxHKY M7WKcIqsG5+5FzJl1yyPYZTUe+sQ8GIrZs8cSFzj6arx5qmkNByIJGZlA+/LnXn5zegB JlFSG/NkWdvhZ2K2XxItG+WTu8TbhCNBbLEliFPxJYDk0cyU2TNooROwcRxZ844/tKXP z4OQ== X-Gm-Message-State: AKGB3mI7HOabuu51+YS4SI2XI0/ex0hRnPr4irBHSNiYsJARlln4hra3 G90iGXKq8RyAqkhhMIPKzAalhKLG X-Google-Smtp-Source: ACJfBouNSrE5SRGcoAzV8amKLVAuX/FEQ6gLT/yzRmKUaJeOO5jFHqcUfDqw9XCgAuQI+Zsd/+sJAg== X-Received: by 10.55.145.196 with SMTP id t187mr5838195qkd.125.1515070673032; Thu, 04 Jan 2018 04:57:53 -0800 (PST) Received: from dhcp-135-24-192-103.dhcp.broadcom.net ([192.19.239.250]) by smtp.googlemail.com with ESMTPSA id v58sm2064328qtk.18.2018.01.04.04.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jan 2018 04:57:52 -0800 (PST) From: Suganath Prabu S To: linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com, chaitra.basappa@broadcom.com, Hannes Reinecke , Hannes Reinecke , Suganath Prabu S Subject: [Resend 06/11] mpt3sas: check command status before attempting abort Date: Thu, 4 Jan 2018 04:57:06 -0800 Message-Id: <1515070631-14740-7-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1515070631-14740-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1515070631-14740-1-git-send-email-suganath-prabu.subramani@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hannes Reinecke 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 Signed-off-by: Suganath Prabu S --- 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 a11774b..8870cef 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -2771,6 +2771,14 @@ 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", @@ -2778,9 +2786,6 @@ mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, uint channel, 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));