From patchwork Fri Jan 25 07:23:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10780707 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 599B513BF for ; Fri, 25 Jan 2019 07:25:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E7F72EC77 for ; Fri, 25 Jan 2019 07:25:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32AC52ECFF; Fri, 25 Jan 2019 07:25:14 +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 7BEEE2EC77 for ; Fri, 25 Jan 2019 07:25:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728445AbfAYHZN (ORCPT ); Fri, 25 Jan 2019 02:25:13 -0500 Received: from mail-eopbgr690064.outbound.protection.outlook.com ([40.107.69.64]:56179 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727500AbfAYHZN (ORCPT ); Fri, 25 Jan 2019 02:25:13 -0500 Received: from CY1PR07CA0016.namprd07.prod.outlook.com (10.166.202.26) by BN6PR07MB2995.namprd07.prod.outlook.com (10.172.106.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.17; Fri, 25 Jan 2019 07:25:09 +0000 Received: from DM3NAM05FT054.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::204) by CY1PR07CA0016.outlook.office365.com (2a01:111:e400:c60a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1558.16 via Frontend Transport; Fri, 25 Jan 2019 07:25:09 +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 DM3NAM05FT054.mail.protection.outlook.com (10.152.98.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1580.2 via Frontend Transport; Fri, 25 Jan 2019 07:25:08 +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; Thu, 24 Jan 2019 23:24:06 -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 x0P7O4s9003563; Thu, 24 Jan 2019 23:24:04 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x0P7O4we003562; Thu, 24 Jan 2019 23:24:04 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 04/13] qla2xxx: Fix session cleanup hang Date: Thu, 24 Jan 2019 23:23:42 -0800 Message-ID: <20190125072351.3504-5-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190125072351.3504-1-hmadhani@marvell.com> References: <20190125072351.3504-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131928747090769388;(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)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(316002)(305945005)(36906005)(4326008)(110136005)(54906003)(16586007)(42186006)(68736007)(50226002)(81166006)(2906002)(81156014)(8676002)(8936002)(14444005)(47776003)(53936002)(97736004)(80596001)(106466001)(498600001)(87636003)(48376002)(1076003)(50466002)(356004)(6666004)(69596002)(26826003)(105606002)(76176011)(336012)(85426001)(26005)(51416003)(486006)(86362001)(446003)(11346002)(126002)(2616005)(36756003)(476003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR07MB2995;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM05FT054;1:zj5tOhHQIvEVbSsBtWrWcH6PvFKk086VdUKrDqbhcIplHyC0VuNg84D2JbeYP4ZPg0lZqo5sJSja+QSxO4d/VhCX/61mnVCVyn7P9Dm12+Im9nmXvGg46X56iYoL3iJz5gK7hj6mUA3knxHMZlTr6w== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 357754f2-6cb4-403f-e1c1-08d682963c6e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600110)(711020)(4605077)(2017052603328);SRVR:BN6PR07MB2995; X-Microsoft-Exchange-Diagnostics: 1;BN6PR07MB2995;3:6soATUlwK01KuN2LvrIkZUG8QzwNMZwJ0AfMVRaxGWEoa5iMkN+Bk+RqW4XobMojTUZcIpR5OKJUBG5PNFtHBhVdoAmHzPDaUMEFD5QlJT8dM7AjDgP4oB0+T1Qxx0U/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2bmdwDNZi1t8ezIuzVZKxAkqFqsOQUsQRkGIafB0B/G/JrrbUMgPBRT2PaikW8oFjVQRrDmMREwx1fQjZcSTW7+juF51NWKnQz8aypAjlFW/0jcSqvYtgP9aOvUdoLK/dODfFQTmp1jC3N0QnCoS8JTLbn4mbl9OxcAgqX9WpjWr1BAGTtc4KeVz75MWN9Kotq2MUEyfi3D9E0ENVyoKfU+/frcVNhs6MSa0kiOO1TXjj/ExgA4PjtQ60Tf/FuT1CVEkhb387EPcwgQ==;5:lgOgCgTTrWZTWn+ctKMEI2H0uR0P0DLEwSPQny86vIqAfhlGUlYUjpd5vWQLiix/MdfoIAEMdYJhvxydotfP7x4TQKd6wUMBvDWwwn2XNbHp8fDFssdo0c8xJjxSkFqg6hMsswjGtuN6dEQHYW/pZq4ThP/gVXzUtRzwEGbZPQdgclofD02UQkez+IeUOJI9hzIjJdDkJXYs8Q0eZqlzCA==;7:T9MT9NyRrcBGq0D3VUuUr0A4Ane98XEITZphnyAfCNcbO6tpjBjbu6KNnAIWVAWr37kFvAtBYu5lkCkSN0d+jleRKKsSYEsIGio+LjAnaEQQPMhyUNcuBys+J5+SOHpp0w5MgLS13ohfHG21zEdNYw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2019 07:25:08.6656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 357754f2-6cb4-403f-e1c1-08d682963c6e 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: BN6PR07MB2995 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: Quinn Tran On session cleanup, either an implicit LOGO or an implicit PRLO is used to flush IOs. If the flush command hit Queue Full condition, then it is dropped. This patch adds retry code to prevent command drop. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_iocb.c | 5 ++--- drivers/scsi/qla2xxx/qla_os.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 032635321ad6..97fea5984db3 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -3434,23 +3434,22 @@ qla24xx_prlo_iocb(srb_t *sp, struct logio_entry_24xx *logio) int qla2x00_start_sp(srb_t *sp) { - int rval; + int rval = QLA_SUCCESS; scsi_qla_host_t *vha = sp->vha; struct qla_hw_data *ha = vha->hw; struct qla_qpair *qp = sp->qpair; void *pkt; unsigned long flags; - rval = QLA_FUNCTION_FAILED; spin_lock_irqsave(qp->qp_lock_ptr, flags); pkt = __qla2x00_alloc_iocbs(sp->qpair, sp); if (!pkt) { + rval = EAGAIN; ql_log(ql_log_warn, vha, 0x700c, "qla2x00_alloc_iocbs failed.\n"); goto done; } - rval = QLA_SUCCESS; switch (sp->type) { case SRB_LOGIN_CMD: IS_FWI2_CAPABLE(ha) ? diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 39a0bdb66612..f9cbf73bb417 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5019,14 +5019,14 @@ qla2x00_do_work(struct scsi_qla_host *vha) struct qla_work_evt *e, *tmp; unsigned long flags; LIST_HEAD(work); + int rc; spin_lock_irqsave(&vha->work_lock, flags); list_splice_init(&vha->work_list, &work); spin_unlock_irqrestore(&vha->work_lock, flags); list_for_each_entry_safe(e, tmp, &work, list) { - list_del_init(&e->list); - + rc = QLA_SUCCESS; switch (e->type) { case QLA_EVT_AEN: fc_host_post_event(vha->host, fc_get_event_number(), @@ -5040,7 +5040,7 @@ qla2x00_do_work(struct scsi_qla_host *vha) e->u.logio.data); break; case QLA_EVT_ASYNC_LOGOUT: - qla2x00_async_logout(vha, e->u.logio.fcport); + rc = qla2x00_async_logout(vha, e->u.logio.fcport); break; case QLA_EVT_ASYNC_LOGOUT_DONE: qla2x00_async_logout_done(vha, e->u.logio.fcport, @@ -5085,7 +5085,7 @@ qla2x00_do_work(struct scsi_qla_host *vha) qla24xx_do_nack_work(vha, e); break; case QLA_EVT_ASYNC_PRLO: - qla2x00_async_prlo(vha, e->u.logio.fcport); + rc = qla2x00_async_prlo(vha, e->u.logio.fcport); break; case QLA_EVT_ASYNC_PRLO_DONE: qla2x00_async_prlo_done(vha, e->u.logio.fcport, @@ -5118,6 +5118,15 @@ qla2x00_do_work(struct scsi_qla_host *vha) e->u.fcport.fcport, false); break; } + + if (rc == EAGAIN) { + /* put 'work' at head of 'vha->work_list' */ + spin_lock_irqsave(&vha->work_lock, flags); + list_splice(&work, &vha->work_list); + spin_unlock_irqrestore(&vha->work_lock, flags); + break; + } + list_del_init(&e->list); if (e->flags & QLA_EVT_FLAG_FREE) kfree(e);