From patchwork Thu Dec 28 20:33:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135901 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 2AA2A60318 for ; Thu, 28 Dec 2017 20:34:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D5DD2B1F6 for ; Thu, 28 Dec 2017 20:34:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124762B7EC; Thu, 28 Dec 2017 20:34:53 +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 A29882B1F6 for ; Thu, 28 Dec 2017 20:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755354AbdL1Ues (ORCPT ); Thu, 28 Dec 2017 15:34:48 -0500 Received: from mail-co1nam03on0081.outbound.protection.outlook.com ([104.47.40.81]:57952 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754886AbdL1Uen (ORCPT ); Thu, 28 Dec 2017 15:34:43 -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=cebaIPBr63OzAryCjxRn15KFYh3DUefWF3Oe7r9CJ0g=; b=iDy+Jys/8LVGVigs6j6mFH+TPu20boXYRg2IVusuWHmIGdBS+Fu33zitq7mBrpWgMk9xKnHZ2GSS6II/us0/Fwejs/xpfVmpa25a87XEXRMcrCThupnWH4OOIxzgTEh1GT7ZA1JxgoSI5uFgFPi/2KEGKngVZHwNypxQcD353gw= Received: from BY2PR07CA0024.namprd07.prod.outlook.com (2a01:111:e400:7bff::19) by MWHPR0701MB3817.namprd07.prod.outlook.com (2603:10b6:301:7f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Thu, 28 Dec 2017 20:34:42 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:165) by BY2PR07CA0024.outlook.office365.com (2a01:111:e400:7bff::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Thu, 28 Dec 2017 20:34:41 +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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Thu, 28 Dec 2017 20:34:20 +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; Thu, 28 Dec 2017 12:33:52 -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 vBSKXqI5002973; Thu, 28 Dec 2017 12:33:52 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXqlW002972; Thu, 28 Dec 2017 12:33:52 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 36/37] qla2xxx: Serialize session free in qlt_free_session_done Date: Thu, 28 Dec 2017 12:33:44 -0800 Message-ID: <20171228203345.2702-37-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171228203345.2702-1-himanshu.madhani@cavium.com> References: <20171228203345.2702-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)(376002)(396003)(39860400002)(39380400002)(346002)(2980300002)(448002)(189003)(199004)(81156014)(8936002)(50226002)(2950100002)(81166006)(6666003)(316002)(87636003)(16586007)(4326008)(8676002)(59450400001)(2906002)(110136005)(85326001)(478600001)(54906003)(42186006)(1076002)(36756003)(69596002)(50466002)(51416003)(356003)(86362001)(80596001)(47776003)(48376002)(72206003)(106466001)(5660300001)(305945005)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3817; 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; BN1BFFO11FD044; 1:Ru6Gnk6ZSWdK5Gzwtu/ZpAO3P/rjAK7n+SU4LEy8JgGcQDSEmtWDTwhWB8MHhu1l3/z+dhvctJTtI8105T0vGJAHxMhYOk9ACHTUy5T55ov6Wv8GOXzgVkNk7+t99yus X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41ca1695-ca55-454f-0ac3-08d54e326010 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR0701MB3817; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 3:K9s5f8h7/h+3ywgflGlS/BjXF1uATZ+Rn7RmiyhwJp3MWLFF9NEhbDk/CClWIpbZzUjgNWuVIoxcEb5AX/GJEdxEwsOTfVktNyBb28GVXj62/SxAdIrCMhpbdrNzh1j2A/EzMUIILi4rAGOQoE+WTKnCoNfxkAFNhg2K3LFijRpKmnwjTVErryTdI3nHw0vbhyku7r0wAm2bpsBerdSwe5BZXcPl46F0VbPoiA1i5nHRDaBY1MC4l0akCERBlAX7s22LFSOH764bpBNENgqcvOE70pcMdyhs9VRnzYyLmkb066wN6YcvPeNBTA6vNWVXxAqlikGUqpolccWfbJBI3w==; 25:sB7d6Fh3TdGcz0Bde+ADH1zwTO2QZpLObIRYzGIRtzfunlPq3v6u/uxyPspU1peo9PJGuMlJRL9R6TfpiOvdY+XB09eaMLc+DgsZ2x4yOowzn+zzu6Z0/Ie4nhanTIj9gXxNZV/tHsepYtY6fK2tdKhfbLHp5VEQ5ivQf263q2E7pURVaSzkU+VJbXRZdrxWRUvaWgWJMrnajBT7K6yl+RnDklmxkMs0Kj4mtOlUQogaPri6Ow3zhLL8d9ZDfPmSuDmYmdbfzw2THBfWyOcq/IjGOhXD37iPlm1FuF1uA+o+31HwFhUvkAhITuqwXXV2dqJWoLTsQSpVlkn8dpHUhA==; 31:ROC474o9Z8WnR/DFsDqTKALuLCLJ3HG2RnCwxAn1utmbj/wJ225IusXNaAULnZ+adcFgCMhTtN2FR/o8kpwAqw/gqwe0aAQREzjqzT2vJPZlLzV4oh2L+s42a6wYEz53CPUNeRNgvNYiHq2XKR+AWZvZhDxS9P5FHVjsvtgWjfAeFQnFuXgTHtJw3kfx6y3cfb94F5x/Q4x4k7ktZjKF1Y1hEtnR+b2p732przIqajY= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3817: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 20:NssBoD7w8wSOm6dN2WaxFsiW6uzwZV2Qg7s4i1gjd3UpvhDYDTyyH+ag6VHBYHz4dmO3tINu9mE0jVSfVvVAbKAV5mdO+fgy0TpMYTONEkgQDg96byBnBn3IqIIsOAN4bs+QMogf2I7OI1gO6f+epvR4Yuoj3UwcSnNvpxJ0OsLePmwKUHi8sh6b/9MYYPhad3ae9W795Qz1CIBy81MNWH3wGZbmdvf96QRI/bLJfaQePMXq7xIpJZFg3aRbiKkTUruLjjpM9Cl06xUsVoc7Hae71tRpODgyYxxL2gQ5KXYlhbY9Kng71WxYLjKHJIEQmkRp3zfO3wYvIxx93zz0Tv8BddKrx1+2ORj9yrUM8VOjXZtoeJXs4SBoqW6Av891fE46vf993Ks3z59WVXz3VxQKahsDYqXK5vS5JNvH1UhGsMCCa4PUmN/g8N+NuGM+f1UDOOfoYs6uAWFEGucp1eZJRjttx+RL1L4/Q4d55L9XWpOAC6BgwL+Tbh/phJPG; 4:6f4YoyfgI0v0O8BLNqdO36YAijLWGvlAiZxXFAcrVApdZ5W1yK9KMYLXIM20M4mvxWHxvsEZh+7iTJD8zCA3iMj6W0cKtHRk7c9EgkAeMyZ8KBG/2RYF6tVHJnjupee7pK8E2dN7tW9U262RBaXT6zXUJwEAt95HeXJH68LAQY+E+pNDqLKLpbMeiPotJzeFGHDstDR3gRiHp6w9bmyLHGYs4QVO5hEf3q7+HSp6nnZTyXA4i3tz7xAEwrxlZAmm6RGmfMT2EaNihf69dDF1gw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231023)(944501075)(6041268)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR0701MB3817; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR0701MB3817; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0701MB3817; 23:JqcF2vshmxU5OpoyHwMAGCHsmnA8fdM41eHB9nG?= =?us-ascii?Q?4P1f04AfjbPuon7ugQMtpPHcdbB5iCXEWZbhYGPgQJlqiZSqZ5cXxOJfmbXn?= =?us-ascii?Q?rYVXN89dapNib7O8/R7muKMP0Z9ErjSmQjqqW4hOpVqYAXqQdaO6eZCMOsMJ?= =?us-ascii?Q?Idgww/L5bY5WolTQW7WmTOsklvUwohZJ9F91uZ4+wIMAUiPdUAk0//AaEK7q?= =?us-ascii?Q?sIdXcyIfH6+KWi/22vbX6w1P28emhh4nly3Au3RDJdqy01mHLVINKl+ceIac?= =?us-ascii?Q?pEMeL6poXfifp6nCv8eYT/GaymyJFkeV8zB5JHP3SVJV+8Cmwpv1a3bvZgXw?= =?us-ascii?Q?Na6szEiQl5M5WzN3cs123jjWkO+F7T7+MZCmKxjVWwO/7sxUdUIMj/XuJO6M?= =?us-ascii?Q?TCBQ+ubWc70krEfgYNxJdFwW4PI4ZyG3F5n14nX5iihkQmKcoG169aK07oMZ?= =?us-ascii?Q?DN/CFyrM2sJ+09x++nFEt9aMzDN+47EKkJ/Hhdm0e+wsGuf7b3Yxi+fPo8V+?= =?us-ascii?Q?NZacPaAjQts3AXNv11cwfjq1pComabXYXblm6xlt271774FfVe90/WccbywK?= =?us-ascii?Q?FVGJpTVJh70OqoKLEw9wDzE2DpRj/w0E9P2oiuLdEMUwUTEyiVW31MARiy4C?= =?us-ascii?Q?9eRX19mzsZ0vAAiceb0lk4OEo/9blnmtbB1YJlMazigRIvtY8F0fm+tKUOFz?= =?us-ascii?Q?dXdchjXQJKDHSzCojVh6RiMaMlYZMeeA7BJ0wzu2i/p2QU60rSUPYu+71CSl?= =?us-ascii?Q?PaM2aq6S7PjOMpGPLmMIZhk4stzkWZx1Fq6fpEGKkWfUQCQYDviG8d5XdLjF?= =?us-ascii?Q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pWb49d4P3NiXgjuChR+cfpgoHZuexfO10OwDLRizRC+tgZZu5o5IGWelcnkJXlOUEC6JS7di+Q/sC0S/BTyhpNwPEMBN/8tfjbjoDG8XNvwPMFHethrOq6RLg4JWVTBCGCza SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:34:20.6356 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41ca1695-ca55-454f-0ac3-08d54e326010 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: MWHPR0701MB3817 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 ac2f340bc1c6..f7396a2e28ba 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2334,6 +2334,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 72b452db26da..0d3c3f647f91 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);