Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1147510pxv; Fri, 9 Jul 2021 19:31:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwg4W6FtE2/GNapaHbXt6W+iV9xCmBEEKjTp7kICey13Wfqms9niBt0rC8koA/K+bS49BD X-Received: by 2002:a17:906:9742:: with SMTP id o2mr40903780ejy.532.1625884296822; Fri, 09 Jul 2021 19:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884296; cv=none; d=google.com; s=arc-20160816; b=JATtV7iqr+1+QL+Ntc78cQav+jXvMIXjT5lLnStBch2DYWT5BndOy8++fP+ECpOrNe Fpbkr0iIb7tjB2iALJDFD90nONc10hUWfVWlrelNZCr1uz+LjGPsEjwXnEW1jf6QOmy0 pIJ+0RaRuVxhtDSYnOTbnc5SBc0lRW13zJJg5GY4vELlEc7VP8sddfEEmKeBOXPbfy0r 4FiL0mbYC5Umv+12ddRY1v3f8QAYQ2y62lUd0l0dAN+/mMsCMFHBLrjBw0cU8zT2u5hX GoLi19iXLwBpkzjuWBIrP5KXuwQg2l0oEzGTSujsqeGcn41ewcr8i77bKRE0Og+sKjvZ ru1Q== 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=b++mNK5e/Y6c6KWwbPLjbul74INMfZjm57LBFa0gnNs=; b=bGQin637bAIXfypyYZWohb0jzT5ckk4R1uWLBHLjzZHWaq0xy90NxMRmyQJ6UcnzWX dsUQmIEKXdEUAXc7Qxv24/7t588vVgZeGnDnj8xuyOqY3HzPjFWVzxNDB2q2+V8dojAz INs3P8Um6LRK6VS94qVk53v/Z8/tm5x7heygbBqOTlm0j9KOHFKeYhPzBBCpAHWs/86k jMII5X4Hjh+bOcIFsQitqAWS5CV+QdsHImfsPCA3nMhm4LhQAbzI60X7BDNgfQBpifZJ +GZqnQLSLzOYKjLzhdTcZJ0MgJySVz0tkAI1/X5syWASb8Gi395R/EE277YAsRrgXBnN OqOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cXf4RcQe; 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 v7si9867051edj.318.2021.07.09.19.31.14; Fri, 09 Jul 2021 19:31:36 -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=cXf4RcQe; 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 S234044AbhGJCcy (ORCPT + 99 others); Fri, 9 Jul 2021 22:32:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:41746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234113AbhGJC3H (ORCPT ); Fri, 9 Jul 2021 22:29:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1056D613EC; Sat, 10 Jul 2021 02:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883925; bh=vjPMcSvmEBQUdtWIqf1KlMOGuvuCB/XXT14L5N2VPhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXf4RcQeqZuL6Oi8pRwnQAD5QH95LRO7VqV50Kpfbd21Z/KdY7goB3wA28hsIhxnc vF4kWuucn2KCniEUTbgpQ1yxnK2r9IpLyCtgrGJe2NiXvUQ4tZpwnlPgxC06oxTqCV RelzKicgWOWTL95VJ0FV1jcFm4CLH17iN0FX7qTzsfbTmrkRHuHujCAFGZzH9TH+QH LJAdvkCAPbw4Jox2JsOqJsIY0Hc2SH4mD1HOPxDvvKiUp0qamK5H6Dt6yaN55lcOMd IM+HirMKeeusqibWxA2lfVP7u3EyR4dVSqvo3TSM7UqIQ9flzOIN/4fC/eR1xKnREI O2PUmUnGMKMuA== 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.10 43/93] scsi: qedi: Fix cleanup session block/unblock use Date: Fri, 9 Jul 2021 22:23:37 -0400 Message-Id: <20210710022428.3169839-43-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-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 604c4f408bc1..f51723e2d522 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