From patchwork Tue Mar 5 10:58:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saurav Kashyap X-Patchwork-Id: 10839267 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 A8A951803 for ; Tue, 5 Mar 2019 10:59:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94F1E2B2A9 for ; Tue, 5 Mar 2019 10:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D512B352; Tue, 5 Mar 2019 10:59:30 +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 187522B2A9 for ; Tue, 5 Mar 2019 10:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbfCEK73 (ORCPT ); Tue, 5 Mar 2019 05:59:29 -0500 Received: from mail-eopbgr680058.outbound.protection.outlook.com ([40.107.68.58]:50563 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727322AbfCEK73 (ORCPT ); Tue, 5 Mar 2019 05:59:29 -0500 Received: from BYAPR07CA0007.namprd07.prod.outlook.com (2603:10b6:a02:bc::20) by DM5PR07MB3002.namprd07.prod.outlook.com (2603:10b6:3:e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Tue, 5 Mar 2019 10:59:26 +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:26 +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:26 +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:23 -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 x25AxNYR013248; Tue, 5 Mar 2019 02:59:23 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x25AxNCB013247; Tue, 5 Mar 2019 02:59:23 -0800 From: Saurav Kashyap To: CC: , Subject: [PATCH 07/26] qedf: Use a separate completion for cleanup commands. Date: Tue, 5 Mar 2019 02:58:42 -0800 Message-ID: <20190305105901.13185-8-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: 131962571666211920;(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)(346002)(376002)(396003)(39860400002)(136003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(26826003)(53936002)(1076003)(498600001)(48376002)(50226002)(2906002)(8936002)(97736004)(8676002)(81156014)(81166006)(68736007)(6862004)(105606002)(356004)(106466001)(86362001)(50466002)(87636003)(4326008)(126002)(305945005)(486006)(6666004)(11346002)(336012)(446003)(476003)(2616005)(51416003)(54906003)(36756003)(2351001)(316002)(42186006)(16586007)(76176011)(47776003)(80596001)(69596002)(26005)(5660300002)(85426001)(14444005)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB3002;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: 78610929-de7e-40b5-deb4-08d6a159a238 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600127)(711020)(4605104)(2017052603328);SRVR:DM5PR07MB3002; X-MS-TrafficTypeDiagnostic: DM5PR07MB3002: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0967749BC1 X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB3002;23:njY6O/lPSNwXGKLz5U/hiUjP/pRNKT6tNf532CtsryZdjVfwAuRFtUvCGfRqmUQPSEy6c3iivZbMzacOOV9EWYzWPQDhAkf5rBBQFlBp4vkLADOIvn9mao0XtKYVLKv6hVXj7/Is2evhpdWRCH3kYVRNzksNDHBLGNWf1mLN1OGtu8DqGm/7GDhMiZ8yARocY/Iy9i1EOQDEOr3KlO2Uwntoc0Gv727RbrAeJcTsA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-Antispam-Message-Info: 0HpS3E0fjgqIWkIlwfhphAuTXgYDt/4sIo/oDjS2bZFxg/vTMkzDU2faAkgDJ5fIZDLdSeILNs/e1TmpERShpOEa/SxiOxVg/8ESKGKyFrj8KxbVOxx5WnKSP2tBYkbk3rJi9yQ4D4VPGxVny3k+i9gFkqz+x3XdH8weM0XQKFyhOlezVEUkdfrzJiWdcbRZG976fvSIn4+C7Itsps8OEKs9p+PYT8oPwWO82ezZD8tZNGkYj5jc0Jy4dPkUHVUeFw8f/WRUSLAODKxmIKB5tg05CON0ZRSFdw7CM7DhZRBSgV1F6+0ePT0SO5ykkjVmRgvn1/RRtHX7EXQg6uTocAYdqYJmV4+EoZnsOsyjbLojfmAd3JbkmqcKtzn9yVCC1CIvtREZrnuqXHncynWDyWGdrisQgLLLZtdA+6PTu40= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2019 10:59:26.2780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78610929-de7e-40b5-deb4-08d6a159a238 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: DM5PR07MB3002 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: Chad Dupuis - If a TMF and cleanup are issued at the same time they could cause a call trace if issued against the same xid as the io_req->tm_done completion is used for both. - Set and clear cleanup bit in cleanup routine. Signed-off-by: Chad Dupuis Signed-off-by: Saurav Kashyap --- drivers/scsi/qedf/qedf.h | 1 + drivers/scsi/qedf/qedf_io.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h index 9e5e183..fb7d0d5 100644 --- a/drivers/scsi/qedf/qedf.h +++ b/drivers/scsi/qedf/qedf.h @@ -128,6 +128,7 @@ struct qedf_ioreq { struct delayed_work timeout_work; struct completion tm_done; struct completion abts_done; + struct completion cleanup_done; struct e4_fcoe_task_context *task; struct fcoe_task_params *task_params; struct scsi_sgl_task_params *sgl_task_params; diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 044ef63..1a36ab5 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -2065,10 +2065,13 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, io_req->xid); return SUCCESS; } + set_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); /* Ensure room on SQ */ if (!atomic_read(&fcport->free_sqes)) { QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n"); + /* Need to make sure we clear the flag since it was set */ + clear_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); return FAILED; } @@ -2094,7 +2097,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, task = qedf_get_task_mem(&qedf->tasks, xid); - init_completion(&io_req->tm_done); + init_completion(&io_req->cleanup_done); spin_lock_irqsave(&fcport->rport_lock, flags); @@ -2108,8 +2111,8 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, spin_unlock_irqrestore(&fcport->rport_lock, flags); - tmo = wait_for_completion_timeout(&io_req->tm_done, - QEDF_CLEANUP_TIMEOUT * HZ); + tmo = wait_for_completion_timeout(&io_req->cleanup_done, + QEDF_CLEANUP_TIMEOUT * HZ); if (!tmo) { rc = FAILED; @@ -2153,7 +2156,7 @@ void qedf_process_cleanup_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe, clear_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags); /* Complete so we can finish cleaning up the I/O */ - complete(&io_req->tm_done); + complete(&io_req->cleanup_done); } static int qedf_execute_tmf(struct qedf_rport *fcport, struct scsi_cmnd *sc_cmd,