From patchwork Wed Dec 20 06:56:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125129 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 D01576019C for ; Wed, 20 Dec 2017 06:58:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8FF129649 for ; Wed, 20 Dec 2017 06:58:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDE192964F; Wed, 20 Dec 2017 06:58:18 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 5E8B829649 for ; Wed, 20 Dec 2017 06:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932370AbdLTG6R (ORCPT ); Wed, 20 Dec 2017 01:58:17 -0500 Received: from mail-sn1nam01on0057.outbound.protection.outlook.com ([104.47.32.57]:8134 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932477AbdLTG5x (ORCPT ); Wed, 20 Dec 2017 01:57:53 -0500 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; bh=AXQLGjU4qeD9DlxAUUeYGLAbw1Z85Qs7dCfBp9CMS9g=; b=gPwQQ2YlpJjPCEAVP7bqLGtV+8zYIFwS+l3UuVPepAG+lwDigihwDe7XvW0Tjc/gKKHd6UoOczh2miXQEm29ja9PmjDktvNWAW9CtLvIwifJniGIN+95TtKkE4vAkaftThjD3ZLjlRDLtRjmOaxTm41THDIF+sj5bMDG1ctAuWA= Received: from SN1PR0701CA0005.namprd07.prod.outlook.com (2a01:111:e400:5173::15) by SN4PR0701MB3821.namprd07.prod.outlook.com (2603:10b6:803:4e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:57:47 +0000 Received: from BN1AFFO11FD037.protection.gbl (2a01:111:f400:7c10::129) by SN1PR0701CA0005.outlook.office365.com (2a01:111:e400:5173::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Wed, 20 Dec 2017 06:57:47 +0000 Authentication-Results: spf=permerror (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=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD037.mail.protection.outlook.com (10.58.52.241) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:57:33 +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, 19 Dec 2017 22:56:53 -0800 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 vBK6urXS021722; Tue, 19 Dec 2017 22:56:53 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6urwZ021713; Tue, 19 Dec 2017 22:56:53 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 42/43] qla2xxx: Serialize session free in qlt_free_session_done Date: Tue, 19 Dec 2017 22:56:43 -0800 Message-ID: <20171220065644.21511-43-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-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)(346002)(396003)(39860400002)(376002)(39380400002)(2980300002)(448002)(189003)(199004)(72206003)(16586007)(81166006)(86362001)(54906003)(575784001)(81156014)(8676002)(51416003)(106466001)(48376002)(76176011)(1076002)(69596002)(478600001)(85326001)(50466002)(42186006)(36756003)(110136005)(87636003)(316002)(4326008)(50226002)(80596001)(8936002)(356003)(47776003)(305945005)(6666003)(2950100002)(5660300001)(2906002)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3821; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD037; 1:HKoMqPCEdKe1sVYXKKyk5LDImvRl73p84O2YunQ4RQlizB2fI9RPYjY5IehDdg2Pbg1movydINAp9dlrwXoL4jWq+OO84HyHfYmgNDIlqiGRs7XULyn+x+iAyeQvoJP5 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66693213-c125-4510-91a4-08d54776f277 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:SN4PR0701MB3821; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3821; 3:wQnQkck/p8z+vSL0aLjTCZAOgNIX64XYgIv81p5jnBiVlBHCuv2VtyBzG8r1jZwwbo6FlP+ak3i5sqA0ZNQ055FuiFBY5f/s/9g60dUN+KGSk4bfQ3VeRp4IzvtPtvKB9haIXxZOz8Wx6l+AYD7xRCeawVfjaAndeXChO9rcLcmy+dPbEeCVkAaooAYwhKaWVQx8ooKoE9cSoFlBCvsPCCclmHXPw11bTzQXSa+p6pk4/kWS11hR7wQY6qYsj+fDkYq2pZ9k9KzVSz8kHIiy83KvYuPWdaHxL+EJHQOez1k8UeDYaDDiy9rrceOTj9MYLUP46loZ9HmnGyEPiskrvP/tw4Puzvd6fSjwKgI6GzE=; 25:RWwuImJRMukRmJYUrRLt5bPN9B2n6HZBar7cTvVFEuOk4W72jcA8h8tWQ3dSTONVVHr6odjmQZYrixNHIm1P8VAkbxrVI8utUdwpeT+LsP6pL4ZSO8Eea91Uc1TsleVS5LRsSFWP55m5oW9zJ3aCr1DHUXvvuXB4/oZUjLJvKdyaN9ci0IShTGMukkNUJdYYcDM946drCdh4WzA+lptRiw9sR5yZh4ld55fwqn8ko4SMGobzhh3QnhVtuUefophYdUYWJscz6Wrr+5dkOlTUhzn6gjYEjXt4I0cXIjhPUQOJ2cZxBYY/81LQ7CUaeFp3fESTp/zIREivpXWp8rbVxA== X-MS-TrafficTypeDiagnostic: SN4PR0701MB3821: X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3821; 31:jC4bXK7LItcd6y9s3MPE7znVgtZWC9bG56Bww9NeukGo31YuvrvFuRKqFFyNSTjIM7Gby2Csy0hWscLs4lDFhAK0U2zE/KjT7FDNWp+wI4plspw+bXZqN8oqJFNNL0PA6a5J4RKkodgV5CeNTmBPNf5USnhUtXoNLgLDimsnYQfqaj3N68UKbJ4F4b+ws9sdlWgt6zGnl4UmKXrfpd2N6jObzv4srKCbbrFnJxvn6+0=; 20:YAt7ZbMx5rQtNI1l0Uwdv7iDF2CULoNFlK/Mw3aj0XKCNxxbjjX9YbD9FyTqXW8K2YLYx1a4HKnOBiZ3bjojJB03cJA2wM1cwbrZpPrSBbM57iLhNo+6pKBj+Iggb/CMUCaE2mIkZekx7hZhuEYmGvOb2PR5EQsvM8qJehIICx9veVovv1QuYmy3katPu4t6X9it8HYSvDlna1gAFl9cbpnc2anqwhoM1N9IhXd6OzYzqdYyYASE1C/NRbrQUb9rZ2rKRSAU9nQeU+M0wmgM05v8Z0j31wpETYhgPafOvA4PUWfKByQtXKyLTM3V6Z1/A6jQD4OtPTY4Rais/TdefEAQfRhPTSRPg8XGNojj8r0Gx98PvEVwLuJPPqJvjfynUJi8HXe9BzIav2kYhithabS50oaJN44Wg/1zDAf1TVXN5at/ifnjt7bEnh+jVLiAxDaGymRrG4xSnpVjZu0XE6tQhbtz1b8oUdiKsFEm1Wn/bcoIb7P7aI4aliUrTjTf X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(10201501046)(3002001)(93006095)(93001095)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN4PR0701MB3821; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3821; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3821; 4:zQnXshsru0SPDbm8C4qz98rpMMdf/ui4MG30ogc5yWdrZY9zD1G+nUVqtuEIZrAvvyJDxr2gKiBOgQxnQ4J3A0Z+GCcYwZu4/MNYVbrEoyo8jrRLEebKUG8MdHVGQMIxyl9mvgMxNsXj3OrcnHuZNyN5uL9iFSqUSpEljlheaoufQjkdvzaKcbhdXf1mfLZpVfx8v+YjwZZbrhFLJTCHtqNi5aJw2FU0ck+M2QcIfH5FdY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0hr8BnezQRGMgKsM0r3Fr5EeuTQuZckEGSFFkNAj5eUKsphZSy1Skp+G7bzWnUy03527iBqg9//BYm7t1jnCAZzDYzbrB3a8VEKyWTko7u/FhqqWcaW/z4nOwEEF9Pj6jsC+2Cj4SILcGcEv+yQQ1iUTwwbGwN6C1oo/wt952Zne+67+Du6GGx2I7kzK9L1LXbz5f7unG/ovqUYuj6g6V3zsupT171fGj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:57:33.8996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66693213-c125-4510-91a4-08d54776f277 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: SN4PR0701MB3821 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 free_pending flag to serialize queueing of free_work element onto the work queue Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_target.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 0c31c8ad0c1e..3feb843ef333 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2384,6 +2384,7 @@ typedef struct fc_port { unsigned int conf_compl_supported:1; unsigned int deleted:2; + unsigned int free_pending:1; unsigned int local:1; unsigned int logout_on_delete:1; unsigned int logo_ack_needed:1; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 814dfb1036de..225b88c47505 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1105,6 +1105,7 @@ static void qlt_free_session_done(struct work_struct *work) sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] = NULL; } } + spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); ql_dbg(ql_dbg_tgt_mgt, vha, 0xf001, @@ -1118,6 +1119,9 @@ static void qlt_free_session_done(struct work_struct *work) wake_up_all(&vha->fcport_waitQ); base_vha = pci_get_drvdata(ha->pdev); + + sess->free_pending = 0; + if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags)) return; @@ -1140,11 +1144,20 @@ static void qlt_free_session_done(struct work_struct *work) void qlt_unreg_sess(struct fc_port *sess) { struct scsi_qla_host *vha = sess->vha; + unsigned long flags; ql_dbg(ql_dbg_disc, sess->vha, 0x210a, "%s sess %p for deletion %8phC\n", __func__, sess, sess->port_name); + spin_lock_irqsave(&sess->vha->work_lock, flags); + if (sess->free_pending) { + spin_unlock_irqrestore(&sess->vha->work_lock, flags); + return; + } + sess->free_pending = 1; + spin_unlock_irqrestore(&sess->vha->work_lock, flags); + if (sess->se_sess) vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map(sess);