From patchwork Tue Sep 11 17:18:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10595999 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 583E2920 for ; Tue, 11 Sep 2018 17:18:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B14229B1F for ; Tue, 11 Sep 2018 17:18:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DB5729B23; Tue, 11 Sep 2018 17:18:45 +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 AAC7829B1F for ; Tue, 11 Sep 2018 17:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbeIKWTB (ORCPT ); Tue, 11 Sep 2018 18:19:01 -0400 Received: from mail-eopbgr700046.outbound.protection.outlook.com ([40.107.70.46]:15781 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726782AbeIKWTB (ORCPT ); Tue, 11 Sep 2018 18:19:01 -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=+TehTMszJuVZzhKvXbHpb1Co9vgJg4AQr/GVy5kQItk=; b=jOO4OH0iRDOkDcANflX0Bna3HgSLF6JPDtPsmwkLQ6DLmAB70G8Mn4vSXEYt5RUX4s7+QB8qGagBeEuN7oAXtRd1yZwJH3jviF62Z3uQTEf+Z4kuw6AYT6cPr/9WsLiXCqeT2MJ+EgZrpZsFPSoJnrnYUZNwBsw7KSr97aMiBkc= Received: from DM6PR07CA0033.namprd07.prod.outlook.com (2603:10b6:5:94::46) by BYAPR07MB4392.namprd07.prod.outlook.com (2603:10b6:a02:c0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Tue, 11 Sep 2018 17:18:37 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::206) by DM6PR07CA0033.outlook.office365.com (2603:10b6:5:94::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1122.17 via Frontend Transport; Tue, 11 Sep 2018 17:18:37 +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 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_P384) id 15.20.1164.5 via Frontend Transport; Tue, 11 Sep 2018 17:18:36 +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; Tue, 11 Sep 2018 10:18:29 -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 w8BHISwS029075; Tue, 11 Sep 2018 10:18:28 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w8BHISqq029074; Tue, 11 Sep 2018 10:18:28 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 06/16] qla2xxx: Fix race condition for resource cleanup Date: Tue, 11 Sep 2018 10:18:17 -0700 Message-ID: <20180911171827.29016-7-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180911171827.29016-1-himanshu.madhani@cavium.com> References: <20180911171827.29016-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)(136003)(376002)(346002)(396003)(39860400002)(2980300002)(438002)(189003)(199004)(316002)(336012)(446003)(42186006)(16586007)(26005)(2616005)(476003)(126002)(11346002)(186003)(48376002)(51416003)(76176011)(2906002)(50226002)(86362001)(305945005)(54906003)(36756003)(356003)(47776003)(106002)(44832011)(8936002)(14444005)(486006)(110136005)(81156014)(81166006)(87636003)(5660300001)(80596001)(6666003)(8676002)(1076002)(478600001)(50466002)(4326008)(106466001)(72206003)(69596002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4392;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;CO1NAM05FT061;1:t+TsSZ8fs+gO8KPgFvJqUU4i3m9vsOwONz4Z46WyYGBgXzud8/hqh5TPH43f2u5xRTMpZHEi73znmg07r0PocrVVSENAKjPLBIogezkvhkaxUdil3hvyPq/fB6Y/+ntP X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efc7fd75-76f5-47a3-b0f6-08d6180a9c52 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:BYAPR07MB4392; X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4392;3:b1NJ1EW5ISuDbkdQ9qPGYYamtFxx+7aQ/v37WTCUIp7VioQcvMjQkTEG5fHJjKSR1xX+3xUvd2DiTZOZ3J7tVBslk+zqWcy5cT4uCXMcRbgpkz4LOblAGAlsGC8oe2BF9cdyBmShW1kT+gtldOPm3w43thb6jCiwSxUhp5rPzTRv0/NctWnNPpjS1bzoBykMOOJ19jATOZj2521ODv8zpzE1kvkadG+r/o4eBa9prawJQqfYcnyvWHDTZr9T/N2Ak59exUDIz5ZCatrTpfeXu5g2VY0rJSKtFCaG92G7CMPnTLaQb7s/o+VvcYt/Ahf+98wizO1lQuoAv3N5PVA7C9ZO3wW/KDIV7TuepIX8ChQ=;25:B/5ntZ1WpmVEUDC8LOE+2NvGKpLi5yynwEKFv2Ef+LMmbLn7+ud0R4bswKk2zB1WBhAgJuFs8OpfNV7j2b+ZL1MI62W1hZlGDC0nH2hSqt4KbcJGHLMWx7gHonVGKHHQ8JRoeg/VFyKdNYL3oksr6b4eD6jS6k6ahn2QbzYULUQZkKFduKSTIY9AxBc9Vo5ctIkrZMG91FjxPh/UeFYxyknyYLwfJQr5incWG7MrJIiWRAEbjHlG+qTjv/6/+Jgd4horBOoR7qAfOE7L2BAtkj7BZoTla86KOIf8WiZfv8tNraBlD0IYEyBPGB9VdpXvYrJoW/WmF31GXDj8xzjTIw== X-MS-TrafficTypeDiagnostic: BYAPR07MB4392: X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4392;31:jvUxVQUPY/FSO6fGcZDhh+/1GrXaZAO4yKpSr0iHpURD8e2RiE7C7iZSVL+F32CvppsFUJhw/qmLUbUu9abMcwXyDB6UWz2buiFY+UhvPINhG50eNZqlmfMkXbiihXqhi7lhaiTUvLtug44AA0B2Ec+oTX1HufVHSJ4wpnotpdq6J1NXdvn/EnyTBqxa7dzUxZXgNyGgfpEpsbpFQHRFwPVGa6jBa3LRDZuxPccuLB8=;20:ES5pXPuJjK7BPpV2La7gOh5aCEXYBwdZ4dtXLZrEUjyWlipe6bbaAhGU18R8sjGPnsQD85xaR+AVo2JuNoedffWlY5Szdwh1gkNY+4gEBgRhsZS5DEA54E6FTx9OLxXaY3WPWS/IQh/W9pGaqRrYc9DWXGCw+bFHvFmEerXh2UHY3aCiH6Voyup//pMF9VMU1V2JGgv4ojuGIMyakqtcAT6F4mhYc+dMyV2vgNc+o4H0uEFAT336nUL30VbMTISLSoQJxMahb6v3oG/gRF+2NWNQgvMBH7GFJXIS3cechj8MMUyV9AU62PuURDKNcjXwZlbjTaypv8rNlHhWUl4+l1REI2aLDY/DmK9bADlmflQGMjtPJ69WAceohe5pE/O/fDDf3CFrqnFHO1cQfwabwVVrxPtP6qVIRwlHtwCbkryjW34BBoQ7vu1vj02e5X1dSIFFQyahRb8NxHT85kPBVLL6/It5+G1ad3/ZiMxwPhiM7uzGfaJq9CyQtipi7RU+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(93006095)(93004095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201708071742011)(7699050);SRVR:BYAPR07MB4392;BCL:0;PCL:0;RULEID:;SRVR:BYAPR07MB4392; X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4392;4:hWhr9Rqhrh6TH1zMrDc7BbkO6CW27ypE1FGukFAVB0Abdta8GtTNXeAhzumEjEKL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T4u41F5/16gpytwyhL5nP22Uw2g6N1V0Yf10xhs1gaKaCVez8NVhXwlCSkjPYS5IlEuI7RZS4keD4jNcoP76H1vMD4pxpxptm7FgWx1xEWNtNpCGstPvyolNKXkNHkl8wgX0ushJjVCuyaTOXOD+fMh5G7pB4/h4Nrspw==;5:9tAgspM75KMakDw3vES+4WcpdkajCRsKq0yAfbnfVT7CWjUblop6vxWfHST0HvszFhTQ4VaqH4pgxrjKgzQH4njHDQYmPrk+6qaqDwIQe3x1O5bYX622ICdTZYLlTdjy6Gu9P71QGC8xWdhD7bLlYnwkkD7aspecWffvrEtka2w=;7:acauzC5xhnB5Y09e+kBWqrz0MccYyabexUZrH89AcZLo0sxj42zpr14dDRagC0apXEYEb2SuJUfNZN+np98lHHYO54y7gTgy6JnaCcjN24RzzGFj4eOvuPdjHZEBN0d/AL2W994KxcJSPzgUSidmgX2o+dSHKoObS5U41fFRcLMH+pp4hjPx+vEeJph5JzdBJHSE9jdC+odT3msAEfKJrjtVtlQJ+1KUNckDm+HzugbABFCRQ7aQtrJL61NOPCbv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 17:18:36.8408 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efc7fd75-76f5-47a3-b0f6-08d6180a9c52 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: BYAPR07MB4392 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 For Loop topology + Initiator, FW is in control of PLOGI/PRLI. When link is reset, driver will try to cleanup the session by doing an Implicit Logout. Instead, the code is doing an Explicit Logout. The explicit logout interferes with FW state machine in trying to reconnect. The implicit logout was meant for FW to flush commands. In loop, it is not needed because FW will auto flush. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 13 +++++++++++++ drivers/scsi/qla2xxx/qla_iocb.c | 3 +-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4d04603dd4ae..6f6739b945ea 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4991,6 +4991,19 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) (uint8_t *)ha->gid_list, entries * sizeof(struct gid_list_info)); + if (entries == 0) { + spin_lock_irqsave(&vha->work_lock, flags); + vha->scan.scan_retry++; + spin_unlock_irqrestore(&vha->work_lock, flags); + + if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); + } + } else { + vha->scan.scan_retry = 0; + } + list_for_each_entry(fcport, &vha->vp_fcports, list) { fcport->scan_state = QLA_FCPORT_SCAN; } diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 6335b8ce5fbd..4de910231ba6 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2270,8 +2270,7 @@ qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio) logio->entry_type = LOGINOUT_PORT_IOCB_TYPE; logio->control_flags = cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO); - if (!sp->fcport->se_sess || - !sp->fcport->keep_nport_handle) + if (!sp->fcport->keep_nport_handle) logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT); logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); logio->port_id[0] = sp->fcport->d_id.b.al_pa;