From patchwork Sat Mar 21 06:16:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 6063011 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5107BF90F for ; Sat, 21 Mar 2015 06:16:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D28152026F for ; Sat, 21 Mar 2015 06:16:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9CF32026D for ; Sat, 21 Mar 2015 06:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751316AbbCUGQs (ORCPT ); Sat, 21 Mar 2015 02:16:48 -0400 Received: from mail-ob0-f179.google.com ([209.85.214.179]:32873 "EHLO mail-ob0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751196AbbCUGQm (ORCPT ); Sat, 21 Mar 2015 02:16:42 -0400 Received: by obcxo2 with SMTP id xo2so92197695obc.0 for ; Fri, 20 Mar 2015 23:16:42 -0700 (PDT) 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=TcD2VpMvgN/TlLYxmiblCKSW5VbYtcACvF6gnz2MkBA=; b=P5cyyuQ1qjvsoYt2FcnnCUN8NL3T9LEadUmXLJMbR67QBxo2oJ+28QnDuKNap0k4qC 0BqoTkgz3lM7bwWrT3uKByuZrasW2KGnfd+/XAMOAxBKQ3mPEV2pi5ehgf+VBF6cbY84 599gIJf9lcMQ8PvVVFaoYCQvmPDJ9vlQ97i86Zr1ji8mOhIRl/foMt9JDI1G3/1pf8gK NpJFMdG447lz/YSysyQg3wVr8CRrY0TYCaUf2qT/UI1LAR0oNzw0kppa12bHDmkuHSbJ GNyQVNDnK+yWkNsL+4QKJmUdNZUxl88WEXgr2xcXbV90JTD7plbcRl7pWg6QaMAVtrdv bGgg== X-Gm-Message-State: ALoCoQlL1bctpognbM8j8yf6YKXiKa0malm1dlZn4edEJVfzCbLUxBhGiJ+JVmuLWQ0ZQdfa5Pm8 X-Received: by 10.60.42.211 with SMTP id q19mr68109587oel.58.1426918601950; Fri, 20 Mar 2015 23:16:41 -0700 (PDT) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by mx.google.com with ESMTPSA id xo12sm3874681oeb.10.2015.03.20.23.16.41 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Mar 2015 23:16:41 -0700 (PDT) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , Sagi Grimberg , Slava Shwartsman , Nicholas Bellinger Subject: [PATCH 3/3] iser-target: Handle special case for logout during connection failure Date: Sat, 21 Mar 2015 06:16:04 +0000 Message-Id: <1426918564-22581-4-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1426918564-22581-1-git-send-email-nab@daterainc.com> References: <1426918564-22581-1-git-send-email-nab@daterainc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Bellinger This patch adds special case handling during ISCSI_OP_LOGIN_RSP ib_wr failure, where isert_cq_comp_err() is responsible for calling the remaining isert_response_completion() -> isert_do_control_comp() -> iscsit_logout_post_handler() to drop the last iscsi_conn reference. It fixes a bug where iscsit_logout_post_handler() would not be called if the outgoing ISCSI_OP_LOGIN_RSP failed during iscsi_conn ib_wr descriptor cleanup. Reported-by: Sagi Grimberg Reported-by: Slava Shwartsman Signed-off-by: Nicholas Bellinger --- drivers/infiniband/ulp/isert/ib_isert.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 075b19c..ff0d436 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -1996,10 +1996,20 @@ isert_cq_comp_err(struct isert_conn *isert_conn, struct ib_wc *wc) desc = (struct iser_tx_desc *)(uintptr_t)wc->wr_id; isert_cmd = desc->isert_cmd; - if (!isert_cmd) + if (!isert_cmd) { isert_unmap_tx_desc(desc, ib_dev); - else - isert_completion_put(desc, isert_cmd, ib_dev, true); + } else { + struct isert_device *device = isert_conn->conn_device; + struct iscsi_conn *conn = isert_conn->conn; + struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; + + if (cmd->i_state == ISTATE_SEND_LOGOUTRSP && + conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) + isert_response_completion(desc, isert_cmd, isert_conn, + device->ib_device); + else + isert_completion_put(desc, isert_cmd, ib_dev, true); + } } else { isert_conn->post_recv_buf_count--; if (!isert_conn->post_recv_buf_count)