From patchwork Tue Mar 20 05:58:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10296435 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 3EAC2600F6 for ; Tue, 20 Mar 2018 05:59:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DCFD28AA5 for ; Tue, 20 Mar 2018 05:59:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2202B28AFD; Tue, 20 Mar 2018 05:59:06 +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 8622A29516 for ; Tue, 20 Mar 2018 05:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751731AbeCTF7F (ORCPT ); Tue, 20 Mar 2018 01:59:05 -0400 Received: from mail-sn1nam02on0052.outbound.protection.outlook.com ([104.47.36.52]:36247 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751680AbeCTF6y (ORCPT ); Tue, 20 Mar 2018 01:58:54 -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=6nGdc3O+PWwqIyOg7iNRn6mnmZWSEm9KbOGEqq/TM/w=; b=Nb661c5voB26e8j07FM1yrf3jrv0j9+ZTCOxDiP7pT348wm0ppTqYIbPYd7TQlj1HaKqCjNptulGtg3kd64bW3keP9t2f1q164MxMETU5LcVUZNP9zXutHyF+/UOXE/1n+dW/nPlLS/3z7hiIttBIaYKsIZsWnXdc40CARZ8ZtI= Received: from BY2PR07CA0017.namprd07.prod.outlook.com (2a01:111:e400:7bff::12) by SN1PR0701MB2095.namprd07.prod.outlook.com (2a01:111:e400:5309::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Tue, 20 Mar 2018 05:58:52 +0000 Received: from BL2FFO11OLC016.protection.gbl (2a01:111:f400:7c09::120) by BY2PR07CA0017.outlook.office365.com (2a01:111:e400:7bff::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.609.10 via Frontend Transport; Tue, 20 Mar 2018 05:58:51 +0000 Authentication-Results: spf=fail (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: Fail (protection.outlook.com: domain of cavium.com does not designate 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 BL2FFO11OLC016.mail.protection.outlook.com (10.173.160.82) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.527.18 via Frontend Transport; Tue, 20 Mar 2018 05:58:51 +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; Mon, 19 Mar 2018 22:58:39 -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 w2K5wdt7005309; Mon, 19 Mar 2018 22:58:39 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w2K5wdfI005308; Mon, 19 Mar 2018 22:58:39 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 07/13] qla2xxx: Return busy if rport going away Date: Mon, 19 Mar 2018 22:58:31 -0700 Message-ID: <20180320055837.5246-8-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180320055837.5246-1-himanshu.madhani@cavium.com> References: <20180320055837.5246-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)(979002)(376002)(396003)(346002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(54906003)(2906002)(186003)(110136005)(2950100002)(16586007)(69596002)(106466001)(356003)(6666003)(305945005)(72206003)(80596001)(42186006)(316002)(5660300001)(87636003)(478600001)(336012)(50226002)(47776003)(8936002)(105606002)(85426001)(8676002)(81156014)(76176011)(51416003)(36756003)(59450400001)(26005)(1076002)(4326008)(50466002)(86362001)(81166006)(48376002)(334744003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0701MB2095; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Fail; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC016; 1:XUTc8xrr/hFKr5XsWdb3cz6XGAYDH7iPhH0AemX7G5U+F3Du4Gy/a8/Z6uK61zBJ1dKgKIC/b0JVC1KuMkbAiV8FHotFLO39ro9IPL7fXdguJ68JXzxZkoxb9HTKEn7k X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d837231-bf8d-4a23-1fc6-08d58e27a818 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:SN1PR0701MB2095; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB2095; 3:xEPzWEwblmCZSf7OIPvf+wmlatfEm6mqtawvfvrQGWCFniXrr7AIZUSVu1Ux1RyS7zbna/6Bzlqxs2MDdqjK9SnpM60ilGU/QhEgvRcHRiVPDryzg1nP/PO7H37C0mIMOgIc0bFGzn85gyYbqtSHpG3+9nlTc90AvJmyqVZq4chyChWRjfnDvaekoDXKDaEiZcagCJKYmUZC3UudOhZPOOaigQovzL1WV04BRK6JrMdirYhFjMV9NTqbRT6zWowBUcHli+WXUPLhYmKWNPmj5i0WB9cY7V1VW0cDqkHU6dibAhEpL6G6R5V+VZIUCgiLUj1xQpHlIqj84u1V5i3KkdU9/7lH+1GA7Bz1J+o1oRQ=; 25:a6+6YVFwovYX6p8Dm9ExO96y7bdtSe8zj45oiUp3dvVJ6qeVtDouc8q0fzT2LRZkGxVtvJJQOIkSZI1cjkzpR3JMJeCAsPe+D4vCtrBpoZDjPUyEMgeCwLepCRegjOkbsSWM3N9bDjI1WC9nDQ8Z0jVP31DCxIfUDUsu+9Bk3XYDyv/mDKQEDNcMaxySxepe8Zl8jpBCqywdBMbySZfNc9NXf0Wm5rgtf8O3h/Ej+3MJ0Waug9Hlz147sp0CE9Jg5A8j1oaIqdqrAbgYO2/EE7V9AZdqoo5KE+S2g/ddWd++rOJID93TqkT3u0+BbkOPrvc6FeXC9vMugiMnk1v/8w== X-MS-TrafficTypeDiagnostic: SN1PR0701MB2095: X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB2095; 31:gn7jJWKbZYgfztoqFCXUekLAi3T7DftzVaM6DonMZ0qLeel1MI1gGeskaiDza0X3k73TYVa5DnyqTrCKe+5LjeShojzuHHaWlKmzC9hhNAqlvZ42p8ZDtExAjxvmoBMQikojoksVGcl65cH4vqinSGcl6Lz+4hGArUWLkONqN8ORZzdvd4NyabYkgjLuHDGAsJIBzH2aatQF1KPID8DVJ55R6tKIc6Kw3nY9zV21sAk=; 20:k0WU+euFbSdla/Q9BaQiEMq/7SKhAHT5yxVPoRjijo+YU6w6cK1NeQhqb49K4fx1p8SKAnEv+HXgoINbOJFjfTGVX/aaYv8FJ1RcxUHo5Zfhdz1B3bjFnh6SJtPSDdvZnVpYl6CIxNddsM07EmilHwoz/CNKFOm8PvFEg7z1aNZ1dtC238KK2WxHoWVrcTQvSV0boLt4m5F+7Tx7JkEgLhzGn2OdzZqLOA+wPKUjbI9pkTGXXnilccYazZWZT0H5grWtDzfU6bJ5tiHfi+SEO/yDhfPWmyqn0W2Dkf1nUXSNOjabbYzcC8hyA+0U+lFxFaLZ2g8YdTKUf06nctyGCpqbZatp/yQnIpYBUCEocuZFsmI4bzhLYPaf6DqTUiAbzrtYLvMvszVoZDKDrrKzrHYX0gYIDXlQTutoCr0g1PcL8nvCbm7Myyl3nsUs+It2FRjoMJdI7cdthzE+uLNoijJM4OYSxbm2XnV2b7XQu/cxgsJi1RGTzJ01sCVqzizi 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)(10201501046)(3002001)(93006095)(93001095)(3231221)(944501307)(52105095)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:SN1PR0701MB2095; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0701MB2095; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB2095; 4:5exFacTvoiBl2l+vr0csnjX6AzSxqAxxcnXeXUFIdQhLkrFH+eLQLoOiIVGq8/q9BijoAEkQdCcm/qYA8nx8CifCAI4XqBC80gqmicmmNaUS6UjQNTUYmeDDSNDctfFzMT6WeeO9fGyldqBmOJpHpWXy54TJgwUgkn51s10qDC47cDaGqkeVLJUtXs9mhGdfxxvsV0fwCHl1G2gk8c1YoEdmWnVoNAsFYVGzVwO2WK3x1sf0F3cJInW2aYmK1TArIT5gNfTjII4MPyZZ2vnMCA== X-Forefront-PRVS: 061725F016 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0701MB2095; 23:IdUJ3s/bQ836191eVTEd4DnhoXmf0H1vSPuBVOV?= =?us-ascii?Q?v2W+EleKJ/Lyj2cxuoyQSlYC4EUPcx6aACWES3rnkyAgh3nFo8ynL54lps7k?= =?us-ascii?Q?30tuNxD5feOiA9o+KYcHWrDxDv05Xf7cBY6tUjfm/hvJEeV20md0WTTpI/aJ?= =?us-ascii?Q?5L0clf9Zp2S+doh55fp0qL85YWHgTZsM4+jrUK1E2HPAvmGlpzDn7CSt37o2?= =?us-ascii?Q?3aDAD8c0xUr8Z0RJBjDZpL8F79/qvh+hf3gWNU0X5bpADcbsppzR9gWyPIue?= =?us-ascii?Q?nUHs2WCjiflTzlNMIIPJTIYf1vfypMD0/rBLi4bDB8e21+VDrCJE48Xp0Wvd?= =?us-ascii?Q?b8LSmEzdn9Dmmy0wWJIcCoc3NU2Fc94/rBO5NhL0MbiurvfCiy24E3t5h/z3?= =?us-ascii?Q?BYnLQ2JPd3u2MR+wR/SwwEb+fL8nIiS3VwQCO3y1tDKwn3hiowGPAgrAsVIT?= =?us-ascii?Q?WaZB74S00xmqWjPQwN9wpim8aCVMU+4KJ2gSVjZT4otdxKy15/z3SJz6Vvob?= =?us-ascii?Q?DBk+nvyX3A8LQs9GHf3W/JORyUzN8Fqxh8UjHPihIlPe+E9NLgnbK1KmmvRN?= =?us-ascii?Q?1UvDSH1FgMa81bki1RnhgEVQX/QUg+TaUA8lS/1M+9iEVQi1wtkQPvttoNeg?= =?us-ascii?Q?zsb5CsEGEMhpn1V5ROCdHG1apBR7OtWxvRj0pTJ1elw6sEJFh2ELKe6e2937?= =?us-ascii?Q?80GW+qbnOPNdfHGzyrb2eS0TCQ9s75FckEVou1y41dEqlnwWQYhCiOIZ/Ode?= =?us-ascii?Q?g00Mef4zbpuQqXB+zMrd6eNE8CGgZRmvrC1tnNESJwq0SZnGwprFr8ZgEjYb?= =?us-ascii?Q?vZnmoNo3+BXyUzkeDa92vlHMc6XXpSUk5HMIkAJC+bf7ua2T5gP2rbttet0c?= =?us-ascii?Q?Aw8mSR1ealacFBBBO4QMlRKtOv3MpulwWNg7f7s8iO/SEAsM0+buhy9IqWJ2?= =?us-ascii?Q?58j2FwB6/qpTq/bHSUdNwGVTM0F+J856nkqUdQNJr0NGN2uZ0HSnOrSpInkt?= =?us-ascii?Q?ysNU2QjNPGEB3Pk+GpCWpb1LqzRH+XZX6pjm5BHxhHOPuGfJGw6EHKujk/3k?= =?us-ascii?Q?ndk9AeEys0yUcnOETSHjm8RNF1zI2UNehJLjRKjpoTuJ3x/JCeAFXkfrFD2X?= =?us-ascii?Q?5Kavg6qFdLo5ctiZeoEo+kHwqoGFCLVkxUn/2GLDc2/YGgFYZYidEGylrT9C?= =?us-ascii?Q?1gt5JSExvGqyxpyUxJD4yAZuNQw2dRKnPgvsQLgjUesKSnzLfL9k7VyXFm3Q?= =?us-ascii?Q?rJxqgfY1fe+gw3YP90tA=3D?= X-Microsoft-Antispam-Message-Info: B6ssWR5sBYbOa1CB4gt/X11htpnqZJOzHyBvZxdud5W38O5xXLVHXeZ6t8SyqPCj4/AWqKyUVt99hHtyAwLGV/cNGE0trMHkMmH6m9T6J9H7HGvMLvhlaDcJMGaoaMqbe9HLDZVVgSGIf89e3znRr+8bKyFM8WffJE+LaDCJ25bDfDt+yPcqpOL2RdpMZ5bh X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB2095; 6:OlmCrvpFjQmWuYpRwm/mnZCC5podC00JKWUtWni2gzeL+HBrbI3MJviTopjak4AZQKAYBwq7ydqPC2AoE+rRCD/X5t3DqlhRf6F4M49rFqaR7OZaEdoVGYVr4p1VKv9FC+1mL0eUNb5b4AoWUxnIkCSJ3sWSHCtv+0fk7Q7q2ZD2mZPM2oPe0OrC4hYJuc7ZexNIX7T2nBkLgawNjkqo+B9BBCrGDMsKlKYDpaKgEBvntYOMlUaFnirOM6HXZoaB4wP0cJLowtN/rTlCbIJG8t7CyIfJHuNndw0Zi6qp02a//J51y7Cgh7TZrcatJp6T0Ich6rcYrCCsOwNXVvxfB/JFzqZSQYsxfek3h+qpo4Q=; 5:TEayCVIE6CHT/WCAXOp/CuHWz1IQb/zfDvdZaNi3sU9l+8U3ovmHETWQ6CW919EUmlYzneEJEUSdZTNeQI9WcKQKR7VZD+n3Yi8LWMUHo5tP+uoeBMib1Zda9HA1wgnwf0doq5vrwdvZ/nUqvYvl+9cO4gDiA6A2QG/CoBoCcD0=; 24:K8vGAeXsOWsTXo761Ak9wfyzAMqYegkRCa5re6I9r1pYpIb90hGZQ1YZvyfzHDJ+fAGHHDOkZTRiagmKXMU4ZAqZDJPGFuB4Jx9RJ/XGqF8=; 7:VIPFQABVfowd6rX2J4ahEmzZEW4P66A1lhEXaV1X78JfKt5hhOMV1aleuHOOWFDlPJA8mY/APYqj6YxrK6ijld5Dy+LBSFoh3Y4XKCq4esY7S3nvk9NnfDB62hWiETFuh9UpkpnCLbLdX6fNdgU8zOmmhc53bgd5QSYLO7zNgR2OPWbvE3dhjIAEYaUf6wGcwjT8uHIxL3O6twBWoDlnfOytWBpN/P44Puu47fLmMMN3VlLW1Bn4yoZBQ17Sbd3c SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 05:58:51.4383 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d837231-bf8d-4a23-1fc6-08d58e27a818 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: SN1PR0701MB2095 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: Darren Trapp This patch adds mechanism to return EBUSY if rport is going away to prevent exhausting FC-NVMe layer's retry counter. Signed-off-by: Darren Trapp Signed-off-by: Himanshu Madhani Reviewed-by: Hannes Reinecke Reviewed-by: Johannes Thumshirn --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_isr.c | 4 +++- drivers/scsi/qla2xxx/qla_nvme.c | 31 ++++++++++++++++++++----------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index cba749d27154..59c449b141cd 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2356,6 +2356,7 @@ typedef struct fc_port { uint8_t nvme_flag; #define NVME_FLAG_REGISTERED 4 #define NVME_FLAG_DELETING 2 +#define NVME_FLAG_RESETTING 1 struct fc_port *conflict; unsigned char logout_completed; diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 913cd6cf5907..bc2c7ded6949 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1910,9 +1910,11 @@ qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk) ret = QLA_SUCCESS; break; - case CS_ABORTED: case CS_RESET: case CS_PORT_UNAVAILABLE: + fcport->nvme_flag |= NVME_FLAG_RESETTING; + /* fall through */ + case CS_ABORTED: case CS_PORT_LOGGED_OUT: case CS_PORT_BUSY: ql_log(ql_log_warn, fcport->vha, 0x5060, diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 951fbbab961f..adeda6a4e4fd 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -36,6 +36,7 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) return 0; INIT_WORK(&fcport->nvme_del_work, qla_nvme_unregister_remote_port); + fcport->nvme_flag &= ~NVME_FLAG_RESETTING; memset(&req, 0, sizeof(struct nvme_fc_port_info)); req.port_name = wwn_to_u64(fcport->port_name); @@ -193,9 +194,9 @@ static void qla_nvme_abort_work(struct work_struct *work) rval = ha->isp_ops->abort_command(sp); ql_dbg(ql_dbg_io, fcport->vha, 0x212b, - "%s: %s command for sp=%p on fcport=%p rval=%x\n", __func__, - (rval != QLA_SUCCESS) ? "Failed to abort" : "Aborted", - sp, fcport, rval); + "%s: %s command for sp=%p, handle=%x on fcport=%p rval=%x\n", + __func__, (rval != QLA_SUCCESS) ? "Failed to abort" : "Aborted", + sp, sp->handle, fcport, rval); } static void qla_nvme_ls_abort(struct nvme_fc_local_port *lport, @@ -327,7 +328,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp) } if (index == req->num_outstanding_cmds) { - rval = -1; + rval = -EBUSY; goto queuing_error; } req_cnt = qla24xx_calc_iocbs(vha, tot_dsds); @@ -341,7 +342,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp) req->cnt = req->length - (req->ring_index - cnt); if (req->cnt < (req_cnt + 2)){ - rval = -1; + rval = -EBUSY; goto queuing_error; } } @@ -476,14 +477,15 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, fc_port_t *fcport; struct srb_iocb *nvme; struct scsi_qla_host *vha; - int rval = QLA_FUNCTION_FAILED; + int rval = -ENODEV; srb_t *sp; struct qla_qpair *qpair = hw_queue_handle; struct nvme_private *priv; struct qla_nvme_rport *qla_rport = rport->private; - if (!fd) { - ql_log(ql_log_warn, NULL, 0x2134, "NO NVMe FCP request\n"); + if (!fd || !qpair) { + ql_log(ql_log_warn, NULL, 0x2134, + "NO NVMe request or Queue Handle\n"); return rval; } @@ -495,13 +497,21 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, } vha = fcport->vha; - if (!qpair) + + /* + * If we know the dev is going away while the transport is still sending + * IO's return busy back to stall the IO Q. This happens when the + * link goes away and fw hasn't notified us yet, but IO's are being + * returned. If the dev comes back quickly we won't exhaust the IO + * retry count at the core. + */ + if (fcport->nvme_flag & NVME_FLAG_RESETTING) return -EBUSY; /* Alloc SRB structure */ sp = qla2xxx_get_qpair_sp(qpair, fcport, GFP_ATOMIC); if (!sp) - return -EIO; + return -EBUSY; atomic_set(&sp->ref_count, 1); init_waitqueue_head(&sp->nvme_ls_waitq); @@ -519,7 +529,6 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport, "qla2x00_start_nvme_mq failed = %d\n", rval); atomic_dec(&sp->ref_count); wake_up(&sp->nvme_ls_waitq); - return -EIO; } return rval;