From patchwork Thu Nov 30 03:40:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10084201 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 351EE602B9 for ; Thu, 30 Nov 2017 03:41:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BCF629935 for ; Thu, 30 Nov 2017 03:41:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20AD829B02; Thu, 30 Nov 2017 03:41:29 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 A10EF29935 for ; Thu, 30 Nov 2017 03:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753474AbdK3Dl1 (ORCPT ); Wed, 29 Nov 2017 22:41:27 -0500 Received: from mail-co1nam03on0072.outbound.protection.outlook.com ([104.47.40.72]:21824 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753432AbdK3DlO (ORCPT ); Wed, 29 Nov 2017 22:41:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wJOLCSY2HN5tN28b4qQau3j9WXjH5wTtEgP17Q44J2M=; b=SOg550eYz55EmiYjs1NeF67duBwgj8rL4+YML1aviW6k94ASb9YdR4NEkBpvKV+hcpWIhJDp0Uf1gD3hYW/5nRrlEsW0nA8AnJucnKhd//GUsfIqDvcluNbu+hpv1lawyEQa/b9L2EUh52/owJzlRNO/sQ/19Rb0oZ8PrP96zLk= Received: from BY2PR07CA0095.namprd07.prod.outlook.com (10.166.107.48) by CY1PR07MB2523.namprd07.prod.outlook.com (10.167.16.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Thu, 30 Nov 2017 03:41:13 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::147) by BY2PR07CA0095.outlook.office365.com (2a01:111:e400:7bff::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Thu, 30 Nov 2017 03:41:12 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.218.12 via Frontend Transport; Thu, 30 Nov 2017 03:41:12 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Wed, 29 Nov 2017 19:40:50 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vAU3eoqB015162; Wed, 29 Nov 2017 19:40:50 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vAU3eoh2015161; Wed, 29 Nov 2017 19:40:50 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 14/22] qla2xxx: Fix abort command deadlock due to spinlock Date: Wed, 29 Nov 2017 19:40:39 -0800 Message-ID: <20171130034047.15070-15-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171130034047.15070-1-himanshu.madhani@cavium.com> References: <20171130034047.15070-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(2980300002)(428002)(199003)(189002)(36756003)(50466002)(1076002)(105586002)(5660300001)(4326008)(356003)(106466001)(50986010)(76176010)(2906002)(47776003)(189998001)(33646002)(54906003)(101416001)(42186006)(16586007)(8936002)(48376002)(110136005)(86362001)(81156014)(80596001)(87636003)(69596002)(51416003)(478600001)(6666003)(305945005)(2950100002)(8676002)(72206003)(81166006)(316002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2523; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:FYq9gn6pLYz49JL+OV3ghV/5KcfIquC8hSLCSKRyyJh+meYelRlBDDKqmdrVQ4XILR5i+BzvI2ZLk9VZVZjZKJdyuwlVYq+zsPdFJUcz650TgdqLxe5Yeorq4Nj2MB5U X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3c35a20-91cc-44c5-ca61-08d537a433ce X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603280); SRVR:CY1PR07MB2523; X-Microsoft-Exchange-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YL2bT3D6MqYxD1UyEFNvoxxJ2J1KXIlTK43iDZRXdp34mOMj4PV/i5DSNE/8QCQUmEHchurRII+ia1CEeRhWM6gX2K2RUtqeQ1SEZgAZvbtJR8j3jf8iSiYdLr8lUTXOVsIPF38214DvzmZTMSG5beywEmyni9mKdAV4oAHtwnGUdc1bumLrBsr19Ep8YO6dzAFTgCw8+KdwU4PPgw/8pEPCyucCrBySMwP8h+jXB/Fd8aUrOGsnCwbQoujYtLmgLSYNU240ipGX9o1q5nPMYvMZjPiUeOJVhyI2znXiXFUxVNiGtXThTJ817K+O7covyvRLNQ/zFVY0RpAPEFSIOJfp2z1EcZASSMj6luDEoNaMuBgGy+Yedf3wQAxnVHepuig3n0aAUajoK/qZrgr4hFCLNh7jcSAcRu85ukMXk/JH2SuWm9WzmrGGBRJM41gv+L1i+of2QPSQF/c5rFRsyyG0KXtSfuG7A8xDj0CesBWMWG6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231022)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011); SRVR:CY1PR07MB2523; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR07MB2523; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2523; 4:EDCCMqSsXMKZfhgzmapz2UaVIKpcDUevQnAEUg369skyqlpjQNm+OaTIENjoAIZHnVbtlc0YlJiyi+IvTg5LXfGifEmGB4hCpwYV6XEBkqeJ17q5sIMKO4VWX5K9X0TUFjbH7KPYvqfamdIA2XMj5lowsttoGNH7lBt+1HcMbA04eNhG1GyEMgFpq2e8fNjVHDc2iGQzkc/SCL6sSOrAwRlVFmpc/dN5l2Ym6RGLB/nfAtnOPVLASM8Eo7ivD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NEFRdMfLu0yCMJ6CTauFxH5N7Ip+ca/OabOqf+RL53UlZgouVCnMBk8HYPuR6iU1hlCvTLiUSAmxCfn0JEVR2Aet8ImFb3bHvbeclZV9ih+1xsSNbxx1aTLkZPqfLlhm8yrot+KQURWaNo9swve1fWEEd6ASaZZ7q3F1xElxRkS3+qNOFrCvHj3iD1IhqxKKFLErRfL3IBlcKOa+kxUKpAZMGiJuf/Qp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2017 03:41:12.2560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3c35a20-91cc-44c5-ca61-08d537a433ce X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2523 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: Quinn Tran Original code acquires hardware_lock to add Abort IOCB onto driver's request queue for processing. However, abort_command() will also acquire hardware lock to look up sp pointer before issuing abort IOCB command resulting into a deadlock. This patch safely removes the possible deadlock scenario by removing extra spinlock. Fixes: 6eb54715b54bb ("qla2xxx: Added interface to send explicit LOGO.") Cc: # 4.10+ Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Reviewed-by: Hannes Reinecke --- drivers/scsi/qla2xxx/qla_iocb.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index d810a447cb4a..106f4ac4f733 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2394,7 +2394,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data) struct scsi_qla_host *vha = sp->vha; struct qla_hw_data *ha = vha->hw; struct srb_iocb *lio = &sp->u.iocb_cmd; - unsigned long flags = 0; ql_dbg(ql_dbg_io, vha, 0x3069, "%s Timeout, hdl=%x, portid=%02x%02x%02x\n", @@ -2402,7 +2401,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data) fcport->d_id.b.al_pa); /* Abort the exchange */ - spin_lock_irqsave(&ha->hardware_lock, flags); if (ha->isp_ops->abort_command(sp)) { ql_dbg(ql_dbg_io, vha, 0x3070, "mbx abort_command failed.\n"); @@ -2410,7 +2408,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data) ql_dbg(ql_dbg_io, vha, 0x3071, "mbx abort_command success.\n"); } - spin_unlock_irqrestore(&ha->hardware_lock, flags); complete(&lio->u.els_logo.comp); }