From patchwork Fri Aug 31 18:24:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10584347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70CC05A4 for ; Fri, 31 Aug 2018 18:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E0562C535 for ; Fri, 31 Aug 2018 18:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 521E82C5B3; Fri, 31 Aug 2018 18:24:59 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 AA1482C5B2 for ; Fri, 31 Aug 2018 18:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbeHaWdj (ORCPT ); Fri, 31 Aug 2018 18:33:39 -0400 Received: from mail-sn1nam01on0075.outbound.protection.outlook.com ([104.47.32.75]:48576 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727533AbeHaWdj (ORCPT ); Fri, 31 Aug 2018 18:33:39 -0400 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:X-MS-Exchange-SenderADCheck; bh=CWG8HQFSOfyy4a2I4Y3pWjla0sIctTODaukZHxMh0IQ=; b=SVzf7zQAzgX66Hb5dbur85ugk6aZXwH5pIm7F8iTWsDW++lhcZmlOMtU/M4H9k7FTlep5sa20jjGLzDcK9V6goNUW4DbgKK1wEfggEBMRvh5DAM8EdM4QVBJyylcDe7H4uqA523hm6p5nAr1I2aR4bDXhbO9zUKAU7m+rTtfMO4= Received: from BYAPR07CA0005.namprd07.prod.outlook.com (2603:10b6:a02:bc::18) by DM6PR07MB4667.namprd07.prod.outlook.com (2603:10b6:5:a0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Fri, 31 Aug 2018 18:24:54 +0000 Received: from DM3NAM05FT013.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::204) by BYAPR07CA0005.outlook.office365.com (2603:10b6:a02:bc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.15 via Frontend Transport; Fri, 31 Aug 2018 18:24:54 +0000 Authentication-Results: spf=pass (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=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by DM3NAM05FT013.mail.protection.outlook.com (10.152.98.122) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1122.2 via Frontend Transport; Fri, 31 Aug 2018 18:24:53 +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; Fri, 31 Aug 2018 11:24:41 -0700 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 w7VIOfTK024257; Fri, 31 Aug 2018 11:24:41 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w7VIOfH0024256; Fri, 31 Aug 2018 11:24:41 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 10/14] qla2xxx: Remove all rports if fabric scan retry fails Date: Fri, 31 Aug 2018 11:24:35 -0700 Message-ID: <20180831182439.24182-11-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180831182439.24182-1-himanshu.madhani@cavium.com> References: <20180831182439.24182-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)(396003)(39850400004)(346002)(136003)(376002)(2980300002)(438002)(189003)(199004)(87636003)(2906002)(50466002)(8676002)(6666003)(305945005)(478600001)(1076002)(54906003)(51416003)(76176011)(356003)(14444005)(72206003)(316002)(42186006)(48376002)(86362001)(110136005)(16586007)(47776003)(106002)(11346002)(2616005)(126002)(476003)(5660300001)(4326008)(36756003)(44832011)(486006)(186003)(336012)(446003)(26005)(50226002)(69596002)(8936002)(80596001)(106466001)(81156014)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR07MB4667;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM05FT013;1:CM69GjvSorBkZ7SrxOeQf8Eh7oSI6njkvWYTEtG7muRxErsgWXXStHZ9H4f8TKo7Y2F/xWnF9a+EtJP5LJfaUbNkn+wVr5sIvKPLACnNwq6Q+io69owArSfT86cCCK1b X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6cf28ff-de35-44cd-5ec6-08d60f6f0c22 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:DM6PR07MB4667; X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4667;3:NoXJ64DwtvxQhjFHpBZJR35/Qf82oW3kX1qFGeXp+JO+Xdb9T8AWbdDDBzN14cma42Bg2ZmCYtEH9j826d9GbSroBwuP5IIhYwc2mb+2eFo/HVln4mQfGV8y+2CPcIN6tVNvMdtriJoD+Bi92ng5dcJa+ThWCi2zDLd1AnZJQx4SqYtPUy1LzgG50BVLu+RRdnhcBzelNDJbuW6ZHGtk1aVDqQ6r5rcy/jd/J1wbHh/ClBzHVw2L4pTcq7WflDzuIjz+r6AmBwai5hYMzbglqV7HacVpRJrjonw/gIdYfhLJH+CjdGq6VwlmKaW3bAsyiuEDCb71pmGJQjD4Syst+7v9IeDgh8Puw324vE+ADsU=;25:21aATuHljZcNZxARUMWMeLRQI+8JkHINo37sZaFm+sXhq83IEdNrgqrZcRvjyVPPiHZOPCZvobRVzTxfUD2n8HNIhmLS51X31I5rNVxznSBQofcLcOUEpdAJ41dh5ONdEwkw/GjDGW2Yqne3xDkngK0PkRWw79Oj0BC96JJ+5YVd4CNddOZ6AKA7CbYiXFE8ig+qJ9B3T5Aox0FE9vL846KYa/YadUzukZMgO9I17p2QkmYA43xsxLhU2vb6JxnflQOm++LFLNMb/md+YJ9GvVZFcHYkHPragaTUen/oN7TPbmQkjmiw7pod6j7GF6gwEB3SJD/NIg75KsyIMWoRxw== X-MS-TrafficTypeDiagnostic: DM6PR07MB4667: X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4667;31:7o0FAq5UajglUdbRmYuSTBJkgCbcQg35hZg5iHQKmxPJHwjskeb97BmJREC83VczKNrNpjIq77bunF7wYdca0Cji5EfW5jI7Va+2WEgIvtTCh8HtwjxUEAUUeegnNQKuypLCs07ZQWPneKv4rAgqFPnoKnI61d0xJZb2JzFh3R/4AtwV+Qm9sHOYQyjS4mygieDlgXVx5gTMVtdXT8JRAtM1+ntyn4FvjG4lZm3s0LY=;20:dYu2Hrw0svgsP33NwnS3uoZv1B4hhD/FjPHoJdTw6FXNrKPEUhiUK5mSv1iBbgSBY5q1Kc9CalalTDURp8jzZ34+7AzFsLEVyfQBILqQkMLRob4Yi41BMpmQiz2lu8QIHy37PErgkW/mYGJAyqy8PsUj7vpEkH8QN9kUaNKK8pIhbAtzJIBSExMiWnSCxUZqXAaH7xtrXZ1ZcAMXWRqdVXTMSz/X7Qp5UYv97915s2P2m9W3ZbbyBwi+8MRQEk0Py5iKWA8CgU467o6lF1cj5crD5v5OmXkTATk8V1H8rsA/t7lLKQ+VUnRuYc+ZsF7jGZ0hhV0ocExkmkWjifevXscvjMLTNv+kW0SBjley+39GInZ9Iafpmw/Chjum2r8bPiFp9LEWHWbuObNUi0CTMdUpnQ7RDOxMlCfhR7psDhLtSlFi83E4747cArsQdGn8GORE4Yp2i80sXQCOHCAsKKgQvWknfQUKZDG6uF0LXlNvD2ikungHl9vooNIQMmym X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(163750095850); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93004095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:DM6PR07MB4667;BCL:0;PCL:0;RULEID:;SRVR:DM6PR07MB4667; X-Microsoft-Exchange-Diagnostics: 1;DM6PR07MB4667;4:663Nbyz7E4c6lbe3Qt2WS+pRxoZHzI1Tae5zAa2RZpoztge51IXKEH7QFareO7rULwC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sOwjEu5t/cClC1haPq9YRz5hVkg1e8TDkIp/6th2NjkYS+5m6cTV5h71+xF4uXC375KDuvKXdWTCHjLE4WZLog9ZDDKWtjYGTdNhtagzthXkweWB8/YTKJwOvGLXddirJGrT0uaPQaP1y1nPld0q9q7XDnAAdSzr3tK34afwmWBwEKqgxRWrgSvM6T0Pqw==;5:DgRQZ487cdjg4CeCQaRtfM/YLMsBsHXYNeVo9MFCAnvhgeQGRblC6eDDT4FPrxtNwt1SnkuNk4CD+8gegNmIgOduAh5ulJq6U/fWB58WCO2DJqmADVcMHLXq7KG8c1rrw5wTsN345wN+Xjshxz5i5JwLKOrxhAFNrNyIgiW3IuY=;7:1iJ1QhtuV+sYVYAeSPyi/HA9BsyU6OHHAwS0qlksMnXre9dXBqw8Jk+lirpk2oZ+uCks7Rgih7lyFrarL2mgcNNKKbydYgRsbMQxhaoyJVCYsSVh0DopC2ys02l+34T5ZBX5SU86TRgBSZ5uHKu1flXLuPCtaTOhRo5nKQtYuV5Hmmm4DWhcp90wrdUKU0+lIY4x6RpNl+nAlYP9O11zJd92F29QclYdFU/4OuJkD7koOi26B1J8bdGiDcQLU34o SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2018 18:24:53.5744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6cf28ff-de35-44cd-5ec6-08d60f6f0c22 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: DM6PR07MB4667 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 When all fabric scan retries fail, remove all RPorts, DMA resources for the command otherwise we have stale Rports. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gs.c | 128 +++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 1cb27eb46731..85cbe59b4f58 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3995,6 +3995,41 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) } } +static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha, + srb_t *sp, int cmd) +{ + struct qla_work_evt *e; + + if (cmd != QLA_EVT_GPNFT_DONE && cmd != QLA_EVT_GNNFT_DONE) + return QLA_PARAMETER_ERROR; + + e = qla2x00_alloc_work(vha, cmd); + if (!e) + return QLA_FUNCTION_FAILED; + + e->u.iosb.sp = sp; + + return qla2x00_post_work(vha, e); +} + +static int qla2x00_post_nvme_gpnft_done_work(struct scsi_qla_host *vha, + srb_t *sp, int cmd) +{ + struct qla_work_evt *e; + + if (cmd != QLA_EVT_GPNFT) + return QLA_PARAMETER_ERROR; + + e = qla2x00_alloc_work(vha, cmd); + if (!e) + return QLA_FUNCTION_FAILED; + + e->u.gpnft.fc4_type = FC4_TYPE_NVME; + e->u.gpnft.sp = sp; + + return qla2x00_post_work(vha, e); +} + static void qla2x00_find_free_fcp_nvme_slot(struct scsi_qla_host *vha, struct srb *sp) { @@ -4095,22 +4130,36 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) { struct srb *sp = s; struct scsi_qla_host *vha = sp->vha; - struct qla_work_evt *e; struct ct_sns_req *ct_req = (struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req; u16 cmd = be16_to_cpu(ct_req->command); u8 fc4_type = sp->gen2; unsigned long flags; + int rc; /* gen2 field is holding the fc4type */ ql_dbg(ql_dbg_disc, vha, 0xffff, "Async done-%s res %x FC4Type %x\n", sp->name, res, sp->gen2); + sp->rc = res; if (res) { unsigned long flags; + const char *name = sp->name; + + /* + * We are in an Interrupt context, queue up this + * sp for GNNFT_DONE work. This will allow all + * the resource to get freed up. + */ + rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, + QLA_EVT_GNNFT_DONE); + if (rc) { + /* Cleanup here to prevent memory leak */ + qla24xx_sp_unmap(vha, sp); + sp->free(sp); + } - sp->free(sp); spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; vha->scan.scan_retry++; @@ -4121,9 +4170,9 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); qla2xxx_wake_dpc(vha); } else { - ql_dbg(ql_dbg_disc, sp->vha, 0xffff, - "Async done-%s rescan failed on all retries\n", - sp->name); + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Async done-%s rescan failed on all retries.\n", + name); } return; } @@ -4138,80 +4187,31 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) vha->scan.scan_flags &= ~SF_SCANNING; spin_unlock_irqrestore(&vha->work_lock, flags); - e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT); - if (!e) { - /* - * please ignore kernel warning. Otherwise, - * we have mem leak. - */ - if (sp->u.iocb_cmd.u.ctarg.req) { - dma_free_coherent(&vha->hw->pdev->dev, - sp->u.iocb_cmd.u.ctarg.req_allocated_size, - sp->u.iocb_cmd.u.ctarg.req, - sp->u.iocb_cmd.u.ctarg.req_dma); - sp->u.iocb_cmd.u.ctarg.req = NULL; - } - if (sp->u.iocb_cmd.u.ctarg.rsp) { - dma_free_coherent(&vha->hw->pdev->dev, - sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, - sp->u.iocb_cmd.u.ctarg.rsp, - sp->u.iocb_cmd.u.ctarg.rsp_dma); - sp->u.iocb_cmd.u.ctarg.rsp = NULL; - } - - ql_dbg(ql_dbg_disc, vha, 0xffff, - "Async done-%s unable to alloc work element\n", - sp->name); - sp->free(sp); + sp->rc = res; + rc = qla2x00_post_nvme_gpnft_done_work(vha, sp, QLA_EVT_GPNFT); + if (!rc) { + qla24xx_sp_unmap(vha, sp); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); return; } - e->u.gpnft.fc4_type = FC4_TYPE_NVME; - sp->rc = res; - e->u.gpnft.sp = sp; - - qla2x00_post_work(vha, e); - return; } if (cmd == GPN_FT_CMD) { del_timer(&sp->u.iocb_cmd.timer); - e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT_DONE); + rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, + QLA_EVT_GPNFT_DONE); } else { - e = qla2x00_alloc_work(vha, QLA_EVT_GNNFT_DONE); + rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp, + QLA_EVT_GNNFT_DONE); } - if (!e) { - /* please ignore kernel warning. Otherwise, we have mem leak. */ - if (sp->u.iocb_cmd.u.ctarg.req) { - dma_free_coherent(&vha->hw->pdev->dev, - sp->u.iocb_cmd.u.ctarg.req_allocated_size, - sp->u.iocb_cmd.u.ctarg.req, - sp->u.iocb_cmd.u.ctarg.req_dma); - sp->u.iocb_cmd.u.ctarg.req = NULL; - } - if (sp->u.iocb_cmd.u.ctarg.rsp) { - dma_free_coherent(&vha->hw->pdev->dev, - sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, - sp->u.iocb_cmd.u.ctarg.rsp, - sp->u.iocb_cmd.u.ctarg.rsp_dma); - sp->u.iocb_cmd.u.ctarg.rsp = NULL; - } - - ql_dbg(ql_dbg_disc, vha, 0xffff, - "Async done-%s unable to alloc work element\n", - sp->name); - sp->free(sp); + if (rc) { + qla24xx_sp_unmap(vha, sp); set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); return; } - - sp->rc = res; - e->u.iosb.sp = sp; - - qla2x00_post_work(vha, e); } /*