From nobody Fri Apr 3 00:00:13 2026 Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A1672BDC2F for ; Sat, 14 Feb 2026 04:28:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771043311; cv=none; b=heNncDSC4XKObZcO0ImrhTJVq6oqbPNuzJAz93C2ysRR7gosY/lzPmYyM3ccdZUSXhdOFuKxIdlh2eHhzOKR5eGkfmdgCP6yhunTdvE8JIxkEUzs9LSaz+8pTHnPAcr6Sk6nJUHiBeHVnLJlSUfaUQD4e0kfKqb5A2Ha2qkFqmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771043311; c=relaxed/simple; bh=rY8VtL20RrRuTrGx+BCj5qNQJT9lFX1N+Lnq70gdVZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hJa9yCGPbqrajNlGETSwUPs4KVMg+QHPdJsck5AT4WWZQbeJkc6f5lZRnTOxTHcBfjshQNoTm46MMY2I86o8U7iY+53oMtRwz8YKqHjccAjkHUes2BT0Bc4CFHQ5yUOvoCUucMXWBbPCtDGZwHMd3Uhx8qUoO+4eTX7i+aKxJts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=cwBcEu3x; arc=none smtp.client-ip=74.125.82.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="cwBcEu3x" Received: by mail-dl1-f52.google.com with SMTP id a92af1059eb24-1248d27f2b9so2229472c88.0 for ; Fri, 13 Feb 2026 20:28:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1771043307; x=1771648107; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+YYScjSesE0x8k06HUvqt/BkKPH2VBLshBgb+fspSKA=; b=cwBcEu3xPSPRbClzQOqckpDgNrbqQfhutjCtQ/zcBSJ7oZ94iEpSwnDs8QCUS+HU9I go5AqugEzeK5Twa4VUolWRnJba00Q/1LTG4PDaLoQwrMRXqpSKQasyNL4qTZOVu/0Kg/ dHOvaTmkTy3SoXOZweVU8uSxFbamIhp1nA9jyNt/OEQfz02nqnASkCCAGZ1SvMzlXeT5 UaUkYELxGXPNvlaUUw9XFAGVdtahdjI/okVmvYediCdxrkU0G1w3Xeqr/SEqltyQqEd4 Ko5IQaAsMGnst3GRfJNHUlzL7Bz88WLsA1numEj82qH7YvZ8ZYWzzX1SEri37nb2AL9n 6P+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771043307; x=1771648107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+YYScjSesE0x8k06HUvqt/BkKPH2VBLshBgb+fspSKA=; b=JMISXdBj0X/vtwQpXvTjtmoWT/XNBKY7EX+azicz5LVNwC9NQGbw6YgLVXpAaYMpvo awlpKfY5tTQ+/s+J9mG/lQzAq+Sp2qVgeHOUEJgeJEVrD8ck31lkO4zM60u3anmYKJa5 A7gRYSGtQ36o+of9QSfYkUGVK1jaU4E4uyREQ5Oefeva7zAj+Od98jtlQ13hBt9r7bg0 KViA/9GAnscJ7KPbYSi3LA1fd1jcaEMH2f1dE2e+198rafWxI4XyYJwehhRVBXkh6LzL CZkn2h+8HrE5mpGrWDRPmzP2stHIpLL3Ekkwtq2t82QiCTNbrvwfzvxLzJPIyD80BJMz fSAg== X-Forwarded-Encrypted: i=1; AJvYcCUsEF/yq4+ScKpgUMiN8Jzxv0qMoEzl/VfZsnOkZ9pNUlt5fb1XifMIUTYD2vx6Y/rIYc0alJdopl+FXns=@vger.kernel.org X-Gm-Message-State: AOJu0YxcFMpoOlqMmzEoBMGPsiB2v1l70x9GKRxIY6qRLtzPk7kt5fTY R5Y0sxpfsxYAMSoSXsDWkHG63bXOihX7zwjOYeiF/wZxlbW8Hi5NwViBb/0bZs8Vpn4= X-Gm-Gg: AZuq6aKf1zezHpIQNq545ubaShmGkKB2T2f2clKf/F7wKSBn/7Ak1z/i4xZ0qjcxSZt mhDYHUOPI1sqMJVFH8MGmXtPioVLAM7HZ4ae/b+mpjuTFW50uHrVlF06GBDKLEpbUPNTJtm7xNm T4rLONdULqVUkZ0WM4s1eJ+MwG7+fVHSWDXNUFf63QT5jily9Nd2YvGZ/gmTd2WWiC8QRuVlaHV xnmRpTIU3hJgzdUY5afGSuPLqwElhZ5J4UJbvDg+zzYEDjgYRQmVtbnAzkOblzCt1Fl0ldNnLUG m5AFPPhjLECh2ZWSSf0PJ835BNQm39WdttzYPM+fCYCV2dXNN2vgufntRAklAKHhrdgBMX6Jfzv UN6dqKucLmKg50EjlEP8uRNqMniursdx/flZF3BIQA6yDTZf7mH+hGeiA7J5Jyit+Da3BkMHaB2 XQLeL/DVsn5m2xbJNcP8cLGpeMC4hYEzpD//ImYUefLmHN1g== X-Received: by 2002:a05:7022:4596:b0:124:65f7:2c2e with SMTP id a92af1059eb24-127398443b8mr1428287c88.43.1771043306958; Fri, 13 Feb 2026 20:28:26 -0800 (PST) Received: from apollo.purestorage.com ([208.88.152.253]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-12742cbc900sm1021042c88.14.2026.02.13.20.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 20:28:26 -0800 (PST) From: Mohamed Khalfella To: Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , James Smart , Hannes Reinecke Cc: Aaron Dailey , Randy Jennings , Dhaval Giani , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Mohamed Khalfella Subject: [PATCH v3 07/21] nvme: Introduce FENCING and FENCED controller states Date: Fri, 13 Feb 2026 20:25:08 -0800 Message-ID: <20260214042753.4073668-8-mkhalfella@purestorage.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260214042753.4073668-1-mkhalfella@purestorage.com> References: <20260214042753.4073668-1-mkhalfella@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" FENCING is a new controller state that a LIVE controller enter when an error is encountered. While in FENCING state,inflight IOs that timeout are not canceled because they should be held until either CCR succeeds or time-based recovery completes. While the queues remain alive requests are not allowed to be sent in this state and the controller cannot be reset or deleted. This is intentional because resetting or deleting the controller results in canceling inflight IOs. FENCED is a short-term state the controller enters before it is reset. It exists only to prevent manual resets from happening while controller is in FENCING state. Signed-off-by: Mohamed Khalfella Reviewed-by: Hannes Reinecke --- drivers/nvme/host/core.c | 27 +++++++++++++++++++++++++-- drivers/nvme/host/nvme.h | 4 ++++ drivers/nvme/host/sysfs.c | 2 ++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8d26e27992fc..231d402e9bfb 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -574,10 +574,29 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, break; } break; + case NVME_CTRL_FENCING: + switch (old_state) { + case NVME_CTRL_LIVE: + changed =3D true; + fallthrough; + default: + break; + } + break; + case NVME_CTRL_FENCED: + switch (old_state) { + case NVME_CTRL_FENCING: + changed =3D true; + fallthrough; + default: + break; + } + break; case NVME_CTRL_RESETTING: switch (old_state) { case NVME_CTRL_NEW: case NVME_CTRL_LIVE: + case NVME_CTRL_FENCED: changed =3D true; fallthrough; default: @@ -760,6 +779,8 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctr= l *ctrl, =20 if (state !=3D NVME_CTRL_DELETING_NOIO && state !=3D NVME_CTRL_DELETING && + state !=3D NVME_CTRL_FENCING && + state !=3D NVME_CTRL_FENCED && state !=3D NVME_CTRL_DEAD && !test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) && !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH)) @@ -802,10 +823,12 @@ bool __nvme_check_ready(struct nvme_ctrl *ctrl, struc= t request *rq, req->cmd->fabrics.fctype =3D=3D nvme_fabrics_type_auth_receive)) return true; break; - default: - break; + case NVME_CTRL_FENCING: + case NVME_CTRL_FENCED: case NVME_CTRL_DEAD: return false; + default: + break; } } =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 6984950b9aa8..b1c37eb3379e 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -251,6 +251,8 @@ static inline u16 nvme_req_qid(struct request *req) enum nvme_ctrl_state { NVME_CTRL_NEW, NVME_CTRL_LIVE, + NVME_CTRL_FENCING, + NVME_CTRL_FENCED, NVME_CTRL_RESETTING, NVME_CTRL_CONNECTING, NVME_CTRL_DELETING, @@ -776,6 +778,8 @@ static inline bool nvme_state_terminal(struct nvme_ctrl= *ctrl) switch (nvme_ctrl_state(ctrl)) { case NVME_CTRL_NEW: case NVME_CTRL_LIVE: + case NVME_CTRL_FENCING: + case NVME_CTRL_FENCED: case NVME_CTRL_RESETTING: case NVME_CTRL_CONNECTING: return false; diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c index cd835dd2377f..1e4261144933 100644 --- a/drivers/nvme/host/sysfs.c +++ b/drivers/nvme/host/sysfs.c @@ -443,6 +443,8 @@ static ssize_t nvme_sysfs_show_state(struct device *dev, static const char *const state_name[] =3D { [NVME_CTRL_NEW] =3D "new", [NVME_CTRL_LIVE] =3D "live", + [NVME_CTRL_FENCING] =3D "fencing", + [NVME_CTRL_FENCED] =3D "fenced", [NVME_CTRL_RESETTING] =3D "resetting", [NVME_CTRL_CONNECTING] =3D "connecting", [NVME_CTRL_DELETING] =3D "deleting", --=20 2.52.0