From patchwork Fri Dec 22 07:31:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suganath Prabu S X-Patchwork-Id: 10128907 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 0CE2860318 for ; Fri, 22 Dec 2017 07:32:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F379929EE0 for ; Fri, 22 Dec 2017 07:32:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E852E29FCE; Fri, 22 Dec 2017 07:32:39 +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 7AE0229EE0 for ; Fri, 22 Dec 2017 07:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754106AbdLVHci (ORCPT ); Fri, 22 Dec 2017 02:32:38 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36139 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751200AbdLVHci (ORCPT ); Fri, 22 Dec 2017 02:32:38 -0500 Received: by mail-wm0-f67.google.com with SMTP id b76so19957008wmg.1 for ; Thu, 21 Dec 2017 23:32:37 -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=zPciu/4rxqI1n0Kpn1E9IrfJyhdzP6yGBQBANqk6pPc=; b=Izm8+NMMBK4yTRk/ZyQfzMxyxyvhd+nlQKIAjJSnyJEnLLbeDxudkXL1xochmSxPVc iukVgYY9p3l0AhVr56jWbI8L91b0E45KkWUhfIdcu0w4FNCF5ZLAIhoKbMcRqBK9uJJY R5PUy5LPTjqK5qXw55GN29FdznZ0qzd93P0Uc= 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=zPciu/4rxqI1n0Kpn1E9IrfJyhdzP6yGBQBANqk6pPc=; b=YebxXazpAvJ/baJh0/HHe6ThfSVvvl9PLTIDCiiymiaJ5A7b3H7FbkRwXltkMs/t67 gya6QabhCcIUTr3F9ZQOltdj20ZP6IGl+acUpv0RiJrJvVCEcBoqR99e6ob+JEKxLGuJ P+DCUZub0vKfl7KmiQY56PaP55o91i4rwmqZq1HJDlvnE8DQK1ig+QXsxUYsP5aema4Y xc253z/k7Q/FNPdTg1tYQH4qXIL8x+kKbKlRr085XPeBTyfshu3BTlsiXlFktOvcMv9t b+VYWefTy93lQnEvsOo95bUIeg60nFo+DPt/KHlZteGZ4xGrFfv+OeLxK0LedaRHU4qX j8NQ== X-Gm-Message-State: AKGB3mJja6Em9Q2NxL2vzK5qA2FIPAmO3gX8lXLZ2b9zONN9kP7HCk75 HYStLK4BuKGmuznlAgUFKW7ZNhDj X-Google-Smtp-Source: ACJfBot7kQCx7zPe895tus+9FTKhcaZmuL9xFVtYL0TyP0Dpal9neWPcjjQQoeldoXhHLb62T1nT3A== X-Received: by 10.28.66.73 with SMTP id p70mr11843212wma.65.1513927956912; Thu, 21 Dec 2017 23:32:36 -0800 (PST) Received: from dhcp-135-24-192-103.dhcp.broadcom.net ([192.19.239.250]) by smtp.googlemail.com with ESMTPSA id b7sm10379462wrd.69.2017.12.21.23.32.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:32:36 -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, Hannes Reinecke , Suganath Prabu S , Chaitra P B Subject: [PATCH 06/11] mpt3sas: check command status before attempting abort Date: Thu, 21 Dec 2017 23:31:42 -0800 Message-Id: <1513927907-19735-7-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1513927907-19735-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1513927907-19735-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: Suganath Prabu S Signed-off-by: Chaitra P B --- 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 aae7396..0434fd6 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));