From patchwork Fri Aug 19 09:50:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Bhivare X-Patchwork-Id: 9289953 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 DEF2F607FF for ; Fri, 19 Aug 2016 09:52:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFEB229312 for ; Fri, 19 Aug 2016 09:52:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4C6229379; Fri, 19 Aug 2016 09:52:12 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 5B23C29312 for ; Fri, 19 Aug 2016 09:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491AbcHSJwL (ORCPT ); Fri, 19 Aug 2016 05:52:11 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:35961 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754479AbcHSJwJ (ORCPT ); Fri, 19 Aug 2016 05:52:09 -0400 Received: by mail-wm0-f51.google.com with SMTP id q128so27544404wma.1 for ; Fri, 19 Aug 2016 02:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JVzLi5rjpb3iuT8WLh10vh1jv1kvg5V0ICo3gpIlEwI=; b=If0Z7OOm2gs6La6BnxFYBqgX9SnzjYveSlKe5S/iQpjjo+U2Ku23agkumC/2mDVdx0 gP0DiwM4hS2egkt6+ElhKTvRJ8bO8qCtba7AKvfk/CtlrSO/aX8fq56e3+2Ej6nWmGic caRlzErqCrwoJtAVWFK7LpoaTa7Tm1seFJ0yU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JVzLi5rjpb3iuT8WLh10vh1jv1kvg5V0ICo3gpIlEwI=; b=WuSnjE8vxKWP6oiElpBghSiF4v6PNfpLmFKW6M6VcecwYgEp7/nVZ6JQ2n3HoAAvAM 9FStI3xMqycsBBt2KzKBnJ2f/8f5NN95JKzIBkMrO5nVPT0eoaRwsRmGaWX9FLzsDBIY CGGwU64YI9QOOp4Rm47mV848yGzmdmCJNL2s9BwuvXcCHKeWbXY3Hm84LkVWeiWfnuy+ GQhfWUt13THqWt/i4gp4ad2+GxrPnDsgOEeojXqjTH1nwNP1f5vT+b9GgYbcXQe/1S1C rWr7wULOgdkFOtwwX8n1rU0OiRkNmolY2BA4aI/JxK/0Lon1SlNNAsaKyZVTy3syunXQ s96A== X-Gm-Message-State: AEkoouvn7XZWLLlhAD3E8T+Vn0mff8rgOqHD8vMQlrZ1438mM99/9ykqZ6sU/aHcE65TEtUD X-Received: by 10.28.150.10 with SMTP id y10mr3111051wmd.112.1471600323246; Fri, 19 Aug 2016 02:52:03 -0700 (PDT) Received: from android.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id n131sm3650096wmd.3.2016.08.19.02.52.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Aug 2016 02:52:02 -0700 (PDT) From: Jitendra Bhivare To: linux-scsi@vger.kernel.org Cc: mchristi@redhat.com, Jitendra Bhivare Subject: [PATCH v2 25/29] be2iscsi: Fix bad WRB index error Date: Fri, 19 Aug 2016 15:20:22 +0530 Message-Id: <1471600226-22055-26-git-send-email-jitendra.bhivare@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471600226-22055-1-git-send-email-jitendra.bhivare@broadcom.com> References: <1471600226-22055-1-git-send-email-jitendra.bhivare@broadcom.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 In very rare scenario, connection gets killed after throwing this error: scsi host0: BM_2312 : Event CXN_KILLED_BAD_WRB_INDEX_ERROR[15]... CID : 4 connection1:0: detected conn error (1011) memset ISCSI_WRB descriptor to zero for all allocations of WRB handle. Signed-off-by: Jitendra Bhivare Reviewed-by: Hannes Reinecke --- drivers/scsi/be2iscsi/be_main.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 5024651..50d865e 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -967,6 +967,7 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context, else pwrb_context->alloc_index++; spin_unlock_bh(&pwrb_context->wrb_lock); + memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb)); return pwrb_handle; } @@ -1209,11 +1210,10 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn, struct beiscsi_hba *phba, struct sol_cqe *psol) { struct hwi_wrb_context *pwrb_context; - struct wrb_handle *pwrb_handle = NULL; + uint16_t wrb_index, cid, cri_index; struct hwi_controller *phwi_ctrlr; + struct wrb_handle *pwrb_handle; struct iscsi_task *task; - struct beiscsi_io_task *io_task; - uint16_t wrb_index, cid, cri_index; phwi_ctrlr = phba->phwi_ctrlr; if (is_chip_be2_be3r(phba)) { @@ -1232,9 +1232,6 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn, pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; pwrb_handle = pwrb_context->pwrb_handle_basestd[wrb_index]; task = pwrb_handle->pio_handle; - - io_task = task->dd_data; - memset(io_task->pwrb_handle->pwrb, 0, sizeof(struct iscsi_wrb)); iscsi_put_task(task); } @@ -4295,16 +4292,12 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn, io_task = task->dd_data; if (io_task->pwrb_handle) { - memset(io_task->pwrb_handle->pwrb, 0, - sizeof(struct iscsi_wrb)); - free_wrb_handle(phba, pwrb_context, - io_task->pwrb_handle); + free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle); io_task->pwrb_handle = NULL; } if (io_task->psgl_handle) { - free_mgmt_sgl_handle(phba, - io_task->psgl_handle); + free_mgmt_sgl_handle(phba, io_task->psgl_handle); io_task->psgl_handle = NULL; } @@ -4341,6 +4334,7 @@ static void beiscsi_cleanup_task(struct iscsi_task *task) pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, io_task->bhs_pa.u.a64.address); io_task->cmd_bhs = NULL; + task->hdr = NULL; } if (task->sc) {