From patchwork Wed Apr 25 13:09:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dupuis, Chad" X-Patchwork-Id: 10363185 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 1EA896032C for ; Wed, 25 Apr 2018 13:10:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F3C928E02 for ; Wed, 25 Apr 2018 13:10:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0364528E28; Wed, 25 Apr 2018 13:10:01 +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,DKIM_SIGNED, DKIM_VALID, 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 01D1728E02 for ; Wed, 25 Apr 2018 13:10:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753996AbeDYNJ7 (ORCPT ); Wed, 25 Apr 2018 09:09:59 -0400 Received: from mail-co1nam03on0071.outbound.protection.outlook.com ([104.47.40.71]:36427 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753324AbeDYNJr (ORCPT ); Wed, 25 Apr 2018 09:09:47 -0400 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=iyx79D/o60cwW2CqVFBof2DlC1aa1uZdm7qRNppZGuQ=; b=ectabvA3f0sUXVecBAzlObvOr42HOsFk+snPBvoxOKmGCgeHHzlDptSJJL4ZwS67vE+tS+5/6+te+/h0b1eChv0eTJRlrjY7s93DeWhTHArT56IkPZWjTw/1apOtaBXg/6Qy16A5WvdQeuHMoz/GKUX7v8k7tMp6zjmNL2/Btag= Received: from BY2PR07CA0078.namprd07.prod.outlook.com (2a01:111:e400:7bff::31) by SN1PR07MB1517.namprd07.prod.outlook.com (2a01:111:e400:5838::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.14; Wed, 25 Apr 2018 13:09:45 +0000 Received: from BN1AFFO11FD013.protection.gbl (2a01:111:f400:7c10::117) by BY2PR07CA0078.outlook.office365.com (2a01:111:e400:7bff::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.696.13 via Frontend Transport; Wed, 25 Apr 2018 13:09:45 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD013.mail.protection.outlook.com (10.58.52.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.653.14 via Frontend Transport; Wed, 25 Apr 2018 13:09:44 +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; Wed, 25 Apr 2018 06:09:24 -0700 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 w3PD99fH006496; Wed, 25 Apr 2018 06:09:09 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w3PD99qY006495; Wed, 25 Apr 2018 06:09:09 -0700 From: Chad Dupuis To: CC: , , Subject: [PATCH 19/21] qedf: Add more defensive checks for concurrent error conditions. Date: Wed, 25 Apr 2018 06:09:03 -0700 Message-ID: <20180425130905.6385-20-chad.dupuis@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180425130905.6385-1-chad.dupuis@cavium.com> References: <20180425130905.6385-1-chad.dupuis@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)(39860400002)(39380400002)(346002)(396003)(376002)(2980300002)(438002)(199004)(189003)(478600001)(86362001)(47776003)(6916009)(51416003)(6666003)(186003)(50226002)(76176011)(50466002)(69596002)(2906002)(87636003)(80596001)(81166006)(81156014)(2351001)(54906003)(8676002)(48376002)(106002)(356003)(16586007)(42186006)(316002)(26005)(446003)(5660300001)(106466001)(1076002)(486006)(4326008)(72206003)(59450400001)(44832011)(11346002)(36756003)(126002)(107886003)(336012)(305945005)(2616005)(476003)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB1517; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Pass; LANG:en; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD013; 1:Cx3GszsvCxRZf4wxnrhngsPVl/OK1+vDS6iG3b1MvV+VQ32p+L7XZfSPmeS8SK5bqEhP7gtIMCIIsMRYBFky5bWiBJvm0XGFJMiQGBDxwdLNlaWKffDV0+kAEVDAA9wO X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:SN1PR07MB1517; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1517; 3:3fJ3497G4AtNXRbcF+1b4drwRxVukK4rh80XAyo+IcWm2cFCJyQJ/jVgh4vF1e1hROVWNrl3ONq+bTaHdxLfqhJWlYs9k8BzAsa9mzJuydCXviAU+pbtgDtbnQQk+67Vgu3IELmAQn6w1sVXpTWHUF8YMKBW52OXG81qLpE0Ka8jxG34D2GyDocFiEQXOdkP7HVv82ZXnlNsgsBPb39ZHnkZwAQwc0hl5GhRj2+8uXBz9HYKe5UCsEQyvX+zOfB3gCi3q6tU56fUFkv8hZ6l0pxYPu+v+yAKtCJl/Jo0B+8IRs6eL80/S7yLhwqkUUlSFw3UWMvam3DGkb28W3LaG6qvmyVGgUmv+lUilFTnTcU=; 25:t+bykMuclkDeXnq4r5dc0L0S8fiGSu0R98zseYJ5Q4/gLiz/hZ9FgIwcs6PxM6TlbIwdU4sdUc+/GKdblkEsTC4UmEmbfwVAPP/43lBGyBckyu1MPhrb7EdU/dJXHpxdkeXWZvihSVBzanH65jAFQxmXP5QIaWJC7G12Y3e3Rk9ZMOvcnvDlDNAlVUBBl5/gE3g3HS5TUkmYB5kUSqPnW9oE/w6oKDct0RUD3QRU26D5gDAlDJjhCIUUuPXmYfdaNtHmSFC09kDo1DL0kLgNaHUpgkmoJnFkQymPfz9MkW9Q1EvLEGxtRMNLVwEC1q73ff0btc3cguxzO8EXAwZxJg== X-MS-TrafficTypeDiagnostic: SN1PR07MB1517: X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1517; 31:JOKRa3NvVHPVA/IFmblPzm6tieB4s26Bnjk2oYHMM/SZ7xkjwkWBuuRs5XZJsDINjUXxRwh9WLE+zThy8NDYOGMfpdfv1+4L3p1N+Z4OVGJ3MxoZEA9HIyb49ohXK8sLz2L7RmFXbqNCbWDIhxU/5iXZnjxP3gfbKpMnXFdzqkIAiNziXOapcaXHyIk4V8rSZwZ3yzhjgtS39zX25VgxW4HYyDkNBS+yHooiKknuBtQ=; 20:rbGDiIYZDQhzzw82DxmI/WSM6sSJPsWsRhQCLAXE0bMBRMA57o1IDGC2auKeg+K9NBTTO1ZG6AymcLlpczmwl1SwRWTvntMbPqAfdaKdZXUl2YkgcCNO2+W7TZUfupDmLkR0BgokS1u4DUsouQ03ncy/7RE2sIKURogrvzC7j0FFIbhArOm5SFpwWH/wMLkOaA/VhdhW/zzM82xHVTHINpfKawOhfopvRmCscRdS0oGOSmxFyyTuSgYQRHLwv+zn2ceMY1ggz7up73ih9oOLKAKWS8EbK6a+ju4k38R5P/SEkzA4dU7RQbFPiswMnWBc4e5Pzc9ijBuhfdoxqGmLzX31uHOOS/oVyFuIirRRI/TNz0BDnLirXUaB/Ct5IaTCzlG+nQ75+wx2EQeqAgxLuY6JV9+9f8YmsWfcs8XHrdWmYc/dVeOjU3uQL5RNGWe9chTWaByX3yJbe4heDgBeiH2NcKddR3puQoXPAIiKylUR/FSw352kB7u9E+HWbpI8 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231232)(944501410)(52105095)(10201501046)(3002001)(93006095)(93004095)(6041310)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN1PR07MB1517; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB1517; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1517; 4:Y1XQa4MA7Nn0KDHA5ni+K2C4oD/SD44AOVlQM4Zol8FBCDqfRIpIfvSMO4dG4p6XOEZC73B63sZGq/xZx1GQsg5qDWxACvfXxP5celMt9EiKxP7H12fAEn+0PfW/Vrk+fPpATAE2/njAD5T7RMRSMeF43IKTR+3zF/wLlzkhu/GmrMCxmXsX0fDzFrvmrcIM/7dtVx0iHVe0b4NJbGArsaN21wIqQV5IuaOEFyuG8tZv5VEcd0gojHWnXqwNi/jqNy8XO5poYvBNHaopSCHZyA== X-Forefront-PRVS: 06530126A4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB1517; 23:DaUdyuBLI8UullT/cqPd9sm0UpurpduTZCCpsKeDO?= =?us-ascii?Q?62qesOJOaJfrnR921SVuhaXlZF1SO7Xrx9WKrZ2K+gBfly5HV9ldVWUf3TuR?= =?us-ascii?Q?8y+TQWi1WjMZ9jflDk275zk5NMxA5gqNsdFLRXaHVveW3ZVtDT6WZvblsLy/?= =?us-ascii?Q?OTd4tiYTsSSKoXv60ubhAn+WuJFUiv/v1g5jlUxZFVaMo4Fye9+nkEMz8tmy?= =?us-ascii?Q?nca/gEFNSQiBHL4BM3pTfChXIcBurf9+dwgarJkiTKDHAnHC0UAa6Kx5lQuo?= =?us-ascii?Q?rSoCSLf3sNeQKJyhmVIT3r/8pjWy860BTFBRPOL1CroygseaTfISSpeaO0Sw?= =?us-ascii?Q?v4PaHo9SKuqurwLsM7u+tQwJNvp57WiQNkE4q9ZrOdGT8IAccQCW0PhqikIA?= =?us-ascii?Q?NKXbJXuEvMso5C4XGVEzGto6HL+zTA7zqAkj0tU69bVUeuWvxh49Pi/OoiXg?= =?us-ascii?Q?iFGWZrZpTaqSJsyPr+Rkua7Jq8Ruvzvx6TN0OhetP/Ws8EIkRpcYuM95uyGD?= =?us-ascii?Q?jzp9tmicDqEBG0Xe0t40kBr7Q3QTzJwaPqKeE/O3T3DXPF3OGIN7qe+JXNGl?= =?us-ascii?Q?wGlgC4hPypFJvRx30EJGYF0HbVubHt0T6Mmng5CDqqITiMv2eYNm1SQA+AdF?= =?us-ascii?Q?qsOTPEOaOZQF1p9S/ABtokLacM60Uxllcwxrqbkd0XAGZonmjtpaPc/0BUJl?= =?us-ascii?Q?sPe3wiHttWYjirPZ34JAtmoiZKWzGTB6GO8QnFnz87vn67g0R6/WpDcnyFw2?= =?us-ascii?Q?thYWb16cYhTD0kft8Vw7cWHfL/t4oiARUU5zSd4szRSQtGuAj7SvjPyatguq?= =?us-ascii?Q?Fqt6DDouYKgIv/rbePNnsGcsewXbiBjfwV7+r/7K6yQxmmzqT+MlXrt8i/WP?= =?us-ascii?Q?Uj2/OuSUxp8y905bphLoqsJ/ShW7uT/mJHeLaGzSSEKdS3ZjCWczAJTUq4Fz?= =?us-ascii?Q?MyrbsoJdS1pGofZuJ1BEu6KILQmQb5CKeK4sj5CwXaHSXvGvsFygbr2hId9m?= =?us-ascii?Q?mCrl3sw8XIOFi0B5gA+kGTMf5b0OKeiUH2YgctAdTu8LGf5Yj+4mkCyNpaAk?= =?us-ascii?Q?qx2ltyAMdqYby7XIYPyLanRuPcdI8hjbRgHKJlvAHcVdjhLRXqjl6oUyCCLj?= =?us-ascii?Q?b0aTFRa/E/hELXVF6ePHLm7CrQ88vj9IzKlx7+SZ9g046roaOBb2aPzHIAyw?= =?us-ascii?Q?pM3ikTc2OOzD8s=3D?= X-Microsoft-Antispam-Message-Info: ODdip6m/uMMULr46NZffCC+q+jEsplhZ2SIYqHVlHXD74WbLhpC21ybbdl4u70Ad9q25ruplij9YEFnohd71ap2conAp1GP6mcIbW/VbfLUUFCaGQitsIFKVhNxRNfL1KH5ezenWOQ+Nupe99QOaBpb2OPhn9Q2hUydJ+8YkYiGNbKHhXSCVGX/02zCpdemN X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1517; 6:4x1GeueH1E3iNaCKe82W7DMVblxmv8qkkghS8EP9AlFGK7ts5VEFDtWTaKzZ060Y1mIA/YQ7Syi00lYk4fto4B06V0E8m0JyXWOzVcS5odkZ4yT9iyUIku7BX8Npl0n9JU2NVL/TgLTDlvylG00+u38HY9N5uu405E3MP0Nx7RngtGhxRNfc0cIfEznIJX7oVyRWcKNzHCV28D5/g2QrFQtnzTLd2BbzmCx4tkoQARijuwSIYzyD4Wptba1ncyIhG0HiAXd9EBqTniZaKa9zYIYpnwmN/EWpGSZfZQf7TC13YT4OfINwLYZXwwc70dPCapH0548/DI5+qNZgQCz6rr6XRDU1GumuLDZjRo6soUtXY6evODxkH31K3ngcVru7C8s5y4DxyXpiSz/iF0lD/RvKwwcCNaYfVVn6g8fIFRJAd5aqd1c22vH7fiR7pmCQ+3AtQ8X4qJhgCmWAQ9PY5A==; 5:k87QsjWn2qJw1iqXoAN5LQ9CaJToxeM0cxOAUKcf+MO07VtSPxMN9tjDWpG2agSfxlGCA8UgQJXFqcNl7h7ouArElQlf8Ok0oGmVwxbcNeofaKGnBw6zUgU/f70rEKYE1tw87if/4TOptCXJgjfxd4MQZbqsgdkDDSvkNxMx2aI=; 24:C/PmazknIQoFrw67F4/FuLhezQcJ6ntV0CafpppchWXYwThebBIFamMCKwdEbIFOLJXpcbiywxWUHL8xTax9KQTgfDDflIan1sjtvanFZ3I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1517; 7:6GY4X8nxxbSfsR6W89M6oq0TDDzgiWFI+q3NfuUgEmDRV6i+GzbIdA8Usp7guVD58/XqiDGPcvoZSKbkB/6/a3PDcadjapJCGCw/8dP86TSjQvBuTb5kn/hIsyvBe/n9+zWqXhry+CPrPb7mnaOK+LsIirtqyart7wLlXBZYf+471oKvoi1rR6ljopBJX5lpP62Bliz2LF8yRxfm4QPcpGbCEUkPphg9kvoJyAGKoNRPNpxQTrPaEmP4A+Qr2end X-MS-Office365-Filtering-Correlation-Id: 58eae474-892e-43cc-e4f2-08d5aaadd0df X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 13:09:44.9915 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58eae474-892e-43cc-e4f2-08d5aaadd0df 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: SN1PR07MB1517 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 During an uplink toggle test all error handling is done via timeout and firmware error conditions which can occur concurrentl: - SCSI layer timeouts - Error detect CQEs - Firmware detected underruns - ABTS timeouts All these concurrent events require more defensive checks in the driver including: - Check both internally and externally generated aborts to make sure the xid is not already been aborted in another context or in cleanup. - Check back pointers in qedf_cmd_timeout to verify the context of the io_req, fcport and qedf_ctx - Check rport state in host reset handler to not reset the whole host if the rport is already uploaded or in the process of relogin - Check to state for an fcport before initiating a middle path ELS request Signed-off-by: Chad Dupuis --- drivers/scsi/qedf/qedf_els.c | 13 +++++++++++-- drivers/scsi/qedf/qedf_io.c | 33 +++++++++++++++++++++++++++++++-- drivers/scsi/qedf/qedf_main.c | 26 ++++++++++++++++---------- 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index 816f693ef4a8..3053270aa473 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -14,8 +14,8 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, void (*cb_func)(struct qedf_els_cb_arg *cb_arg), struct qedf_els_cb_arg *cb_arg, uint32_t timer_msec) { - struct qedf_ctx *qedf = fcport->qedf; - struct fc_lport *lport = qedf->lport; + struct qedf_ctx *qedf; + struct fc_lport *lport; struct qedf_ioreq *els_req; struct qedf_mp_req *mp_req; struct fc_frame_header *fc_hdr; @@ -29,6 +29,15 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, unsigned long flags; u16 sqe_idx; + if (!fcport) { + QEDF_ERR(NULL, "fcport is NULL"); + rc = -EINVAL; + goto els_err; + } + + qedf = fcport->qedf; + lport = qedf->lport; + QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending ELS\n"); rc = fc_remote_port_chkready(fcport->rport); diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index f669df03f37d..07925f8e65bf 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -23,12 +23,31 @@ static void qedf_cmd_timeout(struct work_struct *work) struct qedf_ioreq *io_req = container_of(work, struct qedf_ioreq, timeout_work.work); - struct qedf_ctx *qedf = io_req->fcport->qedf; - struct qedf_rport *fcport = io_req->fcport; + struct qedf_ctx *qedf; + struct qedf_rport *fcport; u8 op = 0; + if (io_req == NULL) { + QEDF_INFO(NULL, QEDF_LOG_IO, "io_req is NULL.\n"); + return; + } + + fcport = io_req->fcport; + if (io_req->fcport == NULL) { + QEDF_INFO(NULL, QEDF_LOG_IO, "fcport is NULL.\n"); + return; + } + + qedf = fcport->qedf; + switch (io_req->cmd_type) { case QEDF_ABTS: + if (qedf == NULL) { + QEDF_INFO(NULL, QEDF_LOG_IO, "qedf is NULL for xid=0x%x.\n", + io_req->xid); + return; + } + QEDF_ERR((&qedf->dbg_ctx), "ABTS timeout, xid=0x%x.\n", io_req->xid); /* Cleanup timed out ABTS */ @@ -1565,6 +1584,16 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) goto out; } + if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) || + test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags) || + test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) { + QEDF_ERR(&(qedf->dbg_ctx), "io_req xid=0x%x already in " + "cleanup or abort processing or already " + "completed.\n", io_req->xid); + rc = 1; + goto out; + } + kref_get(&io_req->refcount); xid = io_req->xid; diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 59bcb7916441..9a2774e56e75 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -643,16 +643,6 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) goto out; } - if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) || - test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags) || - test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) { - QEDF_ERR(&(qedf->dbg_ctx), "io_req xid=0x%x already in " - "cleanup or abort processing or already " - "completed.\n", io_req->xid); - rc = SUCCESS; - goto out; - } - QEDF_ERR(&(qedf->dbg_ctx), "Aborting io_req sc_cmd=%p xid=0x%x " "fp_idx=%d.\n", sc_cmd, io_req->xid, io_req->fp_idx); @@ -748,6 +738,22 @@ static int qedf_eh_host_reset(struct scsi_cmnd *sc_cmd) { struct fc_lport *lport; struct qedf_ctx *qedf; + struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); + struct fc_rport_libfc_priv *rp = rport->dd_data; + struct qedf_rport *fcport = (struct qedf_rport *)&rp[1]; + int rval; + + rval = fc_remote_port_chkready(rport); + + if (rval) { + QEDF_ERR(NULL, "device_reset rport not ready\n"); + return FAILED; + } + + if (fcport == NULL) { + QEDF_ERR(NULL, "device_reset: rport is NULL\n"); + return FAILED; + } lport = shost_priv(sc_cmd->device->host); qedf = lport_priv(lport);