From patchwork Wed Jul 18 21:29:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10533319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B373460547 for ; Wed, 18 Jul 2018 21:30:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4CB629A0F for ; Wed, 18 Jul 2018 21:30:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 998C429BCC; Wed, 18 Jul 2018 21:30:08 +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 76FF729A37 for ; Wed, 18 Jul 2018 21:30:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730505AbeGRWJx (ORCPT ); Wed, 18 Jul 2018 18:09:53 -0400 Received: from mail-eopbgr690058.outbound.protection.outlook.com ([40.107.69.58]:48360 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726680AbeGRWJx (ORCPT ); Wed, 18 Jul 2018 18:09:53 -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=y9xGNJdQd3+6JUk8uSVJf4X9OfsjMeyGpzKU9SVYw8I=; b=WbI+yYoUeRYaeWq3x/CZnzBckKlFTadbOcZgjhF5tTbLAf9ilVQTEyr1XVWSCsOKOjv6lyEfcyYKrCmmDWBtXIIyQDdN4lJ+TN3NniJIm54hgbGn4xQqAYeTo/D/dwsqJn6irJZBNEX1Cuv5cXDW1T8054tQRmk3OK0X/G9mpyM= Received: from CO2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:100::17) by CY1PR0701MB1385.namprd07.prod.outlook.com (2a01:111:e400:4c1b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.21; Wed, 18 Jul 2018 21:30:03 +0000 Received: from BY2NAM05FT008.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by CO2PR07CA0049.outlook.office365.com (2603:10b6:100::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.973.16 via Frontend Transport; Wed, 18 Jul 2018 21:30:02 +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 BY2NAM05FT008.mail.protection.outlook.com (10.152.100.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.995.0 via Frontend Transport; Wed, 18 Jul 2018 21:30:02 +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; Wed, 18 Jul 2018 14:29:56 -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 w6ILTuMC013493; Wed, 18 Jul 2018 14:29:56 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w6ILTuqE013492; Wed, 18 Jul 2018 14:29:56 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 2/5] qla2xxx: Fix NPIV deletion by calling wait_for_sess_deletion Date: Wed, 18 Jul 2018 14:29:52 -0700 Message-ID: <20180718212955.13450-3-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180718212955.13450-1-himanshu.madhani@cavium.com> References: <20180718212955.13450-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)(39860400002)(376002)(396003)(346002)(2980300002)(438002)(199004)(189003)(1076002)(2906002)(50226002)(6666003)(316002)(356003)(42186006)(14444005)(186003)(80596001)(47776003)(69596002)(16586007)(54906003)(26005)(106002)(106466001)(110136005)(8676002)(476003)(87636003)(478600001)(2616005)(126002)(81166006)(446003)(575784001)(81156014)(11346002)(44832011)(50466002)(72206003)(5660300001)(86362001)(36756003)(486006)(336012)(48376002)(51416003)(8936002)(76176011)(4326008)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1385; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Pass; LANG:en; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM05FT008; 1:2F6NP/QRN0pv13QTHYymwkxgDIRoe3u8Osblo306MhlZ9TPqnpJDkIi148LKWqpMe69/yLFwdeECwR2/O+RLnlpX4nBOe4BPWDm4TaVWKJMVYYJu59+OaKwfX0vE4XiF X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f7a81d9-0d2b-4c50-3177-08d5ecf59f55 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060); SRVR:CY1PR0701MB1385; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1385; 3:eXwCkUtNzzEnic+ISdbY4HIvc+UufkdlWB5tuhqvdiv2yC2eWrYemEKxVKuVheHjOapSoLZIbqqjmlwRmAoye+sjHUQNZNfg+TEoCWBU7JfvM4tEPBsMtaq5wImsbdivRqkZOtB400LY2L4ITxo8GfskjALl4rk34H1QqSUNs2wSvRh6bMpeiNKeDY3uXxCAMOKbWwVpD4KBTqBNy9vTvzDitmBGimWFHkNvRE0Buw3KrZq+/svcMMh6YxRJE+4J+AP0Z7na6QGeDcfSGMXv5I7+Gz3SUFQzJNrM6LUCl4/D6AZe/afIASB6j5wsJmUiMgPFbHfjQKWH5mNYV7+JKOVcMLwreocsapWbY5WDN5w=; 25:XNXAItr/QHpYO9TTQKzaMGdSPTaYLcZ4xjW/vpeaQAxmvjJvu2TnGyUjg1XlEKuA6x23f5e+9bEx7C5ii9osKuTuoBoz1m9PFGTBjP6sui0/y8Rr1om7RB+UX14exwrcJBBw7tEs+W//oWNhO2yxNkuNOSXTlrpb5gxRNOQjaFwk+P3g3+uAeLsPFSkJz2X2SODt2oCecDnN+BtPsWe9YUQ7SPIZjyiE86GsodYsKzeR4SGnmNM7e7B+spIidnSKVSbAwrqHSC9DXfFACsEqEZbYs3JcWP8GrvyjyyCV/360/8h/G8MmRVB52Sh3dKIaKm9ex2eeYgd+Jp8TKYhA+Q== X-MS-TrafficTypeDiagnostic: CY1PR0701MB1385: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1385; 31:LqTXjnWUXnBr/lLKMQuJEEBR+lh4eTxTctrhEe21GZnS3ftjdJJ+zYN/EFkny2WKBV3SCjLcsCBsSmX2gzRsJPSiBYQuGcuJMbiqIgS9F77t4UbRjyT4rCs/57719rr5bPgrgW0TpUTWsLH5AZsUS/kzLzy3j1bq/yd4Xzp/3MEXjOPH2i0SqFDfHAiy1qTij5jhyfpwKylleAaX+ZZAe9BGolAkyfQt5d+9jE8xO5Q=; 20:2+8VqLZiyVTpC52nI2E7DaS177i8/BqpeWrk8otJ0p78Pj0Dxg6xAydV2uWQDXaC8RGq5F+rWcliB0kgv3E4+svuwAq9oFn0RhFxpWEyhzo4Huj7nZNkVxZEciVQtOOMWWaJIFYX70sdrPlJtZjjKEqfxyG/35laMCG4hwo0b0Z6BkBsQWKP8BAEi5xPHAtKbG6h8Q9Ev17SekP6JZRip6sUMrBv9OYMBC4kj9n6EWyC+ltU38GZ8zEDvPL+bbhJ26cMWCKCVddd/EEYZNS6UjGlINZD4PLoGzQXzNZHbg7p0+qtD9ANIwX38JTdHc2nnyPgHFyTsQRogZzfTVDG0o4c/OK8RjAEzLbyK6shIiB8hXLs8F/qi/HEAGhSDFWzNJjSzNNBpXMid18xH/ECH/uufgfY1lQto41YFxB52BhLL6Z6RRALY621JvlwCvU9ynpBNW0e+EDyF5kVjqSgyzm7qNT0tT3114jKatkHbPx8kpKxHCPm0q/y3UQ/SZ37 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93004095)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:CY1PR0701MB1385; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1385; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1385; 4:aG+23yOTaEduThqmuTXpeiabXWrOxLsWgNJxU5/np6r746lelb35xj23H+dZAAcVAhu6D/QTYaCv+NzwGWds+sosXNapCYAJXxj4ZAGtjNL+FChoguH/oBvYO8I05LSuh3/h1NBd2hsvkS5iufA2qEM/5ZyalmEQw3KTZWkM9Jd4c6SBeR6YQPb7C73322LC8EsBP62VBJjmrEpR85CJBF576y36cOluci5HMFm7eFw++D5vpJnAvdWANzCb85Efc2p5OCuT7tarQqfQ0Q1ACxG/YhQyNXO5fcqDBvtze051bG3QhPQWH3mdGkOur12X X-Forefront-PRVS: 0737B96801 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB1385; 23:B8PQfhvBNcs5/KZBNyaVYgBrBgB+bkce2jVsB4v?= =?us-ascii?Q?fRkX0H/M+zVkI6vXcghYmeeF52d7bnZJ6d+uxxiE4e641LVfwZkuOtahwHSQ?= =?us-ascii?Q?IHnx5cgsSFuELfw7czZrZVa0qJy8S+Ll6lyXCj18dm/yewoLltPzMBbetA/h?= =?us-ascii?Q?G79al2ERh7qhrxvmAlk8U4qOdoBoxEZFXpT3MLOWX0yp9rNzzGI6B85kEQXC?= =?us-ascii?Q?+qy3lcA6fzUXV6q9d5ktkjOBNyKFBrEUfSfHJUGwrE0q8F641Z6Tmj0BGNof?= =?us-ascii?Q?rzB7B2tHEKUCMNFzZmLyTN7+qX2+dY7YK/NZcqvqPVs4Qf4nYWDdUv8+0CA7?= =?us-ascii?Q?Ljb4QRDhZ52p5YT/OuzG6FBkDahb+X3zAPZ/ivj9rBbPH0TKeXfXR4yEh1EO?= =?us-ascii?Q?YVWWTfO3dsFnKgTdUALGoR5LDCF4dN3wHIgbDVembrqpUfI1YWWQjMdY2IUN?= =?us-ascii?Q?JlxPPQ7PIgk6/pvQID43ksiDoK+ZsuyQUH7IZa1sCr8zFR/5HWBSJlsVVs2c?= =?us-ascii?Q?J1McCZ0f+JyihAsGuOKp40U5+XxW1GyTlmcBI3LBrDmTVPMhxDOyNE3aK/jz?= =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8dd+Xhap2NJROB9I+RNmYBq4LkYFxTB1JB9hhLFiDY5eAo6h8WlNwlfBRxjRhFiqbA9Y/OgQryjz1nKOE3dv0jGu4OrPXj0YlJ8jNmYHDul9MlzIOw7bLH X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2018 21:30:02.5065 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f7a81d9-0d2b-4c50-3177-08d5ecf59f55 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: CY1PR0701MB1385 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 Add wait for session deletion to finish before freeing an NPIV scsi host. Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery") Cc: Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 1 + drivers/scsi/qla2xxx/qla_gbl.h | 1 + drivers/scsi/qla2xxx/qla_mid.c | 5 +++++ drivers/scsi/qla2xxx/qla_os.c | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 89a4999fa631..c8731568f9c4 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2141,6 +2141,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) msleep(1000); qla24xx_disable_vp(vha); + qla2x00_wait_for_sess_deletion(vha); vha->flags.delete_progress = 1; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index f68eb6096559..2660a48d918a 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -214,6 +214,7 @@ void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *, int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_async_abort_cmd(srb_t *); int qla24xx_post_relogin_work(struct scsi_qla_host *vha); +void qla2x00_wait_for_sess_deletion(scsi_qla_host_t *); /* * Global Functions in qla_mid.c source file. diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index f6f0a759a7c2..2c1aaf9b7a00 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -153,10 +153,15 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) { unsigned long flags; int ret; + fc_port_t *fcport; ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); atomic_set(&vha->loop_state, LOOP_DOWN); atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); + list_for_each_entry(fcport, &vha->vp_fcports, list) + fcport->logout_on_delete = 0; + + qla2x00_mark_all_devices_lost(vha, 0); /* Remove port id from vp target map */ spin_lock_irqsave(&vha->hw->hardware_lock, flags); diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 9f309e572be4..acc27808963c 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1147,7 +1147,7 @@ static inline int test_fcport_count(scsi_qla_host_t *vha) * qla2x00_wait_for_sess_deletion can only be called from remove_one. * it has dependency on UNLOADING flag to stop device discovery */ -static void +void qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha) { qla2x00_mark_all_devices_lost(vha, 0);