Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1143227pxv; Fri, 9 Jul 2021 19:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Iz5HiIygl1VxLxkyyn2v/DZjfxDx1Dpl1Sn4fHuJ/9GpO690sExBcFu9ISVS1Nb2bOTK X-Received: by 2002:a17:907:1691:: with SMTP id hc17mr39871816ejc.382.1625883752831; Fri, 09 Jul 2021 19:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625883752; cv=none; d=google.com; s=arc-20160816; b=Bp/6Ppe+Lg8H+1q/enrSI70il94M5XmmECH1zHklHfIIJYArWKSu2nrDtoZy7OKJNq DKIsarrddGOpWmVZDWaRoDADWTIb9h0ytEzPb/YTKuAKGEx+wBsyGxlfmYYB/O5YSdtq Q/r9wouxZyMpUTAQgc/sByhkj89Hwi7x/lKmxPj50PCfyaNOLoUdWMYGHNgZlpwtTuzH FK95jiAqCBaesoLWZklLPOZ4NKnmttRSGdZGSLoTsDbNGLvQLZ4pFaLHYbrnOPi2XBz/ j91gLI1s59k84p1dOQHAiwydMRXE9la/+9S/CCSrkRoO8piHPqxQ7rDqH01CQl8MZkvM niTg== 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=0XKGN4S4qChzvwzQcwQSjz9JvdhWlhXW5suabjEs0ol8KFxjs01FLXfkSvVhouhA9v i4MKsuIU/7rlW4pfy0S39vwvSWq6y/TesYZErPQ0F2qxvUR0TQd/3ZeJMUq7Hfvee87B E8SyyUglFLBeQVg4BBTOgvCpedzaANYdNEZepfJd+Zz1YP4OvLjxyuIDNgmtaDZiBSFy 0O7w8z08psdOBNFqZfVxKrtrm0ojAGj8nT526bW/GlJ80f8BdbRUwhE1Ok6oWCDDznbS k+qPB6PWmDgizpziSpnomd9YY74Tb8zZ6du+3wH949teo4Zy0/82KWH3/+rAZnD02FHV axWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lLMgr9eT; 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 m4si8892703eja.301.2021.07.09.19.22.09; Fri, 09 Jul 2021 19:22:32 -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=lLMgr9eT; 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 S232937AbhGJCW3 (ORCPT + 99 others); Fri, 9 Jul 2021 22:22:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:37724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232579AbhGJCVo (ORCPT ); Fri, 9 Jul 2021 22:21:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D8EE61404; Sat, 10 Jul 2021 02:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883537; bh=6DCloj/Qq/rLahaj4a/7ASsaS4TG2vOx87BOfLvF36A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lLMgr9eTJi3LXyEbnQrNnnuqvxZFDpi1tU7JH28N+JTAhTvrcyGzcxxW8ZzZ3Fz2A 8DOqcbihYcoma2Tj734pfiloyzg7U/SENvmkimhaaGOiMWxbqx1EbMwmrCqmAVH+E0 5/zabwOU7NhXPPGV3asA7vfnP8Yd5EsHz+P2NmfuNbwu6oKhfrf//C6UmBS4D2FoL1 maeaQixspD6nCCyljD7izDzP3V1Xsug5beMqeMEaMe9hajVinKdxDdIfVzE0zoRqIs UJCnuduzSDoHjmAjomW8cEFFyb5+ENGJmMQk9xjOtUJt1xbE+2xIbAGDLXpoeyrYSp ECTQyWUzzqbRA== 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.13 050/114] scsi: qedi: Fix cleanup session block/unblock use Date: Fri, 9 Jul 2021 22:16:44 -0400 Message-Id: <20210710021748.3167666-50-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710021748.3167666-1-sashal@kernel.org> References: <20210710021748.3167666-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