From patchwork Fri Jun 16 05:56:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9790589 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 5E19960231 for ; Fri, 16 Jun 2017 05:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D2E22861F for ; Fri, 16 Jun 2017 05:57:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41DB428641; Fri, 16 Jun 2017 05:57:19 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 E35212861F for ; Fri, 16 Jun 2017 05:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751763AbdFPF5S (ORCPT ); Fri, 16 Jun 2017 01:57:18 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:36092 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbdFPF5R (ORCPT ); Fri, 16 Jun 2017 01:57:17 -0400 Received: by mail-qt0-f195.google.com with SMTP id s33so7933258qtg.3 for ; Thu, 15 Jun 2017 22:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZaOm9vqRxhedY3g6pJdiFbYfR9ha0BELlF7GK6CIISg=; b=WY8T+ulzyHFa60+gKA+r45Yzd30dz+cXrB2urEQJdYl5XCmAx/1OTxq4eSU4/EAVGU 4+JjVSmzsrHqug8AQXjqVoi8qQSGr8KHtWo31B8l8OSiSPc22h4cpNtHZ2MFdRj266Hf 8tC+dMgkLqWFFWgecGrMEN+0wTLpep80TOGV048X8tdMwThkikcPs0UgiN+rWgMYkwuo YO/XbVo8ZWzN8W/VAZx4J7Dz+75PHdFZfhM7MRGukn8oLj+kLYi6b59jb9WB4d4XEUgw KFb3v2UUkmrSL3OgohBBk+HJ3mJE1iKZLhKSWDKWQGtva9+7xbHzBS2UrEe1Zm8vZXi+ TA5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZaOm9vqRxhedY3g6pJdiFbYfR9ha0BELlF7GK6CIISg=; b=SJ8ck011Rd4wCxxXvz+GgSduia5XgT8Px0f0hTZSteUDt/NByiuYP7zQp8yXPLrBsg IOjLkN8/uvn07839hFqj0fMDDuOsmaoDziNiaulsqletsKCAAovjh/RL17Rh0u0W46em dhBt0EQdYwiNWzLO2x/ws5dZYFS84oApoXDVYKUOqE8UXuoyrN70aMZ0+pN2FbktH9Cw eFT3Fza5vOE3TeNHutGueuQ5C7dzTbL5rUVbIi2bvJmROpNAJErNS5elaeCjoTfh864i VoKV5AANCPoUqFzGe2TTqQnBt9eaa4/bNPF6+faMSFGnKUTbS1qFlbWYkJhqobDNqkII 0zmg== X-Gm-Message-State: AKS2vOws9ywJYzHlbpu4RpBlQ/JS4kW/K3OKMeK+tAnV+b8SyCkjhusk 9a4uCb26CvJq/VHX X-Received: by 10.55.82.67 with SMTP id g64mr10621007qkb.41.1497592636578; Thu, 15 Jun 2017 22:57:16 -0700 (PDT) Received: from localhost.localdomain ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id d16sm925428qke.5.2017.06.15.22.57.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 22:57:15 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH 08/11] Fix crash doing IO with resets Date: Thu, 15 Jun 2017 22:56:48 -0700 Message-Id: <20170616055651.9674-9-jsmart2021@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170616055651.9674-1-jsmart2021@gmail.com> References: <20170616055651.9674-1-jsmart2021@gmail.com> 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 every reset, IOCBs are allocated. So, at one point, number of allocated IOCBs reaches maximum limit and lpfc_sli_next_iotag fails. Allocate IOCBs only during initialization. Reuse them after every reset instead of allocating new set of IOCBs. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_sli.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 8de70b9d79dd..e948ea05fd33 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -6927,18 +6927,6 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) cnt = phba->cfg_iocb_cnt * 1024; /* We need 1 iocbq for every SGL, for IO processing */ cnt += phba->sli4_hba.nvmet_xri_cnt; - /* Initialize and populate the iocb list per host */ - lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "2821 initialize iocb list %d total %d\n", - phba->cfg_iocb_cnt, cnt); - rc = lpfc_init_iocb_list(phba, cnt); - if (rc) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "1413 Failed to init iocb list.\n"); - goto out_destroy_queue; - } - - lpfc_nvmet_create_targetport(phba); } else { /* update host scsi xri-sgl sizes and mappings */ rc = lpfc_sli4_scsi_sgl_update(phba); @@ -6959,18 +6947,24 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) } cnt = phba->cfg_iocb_cnt * 1024; + } + + if (!phba->sli.iocbq_lookup) { /* Initialize and populate the iocb list per host */ lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "2820 initialize iocb list %d total %d\n", + "2821 initialize iocb list %d total %d\n", phba->cfg_iocb_cnt, cnt); rc = lpfc_init_iocb_list(phba, cnt); if (rc) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "6301 Failed to init iocb list.\n"); + "1413 Failed to init iocb list.\n"); goto out_destroy_queue; } } + if (phba->nvmet_support) + lpfc_nvmet_create_targetport(phba); + if (phba->nvmet_support && phba->cfg_nvmet_mrq) { /* Post initial buffers to all RQs created */ for (i = 0; i < phba->cfg_nvmet_mrq; i++) {