From patchwork Thu Dec 28 20:33:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135909 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 2808060318 for ; Thu, 28 Dec 2017 20:35:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 193782A23A for ; Thu, 28 Dec 2017 20:35:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DDD22C0FA; Thu, 28 Dec 2017 20:35:11 +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 752F92A23A for ; Thu, 28 Dec 2017 20:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755378AbdL1UfD (ORCPT ); Thu, 28 Dec 2017 15:35:03 -0500 Received: from mail-dm3nam03on0042.outbound.protection.outlook.com ([104.47.41.42]:45927 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754128AbdL1Ued (ORCPT ); Thu, 28 Dec 2017 15:34:33 -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=IjjGVA9QEjFyu+r30pTBLnrZRd/Col6nR8D/mcpS2V0=; b=ML4pLXLCkar+6egPOVXfZCclbZ8n1yfC2DH0qy4cmjb5phrKBS6toNNZ3J2k7Hv+VjV8eZTNu5U9VJ2QW/ch2Gr4aT+gZhSSqKrUfGEShJWaHVOP2NY4l7jzDIKSRWYJXe1xvTeTE7EBGrLtE75pCVDn4tLeWqtQ2XjQRg9RvgY= Received: from BY2PR07CA0016.namprd07.prod.outlook.com (10.166.107.11) by BY2PR0701MB1944.namprd07.prod.outlook.com (10.163.155.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 28 Dec 2017 20:34:31 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:190) by BY2PR07CA0016.outlook.office365.com (2a01:111:e400:7bff::11) 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:31 +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:10 +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:51 -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 vBSKXpbV002954; Thu, 28 Dec 2017 12:33:51 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXpgI002953; Thu, 28 Dec 2017 12:33:51 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 32/37] qla2xxx: Prevent multiple active discovery commands per session Date: Thu, 28 Dec 2017 12:33:40 -0800 Message-ID: <20171228203345.2702-33-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)(39850400004)(346002)(39380400002)(2980300002)(448002)(199004)(189003)(50466002)(86362001)(69596002)(80596001)(106466001)(51416003)(47776003)(48376002)(6666003)(36756003)(356003)(81166006)(305945005)(316002)(8936002)(5660300001)(16586007)(1076002)(42186006)(2950100002)(54906003)(110136005)(87636003)(478600001)(4326008)(72206003)(2906002)(76176011)(50226002)(81156014)(85326001)(8676002)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1944; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD044; 1:tPX+NSTYbIXdw5/zn1kOdHCyXZCT7wyPrAANkowK70a8kPWaSsD0axvqMLWGeEIaRla534Affodkote5hc4Xr6hxCEPPXrNaeAGkiwasoOe6mXUamdgj+q8HGAic4ePH X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea58a3d0-07e0-498e-04ac-08d54e325a32 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR0701MB1944; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 3:HuHmDH17XcKhydWP6jUUvtUyq3Qc6GJqVvtcd6kD11knjgknyilZP2pGV21jsHj8FB1A1Emiie7JrB9Nazo7vVUbQvdD/CNoW7qIpFCUiTv5XjXT73ZYo9nXoTmPIaFlj30QJVF51pj/GJGxeSGdaNYbaygRGXU8O0fsypC/PBtxZ/50s+QcQlnlsE3f+7a5MbG/N9nEoT46sLsWAGywVNsQePDyQJ+z7YmR4tQc2om0UJ4rShsNpbRwed8/UgAMu2oDFmNoWCDqIsZvkXRUqWbh2E58vyzUZGYWtskeNvCSuSQFx+JM+bceNkg3OZMDa3WFztICmRDs6bWSiPZ6Qw==; 25:7Pu5yAuvB86RyqInRFnoZMESbUpbN04tiWuidLMTSIZBVM945JLWonp1oI3ftCT326vjzhvaKjpNMSrK+QE+6t3Huu3LDAGzc5WyI/Idwv3fcH1uiuDdlF+mHmaql5jCi5OMc1nRl25s6N97d3o3AW5ltkrDDqEJJRoOGJ5KL+lKm8OwS6wgtbRZX81xwraU/+pqlNTHrvje7RNi8+WQyTgmSYEZf9gwwqDKcTftXmsTvT7aPf1H9q69xBOwqjuW/NecuCH99lNIOElOrLGnDZpzrxgNw/4s6zSSaNahlqZ/umDpCmgRGW9VLNEzdROxH1uY8S4t04g9GMLPASuqmw==; 31:hha85EjZrwDTK6yj3yx0tssU5JN3tZSd+ms7Qx6iWXyK8Mmg1LExKpSwQMbDdVz250rXQz3HVENu33WgK79txGB4sm5M3/4bP/FUtmHNfKIjrU4px2xAbvZpRQ5v4PaA5TA5zilPRVvzKjD8CfjgaA6NWlqpKrg2QPm16wQDFYpP4Iq0PFP8OUvnfjexByVAIYcjuNEK6/92ouHNRpQY8TsF8EgtwZxt6HkueNGEA5Y= X-MS-TrafficTypeDiagnostic: BY2PR0701MB1944: X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 20:ycscCiIrMEEkKfzmJ7UTwm2gpDlf02jQ+++KCJR3AJ9hs/H3jbg8IaIVDaG9Ceq59udSxlgZpWABEg1jdGQPUYsvAZYilSsXYWGZRKZwT/4rmUuasdt+s71V7QEQuwbIueA7ztwLUqy9DqJgvXd/gEgmnbLxVhcJPmWCx600l/WMmCEx/ANGkS8LDblUuWHwz7U0AJCNUBPC9Zit+xwJES59JG8B9Gx1o9yvlWSofLyKTvIvIyAzceepAndkcZ7oLJeM8cGAV9M00E5+LaVsOVlyAYKSh7a0fx1zSsGnprOtINbdDmVDh13RunKePIufdlHqBCdA5bwmmuvsa5lkH0vSZZXENeQ6wyJfZlnW7z7gJq+r3nft+KcVfzufIwYVqt/Cu3P5gWsT5DeloCfO50MVuJLLFR8DSpXCQqq4+HYZLnK8wzgaDAtl+ld3ZjI7TIgS6UBaUPw5CpzNuq7cDjvbT6I6fE1GPmtCIuyKpfqHE57syQX71Jmi5gxP7nc5; 4:Qo9YfCKtvn1t7aMGHJEZH7C2SO8pE0smyJr6qcC2w3QFiFrgATEgeNCCmnK/UVVGngF7s4qNuFH3LJVcWrQNB0h8e6mzzMcAXPS5D2gbwufgDSqPjGoKimIq2eSqxWEQx0Gd5o71J0YUbtScTo7rfVws8ihGDu1dBMRN1e46yRhcf+XJ5arLUDONHaUPQd7CDKUkwnp76BQAP/jvXVepfDUDDfyXDTt+Zc7aVMrDWGuVrzcaDYdvORlBexFZSde4EYNGYlvYsuydUMArAyqGihQHZYccOUuafZII2132I19kkIBs61VkGbEbq8IN/MN2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(944501075)(93006095)(93001095)(6041268)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:BY2PR0701MB1944; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0701MB1944; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1944; 23:NLHB1DWhPTW0HH4yuh9we+F5u6ONyPhPjozJCa0?= =?us-ascii?Q?3cuJyrb9xPKEUmEHy5mfJUjJTtpdy3Y2MZWVCjgK2ygeQgbY7XRVkBr/vlKV?= =?us-ascii?Q?y92E30FV0Drr4yrxXPqhruWN+pIqJgiwZ4y4Q9dGODAN35G3myEzh1wZ+0eZ?= =?us-ascii?Q?mGRrxrIQOwe/Vg6oyOh7bIsKjUfaFCD2JTuCQ9Eut5fIc3MQfUB4kYVMX2Yy?= =?us-ascii?Q?llm50+TrEenOIfBhQFj8kpiPxj2SD2yGkZeLW5KmlQ0dZ5uBItB6AqBuCQHf?= =?us-ascii?Q?O2+UHxyQhvojXVJQSswqwWBGxWtMaWC5XKGObHNZHj+hxZkcnlFFY9I7eD3p?= =?us-ascii?Q?AG4hrkcT591btL2DBqEJmCLCGD0qTSZ1jQ20t+raBWIYzuqBrcBah5J8yCbq?= =?us-ascii?Q?ECPZknhLND3yU3TYfF8ZeZx6tH4Ao6AXo350f0+noPMTjtaC9ouk0NCyb+BO?= =?us-ascii?Q?BkySiY5HOlxCzv3mEQZG4zxhwB5aC5RnuLVNgTEYW02R9bZ77d8RDPnUVuwP?= =?us-ascii?Q?GGbmijHrqHD2zVhA/mkj2gsRVW3U9I0dQYWKwTwuvf+VNKo7SQNNChEFdnZl?= =?us-ascii?Q?Qau4VxnRcF/s76mpJSKtZAi1B+bPErlCvz28WdyQpnjCemMO/7Fx5oNzjo4S?= =?us-ascii?Q?5sjc2PMQb9bwZJknvIYfbxgzmd4NkkALD6xaTTcmbJnpH+raYhyfcxD7C9cd?= =?us-ascii?Q?+nBBxLU54eyX8O+utejnz7u241DdGByfiYwihRrrZmt13K0YKWCqCfY9Plo1?= =?us-ascii?Q?ntqbqYt7FxRpRCNgOaaMyzaAr9ELz6arB702ujn7yXS3iyKgyrU/ksE7pPvH?= =?us-ascii?Q?WB1Nr/jyzBDwT8HqRurzWCAgWJecnE8Bw2Cr3VMakYDZSI/4uPs1jl6n7QcC?= =?us-ascii?Q?DerG/1R4X3MiQkXi69BahpjTOeVHhAiUJX0eW2rH5eMWGaOr98kyp6xEDUIE?= =?us-ascii?Q?iKYb01M3jhMwXIS+Tutrs7bUgUL75SZ0z8Bn8gMVUwGD4j6P1/D+QJeZQv06?= =?us-ascii?Q?ezcSqV72yTSJwdb1V/w1hNc3j?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1944; 6:fZ83DePKu0dgxNAnUDuSTGW4/LN/UQl+o3UrMimymQkee3X0wSsQJMTjz5Q5q31mNU8zlqPuuCaFX9mIZCzrDKVLjAYRASR472ttAWaw0fcqUzG76SDpjaDVUioBybHhGaS17IChFlqc8nVK6KAr/Uqdfy33Mfuo8Qh7pIAJEX77qkzC2Ay7HZsrbrZvjibM4zOMlcUkUt3Eq+tvavVBM3ILVu0dIpDgYMyJcauJcBrieV3uAaSoTPEg7f9WBh51/TRvIqdEYFhXtY1E0zOT33M6HtHOJ2fSfEr+KAljCcInUIocAcHs5V5fLgC73nVYH/zXkwNweKQLYp0VJ0vsEe7l64zjN0mn4cS8nzyfMic=; 5:OiRP1yLD16j+SDnIa7qG/fDjGjaY9zBXLfaHzSOEjG4ipMQV6Cw6jhe0+dKmdshPiW6SOm+k3SIjiOIAm3HlBJQlfmOu4Tdodo1RsmILjPfaqTYpHhwCE0ATQY/pXs9Ntg9n6w1KZox2vUDIVHy1Zp89RMmor+l17idSz3TO1rs=; 24:AR93bq9m9mf5Cwli0Q+BCTSp/8oig8lGcECoGSYQjIqqhJuFRdked5j3XZ8+tHGtugz4cI5EwKO8O541kT9zgiN60c7iMZQxic7a7qLk7qA=; 7:uhFWCHQLXzb4GhtfIgn6AgBhZ9ICHlYH4DSC8+X8eu/RBIRVBqvNFxX7sic+KbfHlBXvBwsL1Z45/cDFxeUNf6nSscWTnGVeJv8hRMNuu83xn4dLBTjP9z9dj61fH5Y3a3JnNSnxyfR2RDvxs0DG48FbKoSH2H5hfHu9OOGfT1fnFNjWFxSX8uvozlYjiWxQpHy9MMm0fEjrRxWtIEAEjQe4JJ3xLFRzHbALQ1jMlXnnF4zOSanI/wrjdajfyaAe SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:34:10.7919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea58a3d0-07e0-498e-04ac-08d54e325a32 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: BY2PR0701MB1944 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 check to allow single discovery command per session to be sent Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gs.c | 34 +++++++++++++++++----------------- drivers/scsi/qla2xxx/qla_init.c | 30 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 8e09f6f16643..abc31b983b93 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3127,16 +3127,16 @@ int qla24xx_async_gidpn(scsi_qla_host_t *vha, fc_port_t *fcport) struct ct_sns_req *ct_req; srb_t *sp; - if (!vha->flags.online) - goto done; + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; - fcport->flags |= FCF_ASYNC_SENT; fcport->disc_state = DSC_GID_PN; fcport->scan_state = QLA_FCPORT_SCAN; sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC); if (!sp) goto done; + fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_CT_PTHRU_CMD; sp->name = "gidpn"; sp->gen1 = fcport->rscn_gen; @@ -3177,8 +3177,8 @@ int qla24xx_async_gidpn(scsi_qla_host_t *vha, fc_port_t *fcport) done_free_sp: sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: return rval; } @@ -3319,14 +3319,14 @@ int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport) struct ct_sns_req *ct_req; srb_t *sp; - if (!vha->flags.online) - goto done; + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; - fcport->flags |= FCF_ASYNC_SENT; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; + fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_CT_PTHRU_CMD; sp->name = "gpsc"; sp->gen1 = fcport->rscn_gen; @@ -3366,8 +3366,8 @@ int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport) done_free_sp: sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: return rval; } @@ -3780,7 +3780,7 @@ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport) struct ct_sns_req *ct_req; srb_t *sp; - if (!vha->flags.online) + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) return rval; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); @@ -4337,15 +4337,15 @@ int qla24xx_async_gnnid(scsi_qla_host_t *vha, fc_port_t *fcport) struct ct_sns_req *ct_req; srb_t *sp; - if (!vha->flags.online) - goto done; + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; - fcport->flags |= FCF_ASYNC_SENT; fcport->disc_state = DSC_GNN_ID; sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC); if (!sp) goto done; + fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_CT_PTHRU_CMD; sp->name = "gnnid"; sp->gen1 = fcport->rscn_gen; @@ -4386,8 +4386,8 @@ int qla24xx_async_gnnid(scsi_qla_host_t *vha, fc_port_t *fcport) done_free_sp: sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: return rval; } @@ -4474,15 +4474,15 @@ int qla24xx_async_gfpnid(scsi_qla_host_t *vha, fc_port_t *fcport) struct ct_sns_req *ct_req; srb_t *sp; - if (!vha->flags.online) - goto done; + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; - fcport->flags |= FCF_ASYNC_SENT; fcport->disc_state = DSC_GFPN_ID; sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC); if (!sp) goto done; + fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_CT_PTHRU_CMD; sp->name = "gfpnid"; sp->gen1 = fcport->rscn_gen; @@ -4524,8 +4524,8 @@ int qla24xx_async_gfpnid(scsi_qla_host_t *vha, fc_port_t *fcport) done_free_sp: sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: return rval; } diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 6452f4c8df5e..93febc177aa7 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -207,7 +207,6 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, lio->u.logio.flags |= SRB_LOGIN_RETRIED; rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - fcport->flags &= ~FCF_ASYNC_SENT; fcport->flags |= FCF_LOGIN_NEEDED; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); goto done_free_sp; @@ -222,8 +221,8 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport, done_free_sp: sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: return rval; } @@ -245,9 +244,11 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) { srb_t *sp; struct srb_iocb *lio; - int rval; + int rval = QLA_FUNCTION_FAILED; + + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; - rval = QLA_FUNCTION_FAILED; fcport->flags |= FCF_ASYNC_SENT; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) @@ -715,14 +716,13 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport) unsigned long flags; u16 *mb; - if (!vha->flags.online) - goto done; + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; ql_dbg(ql_dbg_disc, vha, 0x20d9, "Async-gnlist WWPN %8phC \n", fcport->port_name); spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); - fcport->flags |= FCF_ASYNC_SENT; fcport->disc_state = DSC_GNL; fcport->last_rscn_gen = fcport->rscn_gen; fcport->last_login_gen = fcport->login_gen; @@ -730,8 +730,7 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport) list_add_tail(&fcport->gnl_entry, &vha->gnl.fcports); if (vha->gnl.sent) { spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); - rval = QLA_SUCCESS; - goto done; + return QLA_SUCCESS; } vha->gnl.sent = 1; spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); @@ -739,6 +738,8 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport) sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; + + fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_MB_IOCB; sp->name = "gnlist"; sp->gen1 = fcport->rscn_gen; @@ -773,8 +774,8 @@ int qla24xx_async_gnl(struct scsi_qla_host *vha, fc_port_t *fcport) done_free_sp: sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: return rval; } @@ -898,7 +899,6 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport) rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - fcport->flags &= ~FCF_ASYNC_SENT; fcport->flags |= FCF_LOGIN_NEEDED; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); goto done_free_sp; @@ -940,16 +940,16 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) struct port_database_24xx *pd; struct qla_hw_data *ha = vha->hw; - if (!vha->flags.online) - goto done; + if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + return rval; - fcport->flags |= FCF_ASYNC_SENT; fcport->disc_state = DSC_GPDB; sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; + fcport->flags |= FCF_ASYNC_SENT; sp->type = SRB_MB_IOCB; sp->name = "gpdb"; sp->gen1 = fcport->rscn_gen; @@ -995,8 +995,8 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt) dma_pool_free(ha->s_dma_pool, pd, pd_dma); sp->free(sp); -done: fcport->flags &= ~FCF_ASYNC_SENT; +done: qla24xx_post_gpdb_work(vha, fcport, opt); return rval; }