From patchwork Thu Feb 2 19:42:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9553157 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 419A160236 for ; Thu, 2 Feb 2017 19:59:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3445428480 for ; Thu, 2 Feb 2017 19:59:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28E1F2849C; Thu, 2 Feb 2017 19:59:09 +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 6919D28499 for ; Thu, 2 Feb 2017 19:59:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751731AbdBBT7F (ORCPT ); Thu, 2 Feb 2017 14:59:05 -0500 Received: from mail-cys01nam02on0084.outbound.protection.outlook.com ([104.47.37.84]:8160 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751500AbdBBT7E (ORCPT ); Thu, 2 Feb 2017 14:59:04 -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=MmTcmri+IKG3bdNKZal36SsEf3DxTMdDgsTozIh+uXs=; b=J8yqAhEIYLl0MJXINvQRlLW+ww6F90GWj+gsK88DaaV2hOP3dzwEdKGV5mUeuhNr/2NEwPvRVQPMw5m9+pSw9tDTwI0Qs4vi3U35cJ/s4HL27SCDHHGST+34bL44HXWj1OuIEDclyI5x0hBFfK25TRNM4S+f/gh6rQrYTC53WXA= Received: from MWHPR07CA0028.namprd07.prod.outlook.com (10.169.230.14) by BN1PR07MB200.namprd07.prod.outlook.com (10.242.216.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Thu, 2 Feb 2017 19:43:23 +0000 Received: from BY2FFO11FD017.protection.gbl (2a01:111:f400:7c0c::124) by MWHPR07CA0028.outlook.office365.com (2603:10b6:300:1c::14) 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; Thu, 2 Feb 2017 19:43:23 +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 BY2FFO11FD017.mail.protection.outlook.com (10.1.14.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.874.2 via Frontend Transport; Thu, 2 Feb 2017 19:43:22 +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; Thu, 2 Feb 2017 11:43:09 -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 v12Jgt0B000436; Thu, 2 Feb 2017 11:42:55 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v12Jgt3B000435; Thu, 2 Feb 2017 11:42:55 -0800 From: Himanshu Madhani To: , , , CC: , , Subject: [PATCH 10/15] qla2xxx: Fix request queue corruption. Date: Thu, 2 Feb 2017 11:42:33 -0800 Message-ID: <1486064558-365-11-git-send-email-himanshu.madhani@cavium.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1486064558-365-1-git-send-email-himanshu.madhani@cavium.com> References: <1486064558-365-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)(199003)(189002)(36756003)(189998001)(48376002)(1691005)(8676002)(81166006)(81156014)(50226002)(8936002)(4326007)(47776003)(8656002)(80596001)(54906002)(38730400001)(305945005)(69596002)(356003)(626004)(5660300001)(106466001)(86362001)(105586002)(42186005)(2201001)(5003940100001)(4001430100002)(101416001)(4720700003)(6666003)(33646002)(50466002)(2950100002)(5001770100001)(92566002)(107886002)(76176999)(50986999)(2906002)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR07MB200; 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; BY2FFO11FD017; 1:upbZEdINclNKk+pReM86wJYeUmjLdyz2sI9e0fA2ZafycCwOkOwYISXzwiKcRzqLumaLpD1/CnTVDWBKSoIigZg1K3Kou1KvkpwS5q/9SxQxJ1cU2ilYBUyX+R2w+fUso/KArtUSR7IkkxsBRbOMQ3AY438FEd+C/wsbd+GzD3u0vyNyLn6q5cfCM+IZawcwYw2fjDKArYezAC/d4rRZWrbJM1m5iys9PUxa32rAfPIIygao+HP9z3C64oQrkQEnk8d17chvZF4PKo5UegYOwEBiKh7ocdsuEDFdlmQFKkotRw51zbMmhTYZC8UDTPPNIeCw/ITQkQjR/l5llDouELUrGzoykTHb0xpj731gyHWxMM8HBSGnT7ndRfo5kyo4o6u0OvYDlOwX8Kd6IA7cied04jlf86ZTzkdHsg2WgeH5FmwV67UUjFuvsminWFQBLbXOSSVOZt7GW2U0Q7zXb4gpYGlXU+jjW16HqTJt10qFWrhMW4N5wlKkMO3cZBLCmwr2C4jchm9Fc66+Pk6+cb/s18Oa6pDmFu+rjDfjNB0= X-MS-Office365-Filtering-Correlation-Id: c97c851b-2871-48ee-a9b9-08d44ba3bf87 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR07MB200; X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB200; 3:VoPI+qYrFL7ZmSV3WthYhQbv0Hwx5ZqylT+Ia1y7w+qpydT0ExjGxovED760PH4gdUMdF6vf66dslKxupsfB35tgEdfdpdMXmJ9DXkUParEpOVI5YTWLOW1hHPV2Ulem3PYZaer6WM+H09wrfFeqjYfM+vW4CLx3dhlFzwtzaU6D+ZAxx/S5wl7NQJcCKyBYkOMLI9CgqpAwqLMd5HmXItf2fSmPO7mCm9mhumhPuUtm3JfT3pxNaV/YdinNZnffJxQqRybxeJSLTdJpI1cJ8XAutLEHPkTC8TfyVrMt9B755EUOAnk4Eh4WI2/qGgYGY+SZ6A5aOf+t55H/lopXNq9Nrc+kPyqLfe94I4tjGGW9ztlXiTdaJxmI4w0FIMEG; 25:r6kweb2a4R47eObpV/R03U8ZwYb4lJ5w5/hBOxT32ZmRFz55GPlge5zQUkEx6JC6bFjKw6oR8XUKS+zdaHI8kkrHyIzIwPs+6Aa8EkQ8GRzI6YDAPK/xqmNK8fgQRjfNvh7qNhTc51YI0wPQ7AkPjQ7MZvPz+h5ES0+M8tShyy61Qsq4IDTR21MeuKtbNfdJHEhVKon7XD7K095xU+4/4aPszfZS+0ixe6rSesP0UyAimWWH++SBHUe0SUHDj8uIVwINs7lgrKD7BkeQZkvVDEkmT8l7fL0b07e7JjDBbzDNqZs6cSyfijfYXJEN4RoK7pW07p7qmmwmII0RKW1q0UFq3yyd0zQP9TkCaRCgnxjRo80IPZ84qpVn5Udm2/genTcf4Owm6m7HLaaeRpxpgaSpEFmwmDmPAGIyDgNcDHCzG27hOaTmEa/aFB1mRlc1Impm5T4rJM8QOQk0AxrG9A== X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB200; 31:gO+OfsGe2gOaUMaGRn67rieboF6GFpJnBl2c/7IAfpAjt2Mua/gkibiQXk3Xg7BiJSmuNxkUouxXW2OVeTybwrX5OWYiI1wSzzo+D/GnjRPEEyIO73Qq15XUJOV6yVGYU6g3yv/E1UzCDiNw4U2Xcg2IRJmImR29BDPTyb3lJxZR6PR7nKeMB/vTrNZFP2viOgpRrY1eOYNMQjoA9yTOn/M/c3UBOC7xPr5xPmqHi1HXtfdTtj9b/mjvgeRju+ktObocNkW5yR6q22GMKdHPLA==; 20:g9HwElBGzfBAtjHSXZgo+QeLgDTjJCkBsjMJqg/EA+EW5dp6KgWRc++QU/KyzFe8C0dzXTFwLykShrCyFUbJd3k6J2mMknxK52iHA1eidfWYtPg1nEsQKfM1boHaHjJw+NwSlaHnYVmqFPaRQva+GU+qBByHkP06aHsaOOdk6Q9id+dvEGsz6wAw89hadAnjbJeJZwrBBZeh/htS1pn3a7LgVRTLdqcwgooC+CiwCyt2nze/17zhP3lqCb3DeavkVRePhlsHpWEizai8YQeafMYie51PvAzxFbyPTNE0iDCcpJRv022heBPB7KOpctJHqLezka8tH3UoGPm2FRjjPbMDKOkytFAOy9+/3TTZhxgUISoB6fpWzxWCzsQN+fEPWTJj+r6BdmafuK1/0kmXUeIeNl0WxqnwBAxTp3zR3+g+mY3QJvO41ewOfz9IQeAcslKRsVGlXYjIoroHujHfUhOLZBBzSSTNT1bJNri3cfHAZZ045b7sg/Ss4g3KIweS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(13018025)(13015025)(13024025)(13017025)(13023025)(10201501046)(3002001)(6041248)(20161123564025)(20161123558025)(20161123562025)(20161123560025)(20161123555025)(6072148); SRVR:BN1PR07MB200; BCL:0; PCL:0; RULEID:; SRVR:BN1PR07MB200; X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB200; 4:zLq9XG+jcafXqTdLznArqeTHUA/lSiS9Ikefav2ryxrEStLCoLjC9C1V6NrCx4msR6hvz49Pjslca5mrdhY4MQAZ/f4maffiaR3/z9yd0GQy4qBBmjaYU/AxWJs5/z/A2yt5H34cxTb5gWOGunIfB3McdDzNXyT6cv4iwe7phB606EcocooHIh9AprEfL2wOqCGwZ2A5oA0zdaZVKsM1yopf4XtYV0C8U0IFQiIuXBQjp24MHk1atQP+5UVkukAitsfUk82VKNH+y/IRW35jgr+KL5vQXNjqjLa6KcDjD1FbNhstFEUe3geWAoqzLqy1+cyHF/LU2kPbFz+6vwJwUrE+Es/bxu8GSM0FCvtSKox/Rdfk16sCP2ctDDDbZD5rkVgIEM8Azi1xjb49KDGCecAHjqq4aTlfin8Drh6WnOlIhhUMnqcFm8c4x876SYf5tRGbdw+bFDACp+dHhaDLH9EArSmUmk+axUeJzN7vHIJqdWJ3iEvR0pUBwt6lnyidLPWkYy3+T6TDOtVWab8kicjgHJfkOCfPsaeh/ED82V1w/pzLSfyswdTbTgOhdPEb8Vm2HwX+ObPWoE+xD5jLe7TcIhM94F/wtW78xSa+aIs65KcK84akn7ra9zhTOuVhhq1JURbrKNrzE/1zRD8WMrEOhgpd7DH+SczNQSOGv17gANbPep1S24isQzU4Bn/a/xcrcoPyvU9ijot8PH0ljA== X-Forefront-PRVS: 02065A9E77 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR07MB200; 23:AFXJPAr+jF2pj/J+fypznXbh0k6741/jUHkhOXnzO6?= =?us-ascii?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agnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB200; 7:egyQiJMQ7QNJ9KRkzGXkSpA5lGVe8M7kf0bnTYZb+JsUOv/GmtU+LZOnGOJ75Y5TYRNneJjQ4FBJVowY2jRi73MKRSUjehfSq9bnA+CxpGcwFC+WXUgveDWewLbEYZ5+pOY+W1k+vBtEXOF2kzuB1Tk+stEavWwnmEfhpNyLUndI2isutHeEG+2cGV6ccstJSfQlmjjkk+A8wcHKJaiLx+S4IU/Uwrw+DfwOds4n8pCr6N9l7YkDRO8FJ0H3BbN03xBbp33D7CGgZz8hJ0XS8MW5NEgyst3ZOIAI4LUr3RLXqPBcbzgybf6DDMcO4cuVOP7zSTgW5mwzEyUBccWeMhvNC+owexFFqH0UcRBq8GseXkSwZSwUSWt/4D5rbbMr3i1wO5x7E33J9ee+v6Ld3XmlqfItssSDK0nDq2LpCnhGVmDcOiT6uaT4lUnaR/4xqZyZ15JrwiD6Skr8KUz/tGewd9sX8MLt4L2Y2BKk5nVxkQ+4SuTmWOQQMuiNjNxDl8QPa7uWPi1of57tTyFF5g== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2017 19:43:22.8522 (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: BN1PR07MB200 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. 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 ab9f4e7..1bd4eff 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -5187,16 +5187,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, uint8_t 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; } @@ -5241,7 +5247,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; @@ -5364,7 +5370,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, 1); if (rc != 0) { tgt->irq_cmd_count--; return;