From patchwork Thu Feb 2 19:42:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 9553135 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 362AC60236 for ; Thu, 2 Feb 2017 19:45:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28EE72831B for ; Thu, 2 Feb 2017 19:45:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DACB2847D; Thu, 2 Feb 2017 19:45:28 +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=unavailable 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 8FD642831B for ; Thu, 2 Feb 2017 19:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbdBBTo5 (ORCPT ); Thu, 2 Feb 2017 14:44:57 -0500 Received: from mail-bn3nam01on0086.outbound.protection.outlook.com ([104.47.33.86]:36266 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751090AbdBBTot (ORCPT ); Thu, 2 Feb 2017 14:44:49 -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=A+cSqtBowd5NkDmgSoG/3J4uoa21/eFjuek8xWd+08A=; b=KmS7fDecUPJp2E/YQk/bNYo9wTMmUXLXFfstWLBMOzrpzCq+vUYAYWy1MijTPfJ0rTzu3+uU/hqpHOcs1qlBCKQ5qoAmw6tqanoYsQrdQLjX1a5HlPj+yNZf2HIoZr7xknUC2jyTWm9AprJnOu2kdoXFH1fkuOLH4TBFyQDY0xA= Received: from MWHPR07CA0026.namprd07.prod.outlook.com (10.169.230.12) by BLUPR0701MB2081.namprd07.prod.outlook.com (10.163.122.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Thu, 2 Feb 2017 19:43:32 +0000 Received: from BY2FFO11FD017.protection.gbl (2a01:111:f400:7c0c::143) by MWHPR07CA0026.outlook.office365.com (2603:10b6:300:1c::12) 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:31 +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:31 +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 v12JgtxA000454; 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 v12JgtYi000453; Thu, 2 Feb 2017 11:42:55 -0800 From: Himanshu Madhani To: , , , CC: , , Subject: [PATCH 14/15] qla2xxx: Fix sess_lock & hardware_lock lock order problem. Date: Thu, 2 Feb 2017 11:42:37 -0800 Message-ID: <1486064558-365-15-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)(101416001)(107886002)(4001430100002)(86362001)(2201001)(47776003)(8656002)(42186005)(5001770100001)(105586002)(356003)(54906002)(1691005)(2950100002)(106466001)(305945005)(48376002)(6666003)(50226002)(4326007)(8936002)(4720700003)(5003940100001)(36756003)(8676002)(33646002)(38730400001)(5660300001)(50986999)(50466002)(81156014)(189998001)(76176999)(80596001)(2906002)(92566002)(69596002)(81166006)(626004)(87636001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB2081; 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:tI2ymWvXL5z3W4+mA8NfkYPJllEWOg3YIQj3ypSlijZbFi6DzkMxXMvddhh+KOvjizdOmMCnZaesSLiiKaRseC3jdx4S24gW3UVz+yznmhuAtmUJ+HUcKlIs/tuCbU/eTsYFdRU8W5l/NjNECFWcLUYlsWD7q51Njyfsakqg7wDJVEkKv9xqrLhGzqie2ZQKJ5u2lVJ55eNRyl5JD09RDQqWN3tZ8LKO55MMrFLuM7SH3zrIdLNfonXMMFIe4ZG28LaWBlUhnEII6LDsxYpsGvqbaJdNFW6MNFxS7fvYs4ng0G9ESws8G59v4BH9AJi5QlMaltNuPHJVmH+QKsGoW5qBKSnQP1QfnOxGRrubAdjjmJKTf6p2F95f0q6XoasRbq8aicg2T2gXawFOCvDZyAi67vei8Q9XlpANWDNpLf6FcMTHhwDowIBe2MjWg4royhIYr3k0hoPFvYqdXULBgm2iFwPiVH024/Jq/lKRaegvE5Hf0CDdNv4o1kwUw9aYVyqDskxaZxl5ZPtU5vWlvBJcJ6EHIFRMRSUuZISTxwM= X-MS-Office365-Filtering-Correlation-Id: d951cbb1-78b6-4d1b-eb27-08d44ba3c4b7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB2081; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 3:HQ1yfcDP6/x0YRYbhyEVW4cAGNGd7zM2oud910BxPpGakl410YKjKKlCfqkFhONio5Q/I23TSlTqyDAzp7Zm6TGoBquZrHNoPa9A+OnYqhU1t+hB13LqnCJhr+RjnwtvXTD9/EvXLTiWX5RBo2aB1mzhJaS8VyPVbn+rf6YZIHlW9DF2ty1nNCFtr3i1MGOAZQWP6D4GYgRTsATMMXsBYEjRn0Co0Lk0wwnomrJKUjL1rQzvLrV0S2GS30RcAN8X+N4B/bHZLsR4ydaxgy6P023dGzcoaqk6dy7aKmmVCfTZKqbnBmePGdylxWDw24FzpK5C9wBg4/BtQX+ENmUuZ8OWHKCiz/yYySV9AW0grIiNWCT1QdedGsGi754Ku62K X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 25:7qdMZRZD4Zh8pJ3XJeY4ACQexWCu4CQbKbQ90mq76L3Aq+l8rNkPa46i9eelRUFPxtC3jvxj8MDFpPEy9jtXfsqlaOp6DWMnurVukZojE2Ksrj/13p3Txg6BppPwvX/FhEclZegVqf+ss3HjNluuIDntnlnbZeClaxdrg5A1Lx3IQHS9rF1wNQex/CC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P0vXrekTiqAcMeClXnWELCKhNpfrewyMAFmBK/Kh0ULSCgyOVdpymnLtiTBm5mts0RVBdFWDcuwUXnQDIzSP4qtD4uf/KNgfwQ+19PMbKWMq6ysd/69c5GaYZ0xklc9W9V4z6dB884JzId9miRqBG2mioQcnbz5+++RASzT9W/0p24k0RKdRhWJpohclcyiVjn3BXJTexYZsuU3MjytI9BQ2PpR+LlhX2GQhRCpNzxqxWZJL+fJZMm1bDqF6ol/VJePeRcb/u0ZJfjqGckV1uFAOMBvtFiiEx9bhlnDDzH6BOxBJupf9SiHcx1TQKpYMsNJ3yGCkjiBaJK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13018025)(13024025)(5005006)(8121501046)(13023025)(13015025)(13017025)(10201501046)(3002001)(6041248)(20161123555025)(20161123564025)(20161123558025)(20161123560025)(20161123562025)(6072148); SRVR:BLUPR0701MB2081; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB2081; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 4:EqeLOZhhyOcMRsuD6WBibvWunBUsI1YTPN4aCtHPxZa/fEL6y3GtkUE39SNZb6KJPx33BkCY2EFxRYdlkS2ydOahMIsLBiDeKORmpcsAtwB6jB7hGpJ2lVNDRGK9NR8A6Ie+kQsw/fRlQ2ayzkjQazDnIyX/1fzazOybzT/kwO1LDZxWxW9cHDPOGICiSJSSfZOppshZAEM4OwgXpo6hDDiYRKum6kKkuo1LBlJMRTYIV1EZ0Ot8z2Tp0kWC/ks3wX7klx4MdBbE8yA4MzlUc12nszv555VWGVD2JCjUBQkMD6OHXLr5t5+reAUJg4Q8i5ijjuJTN5fNbnXNpdlLiWbZPnDa7GYZLWn3Sj5byZn01WocgyGtUJGcv+V934l5dCdxTbzq4o0REZtfgeU24Or0AlzkJ1yjp+0x04dm1YYUZH3WR9R25DBJKzU6D7haJH4ZYQUCNtQ2tROMtF5R/7VI3bgS0OTbDGJP1JAE7jyJ6D9bewthJN0EUPlgOn8LqZIJucaGlslEAq1jTjZ41bXXmQU8yrgDymD9oID5f+nfRX9PG2jF+Nw1H7xuL1qF52ndFjMUJ3kXqFepGHqB0leZuxW43l3L4dxa32yyknkS0aWzQLljD/otxouY++F2STE6JIyaZXF+ghFJzT3VH7hfs5C+Z5nLt12w7wVfnJqfXa3fcrHvZmVe5H0w9GbebdmcmPzlUUuALNR1gm71fLGYJW/mRSvp/2o4m8jUcM047L9LnP6IrhIog1ZIpzI9QghuwvDd5EBqqpvhV0g6Pg== X-Forefront-PRVS: 02065A9E77 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB2081; 23:FPuCcBjlaWImzMJw8PwhSt+MGVlQx4XdUSdHlLM?= =?us-ascii?Q?vZlZM9LZjlwnIinsiQJiLmByB6NNb6jVmYCwHogNZRvi0M+9cvTrPEuaRaxH?= =?us-ascii?Q?Jh+kdQAZTX/V23zckor1GW8XF1IG6m91214y27C95X5zulfXJZGgmL1UahwJ?= =?us-ascii?Q?eovPj+fzQYAfOe8toT1NFpiOt+M64lRtShbyttKb6CA4OYH5P+UWX16g/mWO?= =?us-ascii?Q?ToLSuWUExElLiPXhrD86pOqMndpbxmMl9QMR25aBeYuFjFw5P87Wrx+RAgRy?= =?us-ascii?Q?Fu7UqyPl3PDFfvjiC32nsx6ZXAeldLJONP3FjtNsP97IwwIGUqyPiPOaDlLQ?= =?us-ascii?Q?bGPLs4OVjtoCHQDzu/XzY5lH5x8zFzxYS5rEZvgRiCQtCc3xxc7LgXkPwpmg?= =?us-ascii?Q?V7AgYZ0Mqhb1xTxpN9M/auaY04z4kwMRci3xPxG9w/VzckIN/5UWXXkMXGjP?= =?us-ascii?Q?iisYtMtFTZlpYM6rqme43IVvGMqVJvwHcURAgOONFdykWbXlXA1mMYA4FkVH?= =?us-ascii?Q?sKRH50AbEP4ZEU8Me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S3xjwWB6O62zxuf2af4H0PRHfjszm6cIMNGIZh1m3a6EqPxFmZ6DY/g9JTEzB/t X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2017 19:43:31.6038 (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: BLUPR0701MB2081 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 The main lock that needs to be held for CMD or TMR submission to upper layer is the sess_lock. The sess_lock is used to serialize cmd submission and session deletion. The addition of hardware_lock being held is not necessary. This patch removes hardware_lock dependency from CMD/TMR submission. Use hardware_lock only for error response in this case. Path1 CPU0 CPU1 ---- ---- lock(&(&ha->tgt.sess_lock)->rlock); lock(&(&ha->hardware_lock)->rlock); lock(&(&ha->tgt.sess_lock)->rlock); lock(&(&ha->hardware_lock)->rlock); Path2/deadlock *** DEADLOCK *** Call Trace: dump_stack+0x85/0xc2 print_circular_bug+0x1e3/0x250 __lock_acquire+0x1425/0x1620 lock_acquire+0xbf/0x210 _raw_spin_lock_irqsave+0x53/0x70 qlt_sess_work_fn+0x21d/0x480 [qla2xxx] process_one_work+0x1f4/0x6e0 Cc: Cc: Bart Van Assche Reported-by: Bart Van Assche Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 41 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 7c4adcf..ed63fa7 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -5835,30 +5835,23 @@ static void qlt_abort_work(struct qla_tgt *tgt, } } - spin_lock_irqsave(&ha->hardware_lock, flags); - - if (tgt->tgt_stop) - goto out_term; - rc = __qlt_24xx_handle_abts(vha, &prm->abts, sess); + ha->tgt.tgt_ops->put_sess(sess); + spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); + if (rc != 0) goto out_term; - spin_unlock_irqrestore(&ha->hardware_lock, flags); - if (sess) - ha->tgt.tgt_ops->put_sess(sess); - spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); return; out_term2: - spin_lock_irqsave(&ha->hardware_lock, flags); + if (sess) + ha->tgt.tgt_ops->put_sess(sess); + spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); out_term: + spin_lock_irqsave(&ha->hardware_lock, flags); qlt_24xx_send_abts_resp(vha, &prm->abts, FCP_TMF_REJECTED, false); spin_unlock_irqrestore(&ha->hardware_lock, flags); - - if (sess) - ha->tgt.tgt_ops->put_sess(sess); - spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); } static void qlt_tmr_work(struct qla_tgt *tgt, @@ -5878,7 +5871,7 @@ static void qlt_tmr_work(struct qla_tgt *tgt, spin_lock_irqsave(&ha->tgt.sess_lock, flags); if (tgt->tgt_stop) - goto out_term; + goto out_term2; s_id = prm->tm_iocb2.u.isp24.fcp_hdr.s_id; sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, s_id); @@ -5890,11 +5883,11 @@ static void qlt_tmr_work(struct qla_tgt *tgt, spin_lock_irqsave(&ha->tgt.sess_lock, flags); if (!sess) - goto out_term; + goto out_term2; } else { if (sess->deleted) { sess = NULL; - goto out_term; + goto out_term2; } if (!kref_get_unless_zero(&sess->sess_kref)) { @@ -5902,7 +5895,7 @@ static void qlt_tmr_work(struct qla_tgt *tgt, "%s: kref_get fail %8phC\n", __func__, sess->port_name); sess = NULL; - goto out_term; + goto out_term2; } } @@ -5912,17 +5905,19 @@ static void qlt_tmr_work(struct qla_tgt *tgt, unpacked_lun = scsilun_to_int((struct scsi_lun *)&lun); rc = qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0); - if (rc != 0) - goto out_term; - ha->tgt.tgt_ops->put_sess(sess); spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); + + if (rc != 0) + goto out_term; return; +out_term2: + if (sess) + ha->tgt.tgt_ops->put_sess(sess); + spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); out_term: qlt_send_term_exchange(vha, NULL, &prm->tm_iocb2, 1, 0); - ha->tgt.tgt_ops->put_sess(sess); - spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); } static void qlt_sess_work_fn(struct work_struct *work)