From patchwork Thu Dec 28 20:33: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: 10135903 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 DBC3860318 for ; Thu, 28 Dec 2017 20:34:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDA3A2B1F6 for ; Thu, 28 Dec 2017 20:34:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C29602B7EC; Thu, 28 Dec 2017 20:34:55 +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 0C7162B1F6 for ; Thu, 28 Dec 2017 20:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754617AbdL1Uew (ORCPT ); Thu, 28 Dec 2017 15:34:52 -0500 Received: from mail-co1nam03on0089.outbound.protection.outlook.com ([104.47.40.89]:53184 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755286AbdL1Uel (ORCPT ); Thu, 28 Dec 2017 15:34:41 -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=rJwRMKLh7YfF9b97Z3zGsw1CkC1wnHtO4UgE2pqOT9A=; b=Aj4D+OEnJ+45haFhFtTBF0g4FafoNptMpTki4HMfU7ZP97uGWP/TMYaqVLMKFvn/mZUeQgYCCRO9DTz8W4HaNk2iNftT8qdZ0ovZ3cewFPOPat1tpI7+MwjczLORfth5LToeBCCqSfADRc7gruQHE+g3gzCfzKo7IpigOJzA3QI= 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:39 +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:39 +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:17 +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 vBSKXqNb002966; 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 vBSKXqBh002965; Thu, 28 Dec 2017 12:33:52 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 35/37] qla2xxx: Serialize session deletion by using work_lock Date: Thu, 28 Dec 2017 12:33:43 -0800 Message-ID: <20171228203345.2702-36-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:wtg8wdRPU0myDpaxWrnwaHXPx/MvjTplepeH2EULp6oGSDQQJJWgv4jhVoxAVDmwkNKvI2QzipLJVx+nBomIMm95B9pIP0qlZmRgAcJOrKy1PdkC5FudPsN1wYzNHfhJ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b969dfde-ffb2-4511-b6b2-08d54e325e6a 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:ZdzmQoF1b76L+k6VlLaXPO0WzyKJZQI5RTtEYayIqL27tPpSsNj+WhWwWX+bDn9JirN3dOZk3BV/RwhCqvgmfrFUMruO3P5Yf/DVAcmOJggsYqCHJN+oVwL5zPhndzkHBqkMwNe41aZCzpj42tZX5W0ZvwoRNcOFMH4KbAV1re7HU5/Zd9o37Ke913yiacJvUWtBJT+zxoRB8/Dzjg5nt3E9ePrlYGpF0BFp34fX79JQiID/Zfb2h7jxdGaQVP40R3Z3wPiL8ErWTpd/h8MEfN8ZUjKfiUBi6FKatV0eB+/IoPNLk7GspuCqz3Z96Kg3rga/muq5QqNWd6keFfgR1A==; 25:jMVQyOQC4/V9N3mtv06liF4XFua2P89VvQS4XhCuf67isqwyc6UqffZjInLRUZlvIPBRGkNO2N2hx9MIc4xtiZkOMJecCbmuuUYyPTn6teM/xFSyiwZRt7VRiN/2KavYLNt4vYVavC8AVrG2Y2qec83lZXmjucNohq4rOhnPJoYdqGwzUPfCHDFYoCNiv/sC7E4FMANZ9OYeM9MWyxcwvqDcBIJWbbTGj13lkb6N+QQwFuXehNiZPLN714Z+zZxe9VM2Jxj3VfIxvDlE5TDz0li6DQnfH0Wq9QtwInk0ZqjcGZmXlVwsev0Y92C+lPH7JTY4Np9Elg2CxV1L+p6+PA==; 31:D/oVTtTict3Utv2ytw0NLYXTu+quyAKMbpWOszyK1XDLbT0CQm2mt5BwfRkWFMn65Jzcm0igQJaB+bsg1dzYtt43R+odFGsGzVxmZpvt49ZtzDAXzMpQ2ktgaiIPFwYZGrxhxiWABpvolWArX/bR6fh1DlB/axYoxFDycEoYnol1ADx1refKsUl66eLGKBRdB2QcdmxbCWcU98LdHn4kGSK7MvjS+qxP3Ki86HHMbvE= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3817: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 20:kwTLfIk8DMNtVj6JZv2JAlyMPFsFBF9Q0mTdbDirsr3Xlf4WbBqByft49EwQj3Uy6L8KOABDgV8yZCO2WosmMswd4clxKCWQOtkLgXFYIJi+rjlX03C1JTOKv5Ky9rvjnsm5vDZZLcG83osJz5mjevWXTGDDnsU7OLvyIAnQtosADXIJ1fCxQ76OQjX26WDBTTTOt8qybFm2keCl8STjZ18T39OjGnc18xKpCQM1ml/byAg7G1cNia41rmXvA7IRQ/ptQE2UA5qiNh1al11WXuRSz0DbiyuA4VchCYip8DtcjBuk575C12o7UVnYZMcX5IxtQOO30AOoSy7bJY/d/dWAnMT13QeHQhA8w3S6qJY9rjMaJmm14kaQRLOVFG2K4p9YN3WaTTJlvEqGj289Bad/S3kzyG/S8HIHFwpcW10Qf7+vG0diB8ClgOzRW07YuoP1O5gq9jwVPt0q2XmGQf14eK1uSbx997IJbpYA5xpHrMQR+q3kjZlJosMXMYRk; 4:dzuu5W7e9Ru/uPqrPVjh/AOygMab2ww1QPW748Hli2071N7nAc0BhIUqoQdNml0Ly4jO7On523XnFddmPmukWx/SxFYMTHDtxwXeh5syb/0Yctbmdp1aYfi0+6qZBqHGJx3eeVo+KdCcZ5KzsZryN5jLK3gvSd1ZUnPUbzd6um5oBs7EuP0kbyM8ItSaBXc8oTDacUmOY8WJC6Dq3h5OZWCk0ExBhwVBXPc+U9NEBRp/SOp4RpMeWLMzvJVfLhFlydiPz5LQS5Z/rmKr/2nJ3W5PlWLVWL6CmRx/f93kenofQRkgg9EX0ELyWJRY23jf X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); 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:KlodymL5RNHZYcX6pNm2Kb3RQVbHqk4TGtxczpG?= =?us-ascii?Q?ViWnJ+RCQyk7YpeTDuQxb5BmUGhFZGYl/ZwDdRAINjQqv84siamulTuAfPgM?= =?us-ascii?Q?00St7UQGkK7jtN4gxy+hvxnskzr2sCvy4IPYE2bn7a97JlX4PoSK2e1jw9A/?= =?us-ascii?Q?YJUzGBGVj9OogxNQhS8+SwPs9eiSLWxPutGu8KkTiCyDN4BztWGkRpIC+Aqg?= =?us-ascii?Q?K0EdZjC28DX36BXCpBFpPkEt6ZgG58FNQU43vSLUAg+t//Bq/2hslGUxEKf7?= =?us-ascii?Q?B/k/pxGRVxBaCYO6uPTNie1FbHizZy4tcTFzMs9Qo+bi5b4x5m1tZlzhvsbC?= =?us-ascii?Q?V9mG+OO+43GZssPOagfq7c15yBjdrHduKbzyqeuhDYwfldrtoywQ+AsMVR3W?= =?us-ascii?Q?oFli/YFuXCbzHFWixhfQooQmpgJ08m2hLxJf9qjO8lgav9T8Y7CVZ2ZQywk7?= =?us-ascii?Q?1+vP9JVjyll/EycpEZBCqm/t4ZF6RDV5WND3GZM/KYQyeCqPrOygz55C8Ril?= =?us-ascii?Q?Oepii1CNz8jud+Smg29fNVQ9QaGLw/riv6gzuJV6CLrW6s57Wguhewbzsd+x?= =?us-ascii?Q?rsYFeTNjo6cmwSeHl6PDyGPj0lV3hIl7pD4y5RW6af+oNKh0hEKASNMvBNvu?= =?us-ascii?Q?YUnzR9Uy+sww7teeJyXZwck6hC2h3dn6K4Jm0mBrAns+1W43wCGcpExv15Iu?= =?us-ascii?Q?XSsakEErkuPl2Td7FqhG9QlJ8zsTaNQbH7xpW9dd1Fo447qgIehx7oo9DqSu?= =?us-ascii?Q?/a5w1OGvDkdFKK7aPcZxExJdDi+bFN3RZiBuFtTHNYWvTmLVmxCCR2crIhjk?= =?us-ascii?Q?fZngiDZcLRB/2ExIa7YdIQEyz9ES4RgXjPLmz2GVX41gqhCA1PzJXHdEAqGS?= =?us-ascii?Q?5c74jlGQsAjsTDysQbnqD8eE/0paFjHIEqdO7AeQS1mCcdaWqNBTKj6LNuhk?= =?us-ascii?Q?EAMwY57EmAd1oXVP8ETThrUyT5EAtg2l6+2C/tNNzrsWsC/f/7SkAiLTXxiR?= =?us-ascii?Q?KsPds4bo2urnSdlK++d3YiO+6?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 6:GvELXCxolcur/v7J9eobaS9gBQMFPhr4MFs+wmpav/JmJk+NOnQtS6HW7B992DaaZGLZkwUS6qllAHRAKHMUdlEoH2G+eT50PPBM2sLh8kwNa3W5da7sgWB4xs3kOBMQoyWWRd7MSDtK8wTAwoaSEtRIngBzlSCtlNl+NeTisCcQ7S8vwkjuQ/lKgW/ss/ElJ/gXK2JHI53JbVQ6KdwFvo6MoT9OV+AXdDbXZydqxOLPePJAGeDkbo3YrxEBlca/psBQ1l9lddo7BJxAMbagPuGk//3uv7pB+gfRLCGALQ8ii5a5qj5p0YZvD0ZzePDUlHaJYXkB/taGe9NvBkft8N/zXE7MX3F3l/y9PdpNdXE=; 5:g8hXjmUn0LEj8z7qdZyXNCQCx3oR7vhjXLniCoSglnA2/E6GQ4xGq0rm6YmJ2q8FHBRzTNiGDNPSg/9HrZBBvfYtFtCJIivuPg3XcfUypSzg9z8qFfTgro2Ikc/dCcYac2vU0zdoZB1epknEOeqQUdreLQ85Pn0b+7/3iEXbbqg=; 24:erUFgPbd9aBaJea4TGJM11RHEjd/ssHxEUhHhMZx0HzK7F4Sfi/n4n2oHv4x5sgeWlF9Ur4zhJZhx0WQA/EwRpuGLv1iUF7I8z/9V3rPYd0=; 7:Ww9e0UFuLy2xVkPZMzglJVStHGrtRzI+1UIvgtqfkYeC0oupAONeyaqBum8Sju4xgefIEpMJH8lDxCaqZ125KYv0lZooPDsdPY3M/0kqOPQ+g1WmcAAoQq/JlROn5EJHNpETcgh45RaEU42V+p3v6E2Kv9E3wrY3tw6SrGK2bSNpygmmNhBLVZdWO5SLbGusgWrvl7fzIgjqdkdpy4/hUbdfC6VgHff4DpdZndDLCInN0RtEa6tUWsSRe3/TUIam SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:34:17.8744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b969dfde-ffb2-4511-b6b2-08d54e325e6a 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 for session deletion, replace sess_lock with work_lock. Under certain case sess_lock is not feasiable to acquire. The lock is needed temporarily to make sure a single call to schedule of the work element. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gbl.h | 1 - drivers/scsi/qla2xxx/qla_gs.c | 14 ++++++-------- drivers/scsi/qla2xxx/qla_init.c | 9 +++------ drivers/scsi/qla2xxx/qla_isr.c | 4 ++-- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 5 ++--- drivers/scsi/qla2xxx/qla_target.c | 29 ++++++++++++++--------------- 7 files changed, 28 insertions(+), 36 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 47bff9ab1176..e9295398050c 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -888,7 +888,6 @@ void qlt_plogi_ack_link(struct scsi_qla_host *, struct qlt_plogi_ack_t *, struct fc_port *, enum qlt_plogi_link_t); void qlt_plogi_ack_unref(struct scsi_qla_host *, struct qlt_plogi_ack_t *); extern void qlt_schedule_sess_for_deletion(struct fc_port *); -extern void qlt_schedule_sess_for_deletion_lock(struct fc_port *); extern struct fc_port *qlt_find_sess_invalidate_other(scsi_qla_host_t *, uint64_t wwn, port_id_t port_id, uint16_t loop_id, struct fc_port **); void qla24xx_delete_sess_fn(struct work_struct *); diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 546011b1a765..6bfe24eeb402 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3047,7 +3047,7 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, struct event_arg *ea) ql_dbg(ql_dbg_disc, vha, 0x2021, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); } } } else { /* ea->sp->gen1 != fcport->rscn_gen */ @@ -3064,7 +3064,7 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, struct event_arg *ea) ql_dbg(ql_dbg_disc, vha, 0x2042, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); } else { ql_dbg(ql_dbg_disc, vha, 0x2045, "%s %d %8phC login\n", __func__, __LINE__, @@ -3436,8 +3436,7 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea) "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); - qlt_schedule_sess_for_deletion_lock - (fcport); + qlt_schedule_sess_for_deletion(fcport); break; } } @@ -3470,7 +3469,7 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea) "%s %d %8phC post del sess\n", __func__, __LINE__, conflict->port_name); - qlt_schedule_sess_for_deletion_lock + qlt_schedule_sess_for_deletion (conflict); break; } @@ -3528,7 +3527,7 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, struct event_arg *ea) "%s %d %8phC post del sess\n", __func__, __LINE__, conflict->port_name); - qlt_schedule_sess_for_deletion_lock + qlt_schedule_sess_for_deletion (conflict); break; } @@ -3959,8 +3958,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) __func__, __LINE__, fcport->port_name); - qlt_schedule_sess_for_deletion_lock - (fcport); + qlt_schedule_sess_for_deletion(fcport); continue; } } diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index aaa8c07b2d8d..9c08222e4c8b 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1091,7 +1091,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea) default: ql_dbg(ql_dbg_disc, vha, 0x20d5, "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); return; } __qla24xx_handle_gpdb_event(vha, ea); @@ -4964,8 +4964,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha) __func__, __LINE__, fcport->port_name); - qlt_schedule_sess_for_deletion_lock - (fcport); + qlt_schedule_sess_for_deletion(fcport); continue; } } @@ -5552,9 +5551,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) "%s %d %8phC post del sess\n", __func__, __LINE__, fcport->port_name); - - qlt_schedule_sess_for_deletion_lock - (fcport); + qlt_schedule_sess_for_deletion(fcport); continue; } } diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index a37a2a474a50..14109d86c3f6 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1009,7 +1009,7 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) if (qla_ini_mode_enabled(vha)) { qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1); fcport->logout_on_delete = 0; - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); } break; @@ -2701,7 +2701,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) comp_status); qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1); - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); } break; diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 8455058cd724..7397aeddd96c 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3896,7 +3896,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, case DSC_DELETE_PEND: break; default: - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); break; } } else { diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a64f67a562f0..b21878a70f6e 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3869,7 +3869,7 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *vha, int defer) list_for_each_entry(fcport, &vha->vp_fcports, list) { fcport->scan_state = 0; - qlt_schedule_sess_for_deletion_lock(fcport); + qlt_schedule_sess_for_deletion(fcport); if (vha->vp_idx != 0 && vha->vp_idx != fcport->vha->vp_idx) continue; @@ -4897,8 +4897,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) default: fcport->login_pause = 1; tfcp->conflict = fcport; - qlt_schedule_sess_for_deletion_lock - (tfcp); + qlt_schedule_sess_for_deletion(tfcp); break; } } diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 867d089c3ebe..72b452db26da 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1214,6 +1214,7 @@ static void qla24xx_chk_fcp_state(struct fc_port *sess) void qlt_schedule_sess_for_deletion(struct fc_port *sess) { struct qla_tgt *tgt = sess->tgt; + unsigned long flags; if (sess->disc_state == DSC_DELETE_PEND) return; @@ -1229,12 +1230,19 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) return; } - sess->disc_state = DSC_DELETE_PEND; - if (sess->deleted == QLA_SESS_DELETED) sess->logout_on_delete = 0; + spin_lock_irqsave(&sess->vha->work_lock, flags); + if (sess->deleted == QLA_SESS_DELETION_IN_PROGRESS) { + spin_unlock_irqrestore(&sess->vha->work_lock, flags); + return; + } sess->deleted = QLA_SESS_DELETION_IN_PROGRESS; + spin_unlock_irqrestore(&sess->vha->work_lock, flags); + + sess->disc_state = DSC_DELETE_PEND; + qla24xx_chk_fcp_state(sess); ql_dbg(ql_dbg_tgt, sess->vha, 0xe001, @@ -1246,15 +1254,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) queue_work(sess->vha->hw->wq, &sess->del_work); } -void qlt_schedule_sess_for_deletion_lock(struct fc_port *sess) -{ - unsigned long flags; - struct qla_hw_data *ha = sess->vha->hw; - spin_lock_irqsave(&ha->tgt.sess_lock, flags); - qlt_schedule_sess_for_deletion(sess); - spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); -} - /* ha->tgt.sess_lock supposed to be held on entry */ static void qlt_clear_tgt_db(struct qla_tgt *tgt) { @@ -2210,7 +2209,7 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) "TM response logo %phC status %#x state %#x", mcmd->sess->port_name, mcmd->fc_tm_rsp, mcmd->flags); - qlt_schedule_sess_for_deletion_lock(mcmd->sess); + qlt_schedule_sess_for_deletion(mcmd->sess); } else { qlt_send_notify_ack(vha->hw->base_qpair, &mcmd->orig_iocb.imm_ntfy, 0, 0, 0, 0, 0, 0); @@ -3905,7 +3904,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, "%s %d %8phC post del sess\n", __func__, __LINE__, cmd->sess->port_name); - qlt_schedule_sess_for_deletion_lock(cmd->sess); + qlt_schedule_sess_for_deletion(cmd->sess); } break; } @@ -4723,7 +4722,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha, __func__, __LINE__, sess->port_name); - qlt_schedule_sess_for_deletion_lock(sess); + qlt_schedule_sess_for_deletion(sess); break; } out: @@ -4951,7 +4950,7 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, } else { /* cmd did not go to upper layer. */ if (sess) { - qlt_schedule_sess_for_deletion_lock(sess); + qlt_schedule_sess_for_deletion(sess); res = 0; } /* else logo will be ack */