Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1144771pxv; Fri, 9 Jul 2021 19:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzap1dTXJdTuwCmFEDMt5ktKBmsCNelbEvp6bMDPa4jBVywDmPFgetNiQ1uoA2LiTHs13Mo X-Received: by 2002:a05:6402:2685:: with SMTP id w5mr40346342edd.71.1625883956892; Fri, 09 Jul 2021 19:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625883956; cv=none; d=google.com; s=arc-20160816; b=WlWi0qkXhp/XBk7Pzn6cjhHPeBKjsvdEx5rEMm47mgnznPH8oHeRYiXR642h3H2iEU JfVsxJtGSdTbFz2XLUwmHRBsWAuTXmshU9C22TZgSHgdx5XDaVzJmMWddWh/K3snrJAE vy/wCvZ8PynQeTqpX+vLhUhK8WUK947fQt3+yFtakyeWj/P0I1U4Qv2H8L/uUm471UQT yhsuIgjGsKLSwi6OuCvYNqCrLfbM7xhO2yrv0AgMwFw9tLchbeqJasMBNBZvXd2GQOva J2gLGqbAeg4u6UItBnhrgMAKK30tBo7kaOti/Hqevqt3kNrBmKRy+b9rysy9UkrR9UFk PiVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MHtxzZ62C0KvWQtvuCrw3QPep9g+Z+bXuiukTM7VWYc=; b=glvUSwD0gsfh6BONAk9/yub4yhql1AO+vjuDLno8wQMQES5OTT2VukOtNMn5RQ8Jq/ rt3K1dGni3VF2T/poOreIv49ezTdGg0WTGibbLBRE3JexXO8kQplRunuuShsEiz51KH4 vbfaGto+uzUwERej/6+/CfgRsJD55F1glbsryMgIenOE5RG2NnW12/FpX0nfXfm9TsN6 wXnxMsANRS06X/NMpyBbg8kgD7J0QkT2NUQBgkfgF1OSM4pHNAXv/Qopc2WOvIwdgNE5 NdREbKae44QJJzYq77bNge/3j02lcv1RLnBetDGhXuajND8MwYMjLlu3ifGQYJksWrmH r70w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="INp0/VqN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si8294066ejj.184.2021.07.09.19.25.33; Fri, 09 Jul 2021 19:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="INp0/VqN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233376AbhGJC0i (ORCPT + 99 others); Fri, 9 Jul 2021 22:26:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:42974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbhGJCZm (ORCPT ); Fri, 9 Jul 2021 22:25:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CCE32613DC; Sat, 10 Jul 2021 02:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883777; bh=6DCloj/Qq/rLahaj4a/7ASsaS4TG2vOx87BOfLvF36A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INp0/VqNzzNZO8SczTASRLHPo/a9x7yyplIRQYWE56DW9bavc543dJ/MYP1Lh0RWg ygcLgCAJ8IobUCbSQs6AyS7EQ757EBpVgO97dn8GT1WbueuxKb1UYWWthr7Q2INIcZ ciX1ezU4rggWx5b9IRmVq3AZhJHq6EjkDccdtIAWBrnsLfA/1J2B8EWEuz03wdakk8 v32+s+8yGnzYL1mRX+f8uKmYwaG7B5EUZ2etnK9z+wpguct8t719zxwq1NZanCuPQG pklJhprq6E/gGtF+kYMozqBlMo96yLQrlNkAwRJgvVMDLSpS0KYn+W+T3hzIeRfzUL hLE9+MoyIW3XQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Christie , Manish Rangankar , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.12 046/104] scsi: qedi: Fix cleanup session block/unblock use Date: Fri, 9 Jul 2021 22:20:58 -0400 Message-Id: <20210710022156.3168825-46-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Christie [ Upstream commit 0c72191da68638a479602dd515b587ada913184a ] Drivers shouldn't be calling block/unblock session for cmd cleanup because the functions can change the session state from under libiscsi. This adds a new a driver level bit so it can block all I/O the host while it drains the card. Link: https://lore.kernel.org/r/20210525181821.7617-26-michael.christie@oracle.com Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qedi/qedi.h | 1 + drivers/scsi/qedi/qedi_iscsi.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qedi/qedi.h b/drivers/scsi/qedi/qedi.h index c342defc3f52..ce199a7a16b8 100644 --- a/drivers/scsi/qedi/qedi.h +++ b/drivers/scsi/qedi/qedi.h @@ -284,6 +284,7 @@ struct qedi_ctx { #define QEDI_IN_RECOVERY 5 #define QEDI_IN_OFFLINE 6 #define QEDI_IN_SHUTDOWN 7 +#define QEDI_BLOCK_IO 8 u8 mac[ETH_ALEN]; u32 src_ip[4]; diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index a7003847bd4c..8f8036ae9a56 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -330,12 +330,22 @@ qedi_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid) void qedi_mark_device_missing(struct iscsi_cls_session *cls_session) { - iscsi_block_session(cls_session); + struct iscsi_session *session = cls_session->dd_data; + struct qedi_conn *qedi_conn = session->leadconn->dd_data; + + spin_lock_bh(&session->frwd_lock); + set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); + spin_unlock_bh(&session->frwd_lock); } void qedi_mark_device_available(struct iscsi_cls_session *cls_session) { - iscsi_unblock_session(cls_session); + struct iscsi_session *session = cls_session->dd_data; + struct qedi_conn *qedi_conn = session->leadconn->dd_data; + + spin_lock_bh(&session->frwd_lock); + clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); + spin_unlock_bh(&session->frwd_lock); } static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi, @@ -789,6 +799,9 @@ static int qedi_task_xmit(struct iscsi_task *task) if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) return -ENODEV; + if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags)) + return -EACCES; + cmd->state = 0; cmd->task = NULL; cmd->use_slowpath = false; -- 2.30.2