From patchwork Tue Mar 5 10:58:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BDA017E4 for ; Tue, 5 Mar 2019 10:59:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC8F62B2A9 for ; Tue, 5 Mar 2019 10:59:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E13332B360; Tue, 5 Mar 2019 10:59:42 +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,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 905082B352 for ; Tue, 5 Mar 2019 10:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbfCEK7m (ORCPT ); Tue, 5 Mar 2019 05:59:42 -0500 Received: from mail-eopbgr760087.outbound.protection.outlook.com ([40.107.76.87]:40672 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727477AbfCEK7m (ORCPT ); Tue, 5 Mar 2019 05:59:42 -0500 Received: from BYAPR07CA0007.namprd07.prod.outlook.com (2603:10b6:a02:bc::20) by CY4PR07MB2998.namprd07.prod.outlook.com (2603:10b6:903:cf::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.16; Tue, 5 Mar 2019 10:59:40 +0000 Received: from BY2NAM05FT031.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::204) by BYAPR07CA0007.outlook.office365.com (2603:10b6:a02:bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1686.16 via Frontend Transport; Tue, 5 Mar 2019 10:59:39 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by BY2NAM05FT031.mail.protection.outlook.com (10.152.100.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1686.5 via Frontend Transport; Tue, 5 Mar 2019 10:59:39 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 5 Mar 2019 02:59:36 -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 x25AxaAa013268; Tue, 5 Mar 2019 02:59:36 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxaUU013267; Tue, 5 Mar 2019 02:59:36 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 12/26] qedf: fixup locking in qedf_restart_rport() Date: Tue, 5 Mar 2019 02:58:47 -0800 Message-ID: <20190305105901.13185-13-skashyap@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190305105901.13185-1-skashyap@marvell.com> References: <20190305105901.13185-1-skashyap@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131962571799135867;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(76176011)(498600001)(26826003)(85426001)(36906005)(50226002)(36756003)(126002)(14444005)(80596001)(42186006)(51416003)(476003)(16586007)(26005)(486006)(87636003)(69596002)(1076003)(316002)(6862004)(2906002)(4326008)(6666004)(356004)(97736004)(305945005)(8936002)(47776003)(48376002)(50466002)(86362001)(68736007)(81156014)(81166006)(8676002)(5660300002)(336012)(106466001)(446003)(2616005)(2351001)(53936002)(105606002)(54906003)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2998;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84dbecfd-d0d4-47fd-90f4-08d6a159aa32 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:CY4PR07MB2998; X-MS-TrafficTypeDiagnostic: CY4PR07MB2998: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;23:fiRkZ5kU2sC03yQZ9YwhfkgsggUuZSgOeQuGB4mAp6mNORf17WJaUQGg5zlJobdI68XCYer/8VLuk22tmYk6hqzMHU825tmMul9kdlSbF8b9AYu+Rjqu3UY+QLLSIMS5S5600othgXUY3lrvKzD5rXJtEMek8oh4AAAgfneWVQNceSIkbuCFFny/XQ5duXfI26/ivtdlTBpttFNzCmXz7iPeyZOjNDXtt0KXXPcurX036aw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bpsJVkHhWtzurTtsCMme1pR8lowKGRP9B4s9ZJw5iC3X3ZeLVazY3gh81V3bbIdDyGx9Z90WUIj1LW1gTJh5z1fuEn+tznnJxI0TKQeQ8sAfTBo6Q3jO+dMQ8htfUiHmsprYrEq2OA8tVPH72yOfiL3m4PJI+7Iz1ve2mD8IV0p1AYZtBcfT3rRZcX8BcjGCtJhPR4ZDf2mk45LU19CnJLt1Zmk8TrMhJJCnvSx9h4jgvJPv5A7gE4SwonbRKQkDr6WR8bQuZ6oouRpBS7L0EymcYwStPHTIUJ/jTxeEesQwJysAYgtp1tRbEfMUz/zXuxvQqeporQittw4B3l9K0FBB3ZqUw2qIj6tSDcUH6W97Z1yxRUS6YutEmFpzCQwov/eTVQwGNI5fps8kPUyCYVDkwlhLVMag= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:39.6613 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84dbecfd-d0d4-47fd-90f4-08d6a159aa32 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2998 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: Hannes Reinecke fc_rport_create() needs to be called with disc_mutex held. And we should re-assign the 'rdata' pointer in case it got changed. Signed-off-by: Hannes Reinecke Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf_els.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index ac2bfc2..aad1f7c 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -380,10 +380,16 @@ void qedf_restart_rport(struct qedf_rport *fcport) QEDF_ERR(&(fcport->qedf->dbg_ctx), "LOGO port_id=%x.\n", port_id); fc_rport_logoff(rdata); + mutex_lock(&lport->disc.disc_mutex); /* Recreate the rport and log back in */ rdata = fc_rport_create(lport, port_id); - if (rdata) + if (rdata) { + mutex_unlock(&lport->disc.disc_mutex); fc_rport_login(rdata); + fcport->rdata = rdata; + } else { + mutex_unlock(&lport->disc.disc_mutex); + } } clear_bit(QEDF_RPORT_IN_RESET, &fcport->flags); }