From patchwork Thu Mar 28 17:10:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10875469 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 43D7713B5 for ; Thu, 28 Mar 2019 17:12:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2080428BE7 for ; Thu, 28 Mar 2019 17:12:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ECFC28ECF; Thu, 28 Mar 2019 17:12:12 +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,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 0C3A728BE7 for ; Thu, 28 Mar 2019 17:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726281AbfC1RMK (ORCPT ); Thu, 28 Mar 2019 13:12:10 -0400 Received: from mail-eopbgr710051.outbound.protection.outlook.com ([40.107.71.51]:64264 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726681AbfC1RMK (ORCPT ); Thu, 28 Mar 2019 13:12:10 -0400 Received: from BYAPR07CA0042.namprd07.prod.outlook.com (2603:10b6:a03:60::19) by SN6PR07MB5376.namprd07.prod.outlook.com (2603:10b6:805:74::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.16; Thu, 28 Mar 2019 17:12:06 +0000 Received: from BY2NAM05FT033.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0042.outlook.office365.com (2603:10b6:a03:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Thu, 28 Mar 2019 17:12:06 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT033.mail.protection.outlook.com (10.152.100.170) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Thu, 28 Mar 2019 17:12:06 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 28 Mar 2019 10:10:58 -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 x2SHAvU0026520; Thu, 28 Mar 2019 10:10:57 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x2SHAv3H026519; Thu, 28 Mar 2019 10:10:57 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 13/15] qla2xxx: Fix driver unload when FC-NVMe LUNs are connected Date: Thu, 28 Mar 2019 10:10:10 -0700 Message-ID: <20190328171012.26425-14-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190328171012.26425-1-hmadhani@marvell.com> References: <20190328171012.26425-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131982667265694198;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(136003)(396003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(50226002)(42186006)(50466002)(5660300002)(8676002)(81156014)(47776003)(8936002)(76176011)(81166006)(68736007)(86362001)(97736004)(53936002)(1076003)(26005)(446003)(6666004)(11346002)(305945005)(85426001)(476003)(110136005)(498600001)(126002)(51416003)(4326008)(54906003)(48376002)(2616005)(36756003)(2906002)(106466001)(105606002)(80596001)(486006)(356004)(87636003)(26826003)(336012)(69596002)(16586007)(316002)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5376;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1111d589-4213-4b54-e4ab-08d6b3a08157 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:SN6PR07MB5376; X-MS-TrafficTypeDiagnostic: SN6PR07MB5376: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0990C54589 X-Microsoft-Antispam-Message-Info: 3uhTioqV29Ia6qzwGoLP5fAiyexgpPwyAf1R+69z+65GdJv7qc0Jm7mFNnQbmvAAj+pTPWfQMT31QF91INlrtWaIZAbtzAx0nPGM3iUW4BG6Rn4gJ0+mB94YWbvAOPOS/UaTdOldIhLsOb9CF6GXyqgwYRfoWxHOnomV2H3HNaPjR7b52gv9sB+na4WEw7z0idQBArKyZyYBk+ibLDluszK4hqcGbwHelbMTuZn0pnKFPwMWLXs54HlgDPPNcw8ohzkTdNYLBHaVK8wV7+qFRlv8eaxRi7rnAwgG3RD7F7YuI1NM8LzHXrveqEcHBQhtRIlFsVMl7RZb5ImnDm/3m37xLAmGRAqrwAro2HisqTRK1OOrMr5ziXLYAI9zyRo4HIkD8C3rD7EuuBmeWDe+WqJjyrJ2R5OZ35vNO1A1nZs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2019 17:12:06.3142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1111d589-4213-4b54-e4ab-08d6b3a08157 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB5376 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: Giridhar Malavali This patch allows driver to unload using "modprobe -r" when FC-NVMe LUNs are connected. Signed-off-by: Giridhar Malavali Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_nvme.c | 29 +++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_os.c | 6 ++++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 46c14bfecd4e..1ca63e80a7fe 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -164,12 +164,13 @@ static void qla_nvme_sp_done(void *ptr, int res) if (!atomic_dec_and_test(&sp->ref_count)) return; - if (res == QLA_SUCCESS) - fd->status = 0; - else - fd->status = NVME_SC_INTERNAL; - - fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len; + if (res == QLA_SUCCESS) { + fd->rcv_rsplen = nvme->u.nvme.rsp_pyld_len; + } else { + fd->rcv_rsplen = 0; + fd->transferred_length = 0; + } + fd->status = 0; fd->done(fd); qla2xxx_rel_qpair_sp(sp->qpair, sp); @@ -193,6 +194,22 @@ static void qla_nvme_abort_work(struct work_struct *work) if (!ha->flags.fw_started && (fcport && fcport->deleted)) return; + if (ha->flags.host_shutting_down) { + ql_log(ql_log_info, sp->fcport->vha, 0xffff, + "%s Calling done on sp: %p, type: 0x%x, sp->ref_count: 0x%x\n", + __func__, sp, sp->type, atomic_read(&sp->ref_count)); + sp->done(sp, 0); + return; + } + + if (atomic_read(&sp->ref_count) == 0) { + WARN_ON(1); + ql_log(ql_log_info, fcport->vha, 0xffff, + "%s: command alredy aborted on sp: %p\n", + __func__, sp); + return; + } + rval = ha->isp_ops->abort_command(sp); ql_dbg(ql_dbg_io, fcport->vha, 0x212b, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 69a8e5815e6d..837860e1827b 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -6720,8 +6720,10 @@ qla2x00_timer(struct timer_list *t) * FC-NVME * see if the active AEN count has changed from what was last reported. */ - if (!vha->vp_idx && (atomic_read(&ha->nvme_active_aen_cnt) != - ha->nvme_last_rptd_aen) && ha->zio_mode == QLA_ZIO_MODE_6) { + if (!vha->vp_idx && + (atomic_read(&ha->nvme_active_aen_cnt) != ha->nvme_last_rptd_aen) && + ha->zio_mode == QLA_ZIO_MODE_6 && + !ha->flags.host_shutting_down) { ql_log(ql_log_info, vha, 0x3002, "nvme: Sched: Set ZIO exchange threshold to %d.\n", ha->nvme_last_rptd_aen);