From patchwork Wed Mar 21 06:09:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10298623 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 7A98C6055B for ; Wed, 21 Mar 2018 06:10:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69D3C29716 for ; Wed, 21 Mar 2018 06:10:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E3892971E; Wed, 21 Mar 2018 06:10: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 C5C022971D for ; Wed, 21 Mar 2018 06:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751676AbeCUGKE (ORCPT ); Wed, 21 Mar 2018 02:10:04 -0400 Received: from mail-co1nam03on0057.outbound.protection.outlook.com ([104.47.40.57]:37472 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751586AbeCUGJy (ORCPT ); Wed, 21 Mar 2018 02:09: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=Q0Neh3gKgRYmas02t2LknKwCiTOMgs1dpgRFv5qpOI+VT1BA744L5CsUEDHuLMpVml23rsz/w3ozUJa4i2meNGI3trl1Ds7Hs/CiKCuRGY5VpKpv3j9vHCLl+6mi8I+M8uW9VYRskSY2Q8Gbg1TFzLD3VNGiTVvA8JW1iiTTzWw= Received: from SN1PR0701CA0017.namprd07.prod.outlook.com (2a01:111:e400:5173::27) by BLUPR0701MB2081.namprd07.prod.outlook.com (2a01:111:e400:52f4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Wed, 21 Mar 2018 06:09:52 +0000 Received: from BL2FFO11FD022.protection.gbl (2a01:111:f400:7c09::186) by SN1PR0701CA0017.outlook.office365.com (2a01:111:e400:5173::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.609.10 via Frontend Transport; Wed, 21 Mar 2018 06:09:52 +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 BL2FFO11FD022.mail.protection.outlook.com (10.173.161.101) 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; Wed, 21 Mar 2018 06:09:52 +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; Tue, 20 Mar 2018 23:09:43 -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 w2L69hgL029531; Tue, 20 Mar 2018 23:09:43 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w2L69hMq029530; Tue, 20 Mar 2018 23:09:43 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v4 07/13] qla2xxx: Return busy if rport going away Date: Tue, 20 Mar 2018 23:09:35 -0700 Message-ID: <20180321060941.29468-8-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180321060941.29468-1-himanshu.madhani@cavium.com> References: <20180321060941.29468-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)(396003)(376002)(39850400004)(39380400002)(346002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(50466002)(47776003)(76176011)(106466001)(51416003)(80596001)(8936002)(81156014)(81166006)(8676002)(59450400001)(85426001)(1076002)(54906003)(478600001)(69596002)(105606002)(2906002)(86362001)(87636003)(72206003)(305945005)(5660300001)(26005)(4326008)(186003)(336012)(356003)(50226002)(48376002)(6666003)(2950100002)(16586007)(110136005)(316002)(42186006)(36756003)(334744003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB2081; 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; BL2FFO11FD022; 1:vs8s+LrqDgFrbQSMLfxIVON/nkxDiIMBYkl9/O7Y31++jMbobW/Q2k2fzfodH54xT4UIwYvEk3eUGXBi+K1CyOmYi97TCBe/1MVccUjh/MQrWqgTO6q4ax8jlhzRfp65 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b7b407d1-0767-48eb-7007-08d58ef25c47 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:BLUPR0701MB2081; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 3:HozW+dpNorHmxk9fYsD+1q2MPxLolSEAy8+oJXOOi6ZpNpsIQRtd+Ybvx5Dd5cYlR4lKMmkK9MjC9DT6oP0KEGUytFKvfV1MdntVePzHsdnLSWVU5UojUdn53EWcxIy1Y2X/rYyyAoTYwK5s1VTTjCkd0DbQkUPh4fVO8PgRexnblejD2US3w6NWu7VXyQt3DY8ZRnBCIFzQOIRXidLxm+QopOny6DeHFzL/sa5qbRZo4CRhsBCa5r/6i0HCRzo1w1YZG5YjRN8psi3CBuEwmI534ggwC4ETcfN419QxiUcFr0mGHac5jY0z18/67viVGs7Jwtnxm3q58WDsY7OVo9vKzNGbz/CvwIQE4cwlxfo=; 25:0aGxXPdNrI8WmTbEknuxftcohBwHF64J7CQnqDr0lIhP4xEkF/LxnVFvtEXSfyPcyQm2PS1kRh84S9Qpv2FhmaK7b152Y4tGLFRUnwWppDhcRMdaSljnGwlKHRDQPjhb1iCTyZgjtKpsmYT4GnXja4CkTftrpoiUSn3xVHsE1hJcCDFijJ27hzAwiZ8WXt/heQnl2TvjidR8Bewyt6ZgdcRk27JWCnNHzfm1oEXXpgNPbNijIUdkMcbIP5r/IkoCnj5iLW8XpvOlaXM2lTmEvJXsZ9BH4VvRZdWCiU5A/fJAxjmZB1E8KN4C8jtDWKDM0YpPdkrzAgDliyEoUR4gcw== X-MS-TrafficTypeDiagnostic: BLUPR0701MB2081: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 31:WziXrGtpAyifJReUcBLDoYklwQZ/HQmyZLL0LQYrX6G9phWoGWZhORVd+FNNuiF+lQgTtAnOiOP/owgjJnNuI0/ZtvrYpNt2eDKaQJo7ZGekG/o6O4jhRrnUqkbXcSydvVr7bt71+0cB2na7M4kqdyb4L4sbTtPc8wOrrl7ralSgyIHBBsfH5sJuXeeFCqcWi50xjmY8AeOQBpiXSRAijuFaFFudR2O9B00X7qAGgpI=; 20:x7m0Q/JqdUwJg2MeuoHpuoGZXUBhubwOyO1LWZjAhHmiI9aVG/ZghHCjIetNkym1rGLwJTZopnFMj0tRVUKofElGH+9bA6O6NlkvK2XoqNB0H0yooEvs/PDrltobz12P7vvOCTgxpCx9v5UY7Rz7g8n5zgyu27dfj3eG5VCnnEVcrZ9mOKgNDBdxIpWWj3WlIW1DU8luxIsXu3pUp0rqE5vISISms8YmLFWpoabM3oxtPLDvmHnBtkVEcR8S9sW1qUrjxcdhvqE2iDTuVHwWuFZdyGgZ31I0oVhSXnjAxVayHONScsQcwiRifF4b0g/hlSW0SxazPdBJ/UcEaoYNTAAFiDTff7gk2us+e9pbHCRhr/8CkF60VSj1LGygSVhtb+Iyc/iQcQncQ1SVG2ZqINwcG7snnd44fUyO6xNmmdtwX3urpSUWVxKjUmBUJIqlF//RRAd6r+r26mMKHZ0ShC3Et0+s7BYPMmul9NDXH15Bq/qMAd08eTAJwmOUDSmT 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)(3231221)(944501244)(52105095)(93006095)(93001095)(10201501046)(3002001)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:BLUPR0701MB2081; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB2081; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 4:lqRhyOCiSSXKrZ04otj4aRYYOMIW7mgu1rLOV6dP7ehe9zH2Dq8yh0j8ffYfl9ukSr1DpJlPTPBOfYEFrbVWRo767vC6My2nVZA9JB0eLlfxBeiATNOu2spbKHAg+6wkbWRDDu400+SxJ7o3jrL3xKCG09Al3drZAamkvyk2oWNySRf7gwqnEsg/7SZbchNDDFHQtDwUpoFqpAi1VuSw7NjaUGLVXjJK5jx3DSgN/JBYUDLPKjzIVzBC6ytM/Uvnm57BiqdmFranj9QtbfZRjw== X-Forefront-PRVS: 0618E4E7E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB2081; 23:T/r2ufLGeR2Llg4+k/nvZAgwPV4poBnO89OOjus?= =?us-ascii?Q?ItWcU/Pst/6bgPNIK7aEpDTrhQ1JI82IYi9tIkZZQ1IYzGeUs8GrDTkGB0nV?= =?us-ascii?Q?Bb2olLt0zhY4EmHKt2mbs/8zNzjv+7L26HChEOG4Sj6JWTpclEF5xhNCPH6q?= =?us-ascii?Q?GAjgpsmKiXWkjMYSd79J21AIlSXmv21J8kIi8MyEhOaeKmj+bKTyJwDuJ4DI?= =?us-ascii?Q?6YKxOQGfMNkKDKfkvyOJNvmh8AYg3fsmI4EC/FHrnH6a7SJ8J3BLE6R4tz4M?= =?us-ascii?Q?abfHKwtw/S+GvzhyTpbqTquIsoNsvo9p2SgkKQFXSHWYNDecrECnIe5cLPdP?= =?us-ascii?Q?7cqxEAoTGotp1RkXSS59GEtt3uJCnjQJ29oJRC181qrEETr6/PFoqzWt9Ekm?= =?us-ascii?Q?0hs4+TNrEXVQ8a8TXpWhjRqalTviJDtOJ2bxNES0HcKo8AKU7zkGnvaXskvz?= =?us-ascii?Q?BLNoXj+XrR0/5T6spqXS4oPL8Cw3cA9PSVUjBh2ZfiktCFTwoDukExMJ0sLl?= =?us-ascii?Q?y44OoHHxpE2rvIrfaop4PrUD+HKytEfRsv+nrFcwinFaYNJ0o2dLGTNqKOE2?= =?us-ascii?Q?/dMCnG3lwseiX9a1Sy/3EdN5WIWmSH0CE1Pf8m1TYLqFZb6dAnH3meC29rCH?= =?us-ascii?Q?ouB8KhKWdHQmJkHEjkHgoM5msmdKAJKf8IjoIYFdAkqB8rw0LnFESiiGwdA6?= =?us-ascii?Q?VRdR2EQynRsNB1znx/Hhy2a0aboyn9Gpj+ifLrdMLAN0jTF7gZheIx93btb9?= =?us-ascii?Q?eg8tTTEiSiCtyZGEUUsQkP1PgYB66TbkWkZNndBSgrROrkmZScHlZIi3NiYX?= =?us-ascii?Q?XO+d+3ZyvPCwwhqGLAJAmGQ2SYQNLj0SEZdaTlKpO1id7gBjveIS3dRHVVyw?= =?us-ascii?Q?Jz2quDrso/IABJK/rCQ0QJL5cscmdbnEw8e7Ezs8CzzF74TDsHDH5XDJbqWK?= =?us-ascii?Q?g644DfJPbS8NindJAEUekKtEGwKPH4wTdE+I+AZ1TxGZRRsKAdN/errKVI9t?= =?us-ascii?Q?ydOflCYufb66W4CBV8Cp/kb2jAb2wtmco/K1MVMuNXHx97VKFYIjnBahYurJ?= =?us-ascii?Q?OhLZiCBj5iwQniWC1ud1F6VVswnn8ihbjNBA5VFMdtV+RnfZ3kU3NH9VcsYU?= =?us-ascii?Q?TsycVy1j0MuPwYBi9N4B4PnhgI+NM1REp?= X-Microsoft-Antispam-Message-Info: a4LLGquHYbx7MAazliAJM+EhaxI0BrU9GVLaHez9JjtgaIpqYLeAI6xKm/N986RpA/oUNe7Dl6egSoq9E9OUEBSTmJIy4BfciHHwFFnayrdBvjFipzrnIN5dxtrp9uFg8qlWRlgqidkEjIPMWTr0GUyJhwQiVgiQSMt5OSA83/9peE9bqhomwHHW+Or7wYIp X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 6:iY11vInhKpdsySz20c1Uo4S5oCBxATe7xei/I3hbuvXEXzXNnriKpIyNF+l1tNupVGBmcz08SKuVgkWTcjAiY5KD6bdvyft7aPyl+D3rlSi7xXkth6El1yGyUTlm9oyutVq8T6yWW9zYmdt8uXowWxFojBQJ623BvOiT0+yWGc5hMfedcW8CGfKirdKPuF+qheQOPK5rxqSMhlcZSQcVsGNyrIFoTxXBiUjN4B4gbX0z8WcF0OH/dDM2nc5U9TWmY0DUzIm8vOufcfDlQx6evfDt4QNxj4QPCFEKPtNyX3g0eOQPDcm377hFPO2yccwRgrZyQwSP551DyNRVTPD10z4H5eNork9mMFzpXflq9zAueVMpiqMiOwZ2uhnKtFpXRTkAbv+7pWjxYNPOjZtuCyCcMZfxrYv+SXdgERxi+f4YlG8ifD0LryTngcePmB8yiyYlrhq72wtnU2ffVpuu4A==; 5:DAlZiOk2Uteoe3bZWuDGscSG9R5lrXOcYGqlR/dqoFRmwioK4sKbzcQSbeQ3jDSuGZoigj8hWSIulNSxM0VGtN/Q9qQHRPAigegoknTEiqaU7oiJkSDPg186K4K67Re6irRSYYJCo2ZM6arYZmijTBX8eyhI6a/ZtmOjAMR9iI0=; 24:8AwLYxpiA1B/GhtG2myeu9+AwxMUJJVxfr+nEKmGo8ZkkpHSCQcZ2zFMjbFQC2fpg2nJ5X2Q5y45yZBwaWGTCTBFBDxhQcXG/8Lbti/CJgQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 7:odYFS1Zc7lUaxXBal/bS3gHmrq+hXj/J6c+64jVpsXrYbChfIR62BMGScaMEcm3aiMSxHvlvcTvLaGfkHHKF6hO/irVvuvc3ncxm0RL926aIfDJBzfqEn7EkL5ttl2u/VBN5b5dydFvzZxTa8UFtqKFJLNoBBVyYzyB4YomoNqjYy2RCSOMPwpmc6OWy3buBOgmGlBlh0V3vYYInJZeW7WS/C9NBfphemsqyimM3WMNMo9DbVNDbn6SxXR/fEX9u X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2018 06:09:52.0776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7b407d1-0767-48eb-7007-08d58ef25c47 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: BLUPR0701MB2081 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;