From patchwork Thu Feb 13 05:08:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11379871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0BB617F0 for ; Thu, 13 Feb 2020 05:09:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA6892168B for ; Thu, 13 Feb 2020 05:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbgBMFJJ (ORCPT ); Thu, 13 Feb 2020 00:09:09 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:50408 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgBMFJJ (ORCPT ); Thu, 13 Feb 2020 00:09:09 -0500 Received: by mail-pj1-f66.google.com with SMTP id r67so1848291pjb.0 for ; Wed, 12 Feb 2020 21:09:07 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=jbHafbCA5zTo4T6UNbio+bK6idFQUDAk25CROjCMSvw=; b=LIYysUYY+f+qrtD670uz9hyvTq+6ZBAzFd8pL+7UODci9uOuI3jSXQ7ncX8zbZe8Fm joAxYLBqeGx0KKI7wnM9x09peQGvGoMrJGqsMcI3tEcxXaXdA8pQTBDSb66V+MDeifWl 7T/4q0w9x0PFr1pSNbJjT1prnIFzfXDW+VGXM4HwF2Qy2tUZZx4AzyJZtvemelhlS8zU 8IKIu2NPg/LLZ1YlMQnT5/o6ZIDnqGZa0hCh8WACHOAmvbqQxbrcdqLe9nV/SkdPZtNW mK3whMSaHHlSkn2sMPb3A8BNURlm4Xpwf9MEcEjZinJ1B0cTL3yjB85WRup/ToHMjQIi XU0A== X-Gm-Message-State: APjAAAWq06sGMegBJjquEHaNOAc99QrgQ4ChDEHZQ8RtYYFo5JRkpBmC d5p1iTbc3oNLYj4zJk4k52Q= X-Google-Smtp-Source: APXvYqzJce63MzV1cq04rgN8xLfpXZyTgc2A6DGbz7gSlcREsAtqI9LEvbBosHR/F7w1WLBZPUEqoQ== X-Received: by 2002:a17:90a:f013:: with SMTP id bt19mr3000787pjb.47.1581570547075; Wed, 12 Feb 2020 21:09:07 -0800 (PST) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:a815:f3bb:71b5:79fa]) by smtp.gmail.com with ESMTPSA id i2sm821994pjs.21.2020.02.12.21.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 21:09:05 -0800 (PST) From: Bart Van Assche To: "Martin K . Petersen" Cc: target-devel@vger.kernel.org, Dakshaja Uppalapati , Sagi Grimberg , Mike Marciniszyn , Bart Van Assche , Rahul Kundu Subject: [PATCH 1/2] Revert "RDMA/isert: Fix a recently introduced regression related to logout" Date: Wed, 12 Feb 2020 21:08:59 -0800 Message-Id: <20200213050900.19094-1-bvanassche@acm.org> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Since commit 04060db41178 introduces soft lockups when toggling network interfaces, revert it. Cc: Rahul Kundu Cc: Mike Marciniszyn Cc: Sagi Grimberg Reported-by: Dakshaja Uppalapati Fixes: 04060db41178 ("scsi: RDMA/isert: Fix a recently introduced regression related to logout") Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/isert/ib_isert.c | 12 ++++++++++++ drivers/target/iscsi/iscsi_target.c | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index b273e421e910..a1a035270cab 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -2575,6 +2575,17 @@ isert_wait4logout(struct isert_conn *isert_conn) } } +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 @@ -2622,6 +2633,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) 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); diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index b94ed4e30770..7251a87bb576 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4149,6 +4149,9 @@ 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 @@ -4234,9 +4237,6 @@ 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; From patchwork Thu Feb 13 05:09:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11379869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1F601580 for ; Thu, 13 Feb 2020 05:09:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA39F2168B for ; Thu, 13 Feb 2020 05:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726232AbgBMFJJ (ORCPT ); Thu, 13 Feb 2020 00:09:09 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41242 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbgBMFJJ (ORCPT ); Thu, 13 Feb 2020 00:09:09 -0500 Received: by mail-pf1-f196.google.com with SMTP id j9so2411280pfa.8 for ; Wed, 12 Feb 2020 21:09:09 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=X/IhYIWV0dvN4qg5NIxVcEvKo8VzeM1Sg1SyB58qN0U=; b=eNs/v7fUjNFS368M1/KvrJwtOd7D37NXSnz2VC0//Zw7PCUdn6ZgErTKJXT0AEHzkc yvMdk2P8n3OK9aGin0BfEUHSrRzshcEe5CqRTuEmv1jtIc2ByQ/ZKIXhZaxpCpyOt99Z 53nYMIQtMWYF6UmZCM69S9NcccNVmYqkR637ruKmrY+1SFl0Eo6p1jUYpFZe1zGiMeky xDnS6L/yYnltAAlrmzWd8DEf7CyR+UtfflW547kHBq6c5DFnKzn4h0Lq7qb8duwpw9zo fpfQKj4GyOKGqdKijdiFZ29f8Id6Ie/+IQWyKOu9spSIhhlIqLrd0aFLBCP7qvT59mPQ 7QKQ== X-Gm-Message-State: APjAAAXAc3scFhnVFj/TGLnjoR/TZOj867WC5eFpF+dVJ+fnlR5sLfpF eNgEVVCZyhkpbYcO+DE/AEk= X-Google-Smtp-Source: APXvYqyO8W2b/SREbICV3qh//alxBzUpHxuzh7aiRifiPuKdS8Q5clZxnu+XAGqWQqbXdIYQvnp/UA== X-Received: by 2002:a62:e318:: with SMTP id g24mr11829552pfh.218.1581570548543; Wed, 12 Feb 2020 21:09:08 -0800 (PST) Received: from asus.hsd1.ca.comcast.net ([2601:647:4000:d7:a815:f3bb:71b5:79fa]) by smtp.gmail.com with ESMTPSA id i2sm821994pjs.21.2020.02.12.21.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 21:09:07 -0800 (PST) From: Bart Van Assche To: "Martin K . Petersen" Cc: target-devel@vger.kernel.org, Dakshaja Uppalapati , Sagi Grimberg , Mike Marciniszyn , Bart Van Assche , Rahul Kundu Subject: [PATCH 2/2] Revert "target: iscsi: Wait for all commands to finish before freeing a session" Date: Wed, 12 Feb 2020 21:09:00 -0800 Message-Id: <20200213050900.19094-2-bvanassche@acm.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213050900.19094-1-bvanassche@acm.org> References: <20200213050900.19094-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Since commit e9d3009cb936 introduced a regression and since the fix for that regression was not perfect, revert this commit. Cc: Rahul Kundu Cc: Mike Marciniszyn Cc: Sagi Grimberg Reported-by: Dakshaja Uppalapati Fixes: e9d3009cb936 ("scsi: target: iscsi: Wait for all commands to finish before freeing a session") Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target.c | 10 ++-------- include/scsi/iscsi_proto.h | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 7251a87bb576..09e55ea0bf5d 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1165,9 +1165,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length, conn->cid); - if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) - return iscsit_add_reject_cmd(cmd, - ISCSI_REASON_WAITING_FOR_LOGOUT, buf); + target_get_sess_cmd(&cmd->se_cmd, true); cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd, scsilun_to_int(&hdr->lun)); @@ -2004,9 +2002,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, conn->sess->se_sess, 0, DMA_NONE, TCM_SIMPLE_TAG, cmd->sense_buffer + 2); - if (target_get_sess_cmd(&cmd->se_cmd, true) < 0) - return iscsit_add_reject_cmd(cmd, - ISCSI_REASON_WAITING_FOR_LOGOUT, buf); + target_get_sess_cmd(&cmd->se_cmd, true); /* * TASK_REASSIGN for ERL=2 / connection stays inside of @@ -4234,8 +4230,6 @@ int iscsit_close_connection( * must wait until they have completed. */ iscsit_check_conn_usage_count(conn); - target_sess_cmd_list_set_waiting(sess->se_sess); - target_wait_for_sess_cmds(sess->se_sess); ahash_request_free(conn->conn_tx_hash); if (conn->conn_rx_hash) { diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index 533f56733ba8..b71b5c4f418c 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h @@ -627,7 +627,6 @@ struct iscsi_reject { #define ISCSI_REASON_BOOKMARK_INVALID 9 #define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10 #define ISCSI_REASON_NEGOTIATION_RESET 11 -#define ISCSI_REASON_WAITING_FOR_LOGOUT 12 /* Max. number of Key=Value pairs in a text message */ #define MAX_KEY_VALUE_PAIRS 8192