From patchwork Tue Apr 2 21:24:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10882365 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 6DED517E0 for ; Tue, 2 Apr 2019 21:26:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58219288BA for ; Tue, 2 Apr 2019 21:26:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CEEB288D2; Tue, 2 Apr 2019 21:26:20 +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 DC0F5288BA for ; Tue, 2 Apr 2019 21:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfDBV0T (ORCPT ); Tue, 2 Apr 2019 17:26:19 -0400 Received: from mail-eopbgr750050.outbound.protection.outlook.com ([40.107.75.50]:60190 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726078AbfDBV0T (ORCPT ); Tue, 2 Apr 2019 17:26:19 -0400 Received: from DM6PR07CA0014.namprd07.prod.outlook.com (2603:10b6:5:94::27) by BN7PR07MB5363.namprd07.prod.outlook.com (2603:10b6:408:2e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.16; Tue, 2 Apr 2019 21:26:16 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::201) by DM6PR07CA0014.outlook.office365.com (2603:10b6:5:94::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.15 via Frontend Transport; Tue, 2 Apr 2019 21:26:16 +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 CO1NAM05FT061.mail.protection.outlook.com (10.152.96.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1771.6 via Frontend Transport; Tue, 2 Apr 2019 21:26:16 +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; Tue, 2 Apr 2019 14:25:13 -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 x32LPDSt028556; Tue, 2 Apr 2019 14:25:13 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x32LPDNG028555; Tue, 2 Apr 2019 14:25:13 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 13/15] qla2xxx: Fix driver unload when FC-NVMe LUNs are connected Date: Tue, 2 Apr 2019 14:24:32 -0700 Message-ID: <20190402212434.28469-14-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190402212434.28469-1-hmadhani@marvell.com> References: <20190402212434.28469-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131987139766538702;(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)(39860400002)(136003)(396003)(376002)(346002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(26826003)(47776003)(85426001)(48376002)(4326008)(316002)(498600001)(76176011)(54906003)(42186006)(36906005)(68736007)(87636003)(336012)(476003)(5660300002)(26005)(86362001)(51416003)(16586007)(486006)(2906002)(356004)(8676002)(305945005)(126002)(2616005)(8936002)(50466002)(81166006)(81156014)(110136005)(97736004)(11346002)(53936002)(36756003)(6666004)(80596001)(1076003)(50226002)(106466001)(105606002)(69596002)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR07MB5363;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: d84c650e-b1f8-4874-d622-08d6b7b1d723 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:BN7PR07MB5363; X-MS-TrafficTypeDiagnostic: BN7PR07MB5363: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0995196AA2 X-Microsoft-Antispam-Message-Info: StrymkoGM6x/YJX5MsGNEUbf327b1Gj3bYAsRYPm5mfWMfKY+/tap4RiwiieZwq30DJM66ptAVxza9e8JSv7pd6GUW/eYlyhiozTHqyypASMVG3Nd5Um6yJ/yTa1HNi+cPyAG8nZj9ZLfDYHvj/n6sVrrGM0Cl29qnmY+pON8pggfafyiG2ZYZO6rFZBwjgudUPbP1GyV2lTEJoYBqsK8nmDHGgINK6mLCyxUPSH+Mrf1P1huA1+LTUm8fq2hjkDj1+TzKwnzo271PqKSLUa69zb10YugEVQ3dlZiNLobUKF8tu7p5wgteEn76vMEkpEosJKcFGzTxnk5C1J4VVw1rETevPi4+JlejKahbLQAaHugk6Kh5fCxqP9Kr7EFnfwmZ033gtRadJeq+aXKfSs0EwznAweCRt87ILETNogerA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2019 21:26:16.3116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d84c650e-b1f8-4874-d622-08d6b7b1d723 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: BN7PR07MB5363 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 0c9d2cc5fcc9..a702f90740d0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -6742,8 +6742,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);