From patchwork Wed Apr 10 05:29:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10893159 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 22A96922 for ; Wed, 10 Apr 2019 05:30:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AA9E289E5 for ; Wed, 10 Apr 2019 05:30:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3419289F0; Wed, 10 Apr 2019 05:30:34 +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 F28C2289F1 for ; Wed, 10 Apr 2019 05:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727300AbfDJFac (ORCPT ); Wed, 10 Apr 2019 01:30:32 -0400 Received: from mail-eopbgr690064.outbound.protection.outlook.com ([40.107.69.64]:13477 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727216AbfDJFac (ORCPT ); Wed, 10 Apr 2019 01:30:32 -0400 Received: from DM5PR07CA0061.namprd07.prod.outlook.com (2603:10b6:4:ad::26) by SN2PR07MB2543.namprd07.prod.outlook.com (2603:10b6:804:7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.21; Wed, 10 Apr 2019 05:30:29 +0000 Received: from CO1NAM05FT064.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::202) by DM5PR07CA0061.outlook.office365.com (2603:10b6:4:ad::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.16 via Frontend Transport; Wed, 10 Apr 2019 05:30:29 +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 CO1NAM05FT064.mail.protection.outlook.com (10.152.96.182) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1792.7 via Frontend Transport; Wed, 10 Apr 2019 05:30:28 +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, 9 Apr 2019 22:29:22 -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 x3A5TNdQ022172; Tue, 9 Apr 2019 22:29:23 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x3A5TN2O022171; Tue, 9 Apr 2019 22:29:23 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 2/2] qla2xxx: Fix N2N link up hang Date: Tue, 9 Apr 2019 22:29:16 -0700 Message-ID: <20190410052916.22129-3-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190410052916.22129-1-hmadhani@marvell.com> References: <20190410052916.22129-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131993478290412646;(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)(346002)(376002)(136003)(396003)(2980300002)(1110001)(339900001)(199004)(189003)(97736004)(6666004)(110136005)(8936002)(356004)(85426001)(336012)(26005)(2906002)(50466002)(51416003)(54906003)(26826003)(105606002)(76130400001)(76176011)(68736007)(106466001)(316002)(36756003)(1076003)(16586007)(81166006)(36906005)(42186006)(50226002)(81156014)(86362001)(498600001)(476003)(8676002)(126002)(80596001)(48376002)(11346002)(446003)(2616005)(486006)(69596002)(53936002)(5660300002)(14444005)(4326008)(47776003)(305945005)(87636003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2543;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: 4a60d543-79ed-488b-bfe1-08d6bd75a49a X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600139)(711020)(4605104)(2017052603328);SRVR:SN2PR07MB2543; X-MS-TrafficTypeDiagnostic: SN2PR07MB2543: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 00032065B2 X-Microsoft-Antispam-Message-Info: 2Ak8K9Wnj1zruxzurGlf0cpO2tZMR81EOLWXdMCzhk8kjiWHYFtbrnu4q68Gq3e6W+6XDXFhuTuqqpnZg004CoWEUjnopvWOU12SpEL5qnZlTTOXQh8mo5bf5EpjndAeb+xtjCuYVqD2Fe9ODIeZtILnewP3Bxqg0UXJROELDIVNm10c2ZMa1u9sAA2pa0B4MPuAR9M1AVefs4yAPNy2vRpz8P2Ci/qDHjjCm+6UiuVQDhrdns5T32qV9wbHhEJjYbLUb9uYp8kHIag/K4RtyoDj14qwFYITTf7/g2fW6nVtw8jgCmpKSauUT79pityLiM5dBkFMt6Pur1YUMS1P+o6p72mWaHvnhrqXjzL8BDgXHpiZ9kAKM5x/B1cqNufMs022jCznUvuKgZVNlh57+U4P5EKGkoAheWbdMiQeF4I= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2019 05:30:28.6979 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a60d543-79ed-488b-bfe1-08d6bd75a49a 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: SN2PR07MB2543 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 Prevent driver from endless loop or hang in the case of NPort ID change. Following stack trace is seen Feb 12 08:21:17 localhost kernel: Call Trace: Feb 12 08:21:17 localhost kernel: ? __schedule+0x254/0x840 Feb 12 08:21:17 localhost kernel: ? up+0x12/0x50 Feb 12 08:21:17 localhost kernel: schedule+0x28/0x70 Feb 12 08:21:17 localhost kernel: schedule_timeout+0x26d/0x390 Feb 12 08:21:17 localhost kernel: ? vprintk_emit+0x1e2/0x450 Feb 12 08:21:17 localhost kernel: wait_for_completion+0x11f/0x190 Feb 12 08:21:17 localhost kernel: ? wake_up_q+0x70/0x70 Feb 12 08:21:17 localhost kernel: flush_workqueue+0x14d/0x440 Feb 12 08:21:17 localhost kernel: qla2x00_wait_for_sess_deletion+0x98/0x1e0 [qla2xxx] Feb 12 08:21:17 localhost kernel: ? qla2x00_abort_all_cmds+0x42/0x60 [qla2xxx] Feb 12 08:21:17 localhost kernel: qla2x00_remove_one+0x12c/0x410 [qla2xxx] Feb 12 08:21:17 localhost kernel: pci_device_remove+0x3b/0xc0 Feb 12 08:21:17 localhost kernel: device_release_driver_internal+0x180/0x250 Feb 12 08:21:17 localhost kernel: driver_detach+0x39/0x6d Feb 12 08:21:17 localhost kernel: bus_remove_driver+0x74/0xc6 Feb 12 08:21:17 localhost kernel: pci_unregister_driver+0x2a/0xa0 Feb 12 08:21:17 localhost kernel: qla2x00_module_exit+0x2d/0x90 [qla2xxx] Feb 12 08:21:17 localhost kernel: __x64_sys_delete_module+0x139/0x270 Feb 12 08:21:17 localhost kernel: do_syscall_64+0x5b/0x1b0 Feb 12 08:21:17 localhost kernel: entry_SYSCALL_64_after_hwframe+0x65/0xca Feb 12 08:21:17 localhost kernel: RIP: 0033:0x7f48e887a3bb Feb 12 08:21:17 localhost kernel: Code: Bad RIP value. Feb 12 08:21:17 localhost kernel: RSP: 002b:00007ffc088da478 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 Fixes: 18b5110f8728 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine") Cc: stable@vger.kernel.org # 4.19 Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 0c700b140ce7..88eaf4b66875 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -602,12 +602,15 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, break; default: if ((id.b24 != fcport->d_id.b24 && - fcport->d_id.b24) || + fcport->d_id.b24 && + fcport->loop_id != FC_NO_LOOP_ID) || (fcport->loop_id != FC_NO_LOOP_ID && fcport->loop_id != loop_id)) { ql_dbg(ql_dbg_disc, vha, 0x20e3, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); + if (fcport->n2n_flag) + fcport->d_id.b24 = 0; qlt_schedule_sess_for_deletion(fcport); return; } @@ -615,6 +618,8 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, } fcport->loop_id = loop_id; + if (fcport->n2n_flag) + fcport->d_id.b24 = id.b24; wwn = wwn_to_u64(fcport->port_name); qlt_find_sess_invalidate_other(vha, wwn,