From patchwork Fri Feb 24 21:37: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: 9591231 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 D8566601AE for ; Fri, 24 Feb 2017 21:38:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8AF228947 for ; Fri, 24 Feb 2017 21:38:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD9BC2895A; Fri, 24 Feb 2017 21:38:24 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 319A328947 for ; Fri, 24 Feb 2017 21:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751349AbdBXViW (ORCPT ); Fri, 24 Feb 2017 16:38:22 -0500 Received: from mail-cys01nam02on0087.outbound.protection.outlook.com ([104.47.37.87]:47259 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751301AbdBXViR (ORCPT ); Fri, 24 Feb 2017 16:38:17 -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=XNIu3Eglo/SGWDk47Tao5pxz9gU44Tql26l09z88s3Q=; b=EiUMIj+hptjiZMTpxM8c3CAaJj8Q3x5z2tWw2j7uhMIMdqMDUM4tmsQIqa31AMgPvR0rXmkO+7L/Eld2H8d5umHmbOgaktFdiUU6jYgxZuXhG21QqDar2azMzmAVt1XH3ezInlwqeeftEuRogyUiXRq74e1oCE2tAV8oDHW5V+Q= Received: from BY2PR07CA0016.namprd07.prod.outlook.com (10.166.107.11) by DM2PR07MB638.namprd07.prod.outlook.com (10.141.178.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Fri, 24 Feb 2017 21:38:01 +0000 Received: from BY2FFO11OLC016.protection.gbl (2a01:111:f400:7c0c::184) by BY2PR07CA0016.outlook.office365.com (2a01:111:e400:7bff::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Fri, 24 Feb 2017 21:38:01 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; linux-iscsi.org; dkim=none (message not signed) header.d=none; linux-iscsi.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 BY2FFO11OLC016.mail.protection.outlook.com (10.1.15.61) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.919.10 via Frontend Transport; Fri, 24 Feb 2017 21:38:01 +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.309.2; Fri, 24 Feb 2017 13:37:45 -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 v1OLbjTb003864; Fri, 24 Feb 2017 13:37:45 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v1OLbjDh003863; Fri, 24 Feb 2017 13:37:45 -0800 From: Himanshu Madhani To: , , CC: , , Subject: [PATCH v3 10/14] qla2xxx: Fix request queue corruption. Date: Fri, 24 Feb 2017 13:37:39 -0800 Message-ID: <1487972263-3795-11-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487972263-3795-1-git-send-email-himanshu.madhani@cavium.com> References: <1487972263-3795-1-git-send-email-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)(7916002)(39450400003)(2980300002)(428002)(189002)(199003)(50226002)(106466001)(189998001)(80596001)(8936002)(5660300001)(42186005)(86362001)(2201001)(4326007)(69596002)(8656002)(92566002)(81156014)(8676002)(81166006)(5003940100001)(2950100002)(6666003)(2906002)(54906002)(4720700003)(1691005)(76176999)(105586002)(50986999)(50466002)(47776003)(305945005)(48376002)(101416001)(36756003)(356003)(626004)(107886003)(33646002)(38730400002)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB638; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC016; 1:4TEnexntkiTwJcYMxoqypTThynrJSrJu4JvLAcshofC93NE72rint3DdC29LfA+sRzqIbKQ41c85V/ihGqDXXbrkNjGpnXdgTHWTC/kiqoDI0UnN9m+W9Lfz8mGwf1Ddskw/mP8SYFYuPWWsZbQfEP+41uFByDqgagw6dJDtxvNEPgHImVpehv3X4Rch3AHaA41CHYvSDT7avYcRESmNVD5mpNZKPxGQbrlnWJZBFUOIm5NJznSj3duZgbOnP/P7Hl+ciyRW5E92km9GQcZ9QftI4IGf1810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-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13015025)(5005006)(8121501046)(13024025)(13017025)(13018025)(13023025)(3002001)(10201501046)(6041248)(20161123564025)(20161123558025)(20161123562025)(20161123560025)(20161123555025)(6072148); SRVR:DM2PR07MB638; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB638; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB638; 4:Ix7G/qpeNcenHD0PUv3izlaYHk7wv3jPPh4hRrlFQ+pA/tX5nX4qL6/wticegJRVo2OXyNo7d3Sj7ROvs2SzN/duc59qE1v35UW6EligPqFC2tuH+kv/749vrEF420Wvutq7ij329uYEtaVcsBwXc9WM2WcBEQxltCpunW1/Rt4gERIvvnKkELIF85AI3y683fk9wj+Gxss/kbSPqOVHBDVX0FG57s4XrRgDABPrUx/cRf9yW8fXjDYZoYSwIqDMPer+ZLfmwCJJ8nXEyKiLVShEagj8gWqrWLUWPembchgCeFNue38st1K2n2f5V55aqy1SuZHcYTgppfnCBT51CqJyWB6ZB2tWGvtmGa0VwiqWOhN7bXDAEoAqNXLAIY/xX/tClL1VSSKIpXOT7bRcwX88POrwHDyP8nlYEzK48dMPXU4UkQR/oawXILMv1P5qYgTj7HUpLR/b4mUWfmeZ7xohpvugSjWqY/ArSfpNjVsjXXYUfx41Q7zkZmWqWn/57ASQK7JMcZU8JCg9nOZLUGJUl5ReeJxWIHTF46KNFb0mTSCBwbC0r2O7DgQw5EaeumZhn3Ug2+9acDWM99etB3F508iKNW/6M7yUj9f79oc3bIhWEuqmooQ8FlnKvYa40aMCwVSNGWX/Ev4zrYqfqjaOgKaZB1X7Y3Qgon2kFVikQYTQ1tqdZyyw+KKcj9p9xm3UrJTI1BkRcEJS462aWG5RLgbTwghxlPdE0bmV8vsic0shs5/USIyBfulvYAsp X-Forefront-PRVS: 0228DDDDD7 X-Microsoft-Exchange-Diagnostics: =?us-ascii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nosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB638; 7:ZDppyGoVaVSTPuL+RkTMDnRFxHDH69G0NNHGpt9B7XC+6dmHSRGeICMdemXy9Ca1Gg+qwYof2LoqsBosldwgZCEbYXU+o7FHjjJaiBhWvd1LYLN37p7coO/E9SDbTS1Zeu7nVLX2Z5NjNCTQQTZArpP7GLsKITFThcgy5Lg05tNLf7ZJ2UPlUE8QIOIys8obYRYL4MAXPgVpV3xbCtolTTMv+L4WrXlOhpFHPwQZDY069WalkxpCRGaMq/A/UwEsuJ1YFHM4Ig679tydPrQFd2Nk4WeDONN3HGhsr91ZNlxAjF+rGDU17A8nBjGxYCzrFq2pkBVNmhRKIf8wJVUNrg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2017 21:38:01.1666 (UTC) 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: DM2PR07MB638 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran When FW notify driver or driver detects low FW resource, driver tries to send out Busy SCSI Status to tell Initiator side to back off. During the send process, the lock was not held. Cc: Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index a09e4a5..b5864e5 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -5183,16 +5183,22 @@ static int __qlt_send_busy(struct scsi_qla_host *vha, static int qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, - struct atio_from_isp *atio) + struct atio_from_isp *atio, bool ha_locked) { struct qla_hw_data *ha = vha->hw; uint16_t status; + unsigned long flags; if (ha->tgt.num_pend_cmds < Q_FULL_THRESH_HOLD(ha)) return 0; + if (!ha_locked) + spin_lock_irqsave(&ha->hardware_lock, flags); status = temp_sam_status; qlt_send_busy(vha, atio, status); + if (!ha_locked) + spin_unlock_irqrestore(&ha->hardware_lock, flags); + return 1; } @@ -5237,7 +5243,7 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha, if (likely(atio->u.isp24.fcp_cmnd.task_mgmt_flags == 0)) { - rc = qlt_chk_qfull_thresh_hold(vha, atio); + rc = qlt_chk_qfull_thresh_hold(vha, atio, ha_locked); if (rc != 0) { tgt->atio_irq_cmd_count--; return; @@ -5360,7 +5366,7 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, response_t *pkt) break; } - rc = qlt_chk_qfull_thresh_hold(vha, atio); + rc = qlt_chk_qfull_thresh_hold(vha, atio, true); if (rc != 0) { tgt->irq_cmd_count--; return;