Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp468312ybl; Tue, 28 Jan 2020 06:26:34 -0800 (PST) X-Google-Smtp-Source: APXvYqxRjiVYYgQZsr0RvpvO8necLZMT6o23kF9qKobmJgC+ntuLMTb62x68CHoyEaskMcuE+xJc X-Received: by 2002:aca:e106:: with SMTP id y6mr3026588oig.131.1580221594114; Tue, 28 Jan 2020 06:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221594; cv=none; d=google.com; s=arc-20160816; b=d/ty03kIOjvruCYjWqNtQ8Zac7rGO4Kx5y5xvW9eDGfw+t4WkzggoRvCYtlowQMxWO MyrQbFx+7oeOKP0QtK1zf4EBW3c5jmYJlFFWqkBJY7+Qycfq1k+LB8/ne5B7u0b2lM4N Pj8xIt4REt2XDR0GsPYr9WDdJDgW47uY5cIWpplcxKtDv26V09IZbaK1NuhsobLNAie8 9Jal/u6eOiCZR/4VbtvLBZ0ZHwOeTJLvLYZmpcSIuCMIIoQg7OxGN4zjVe3Fr0dDHokE pd80RqOhBsO8YkziuPCnW4cntxB01BA+S72VJeytYLQ8ufQtQolchqKrxp/E4BawDEuw ztqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UgmwUgOhQlkqRqbgWFVkxo1eSPBZzE5rtuEdLhyCog0=; b=gPhDguznicm2q5YPtCXJqFGiAUOZWReizCWuXq0MhrTGmqBS+vvYln+Ocb8f8Y585k KdLnR8DEIJndY3vUkuzcZ1yVg/ARYGhE74UtBRJtaVQGk/xsSsNaZolWPKhK/UdVuKvS NsMQq3xp4AJkcKVMF20MaF08tywpiu4X7XbBzw98lqWr6NMAgWdEgLUNlQm8Ek0wsod9 6+7sEjfqTX+7CDnTxXnJDLmm/RaQAkJ4UYleddNAkMzTMQLzRH6qp5p5Zj03KlviD/fe n2r0g+36BpsIZAVHTYjzSq/6WO+1+L7qimO9GnnKnzOLhy9O289iTiZolq7LRhf9Jf+D LCHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h+vNJ4Im; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si1652357otp.273.2020.01.28.06.26.22; Tue, 28 Jan 2020 06:26:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h+vNJ4Im; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732916AbgA1OZ2 (ORCPT + 99 others); Tue, 28 Jan 2020 09:25:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:52396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732911AbgA1OZZ (ORCPT ); Tue, 28 Jan 2020 09:25:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D30721739; Tue, 28 Jan 2020 14:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221525; bh=wzmxU6XSNiwiCvZ4DwHQXoiLqa3hzsgNHtV79108Fkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+vNJ4ImwYWXJpn2SP44etYC4IvLnM1zTNZrH+lqLUqn7XDxS9ZNprCOCaz/dVxfm JtUXjHQvx1rCiS51HGEqStjuN6e5UdxaxqHzEaZ4iWDYSNz7TMJmGKpu+/Hdvr2ltn Mk2p0fIrX9nSxMe6wgOF6WZernlHdAoGu676ZQhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rahul Kundu , Bart Van Assche , Mike Marciniszyn , Sagi Grimberg , "Martin K. Petersen" Subject: [PATCH 4.9 258/271] scsi: RDMA/isert: Fix a recently introduced regression related to logout Date: Tue, 28 Jan 2020 15:06:47 +0100 Message-Id: <20200128135911.801046625@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bart Van Assche commit 04060db41178c7c244f2c7dcd913e7fd331de915 upstream. iscsit_close_connection() calls isert_wait_conn(). Due to commit e9d3009cb936 both functions call target_wait_for_sess_cmds() although that last function should be called only once. Fix this by removing the target_wait_for_sess_cmds() call from isert_wait_conn() and by only calling isert_wait_conn() after target_wait_for_sess_cmds(). Fixes: e9d3009cb936 ("scsi: target: iscsi: Wait for all commands to finish before freeing a session"). Link: https://lore.kernel.org/r/20200116044737.19507-1-bvanassche@acm.org Reported-by: Rahul Kundu Signed-off-by: Bart Van Assche Tested-by: Mike Marciniszyn Acked-by: Sagi Grimberg Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/ulp/isert/ib_isert.c | 12 ------------ drivers/target/iscsi/iscsi_target.c | 6 +++--- 2 files changed, 3 insertions(+), 15 deletions(-) --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -2555,17 +2555,6 @@ isert_wait4logout(struct isert_conn *ise } } -static void -isert_wait4cmds(struct iscsi_conn *conn) -{ - isert_info("iscsi_conn %p\n", conn); - - if (conn->sess) { - target_sess_cmd_list_set_waiting(conn->sess->se_sess); - target_wait_for_sess_cmds(conn->sess->se_sess); - } -} - /** * isert_put_unsol_pending_cmds() - Drop commands waiting for * unsolicitate dataout @@ -2613,7 +2602,6 @@ static void isert_wait_conn(struct iscsi ib_drain_qp(isert_conn->qp); isert_put_unsol_pending_cmds(conn); - isert_wait4cmds(conn); isert_wait4logout(isert_conn); queue_work(isert_release_wq, &isert_conn->release_work); --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4162,9 +4162,6 @@ int iscsit_close_connection( iscsit_stop_nopin_response_timer(conn); iscsit_stop_nopin_timer(conn); - if (conn->conn_transport->iscsit_wait_conn) - conn->conn_transport->iscsit_wait_conn(conn); - /* * During Connection recovery drop unacknowledged out of order * commands for this connection, and prepare the other commands @@ -4250,6 +4247,9 @@ int iscsit_close_connection( target_sess_cmd_list_set_waiting(sess->se_sess); target_wait_for_sess_cmds(sess->se_sess); + if (conn->conn_transport->iscsit_wait_conn) + conn->conn_transport->iscsit_wait_conn(conn); + ahash_request_free(conn->conn_tx_hash); if (conn->conn_rx_hash) { struct crypto_ahash *tfm;