From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f41.google.com (mail-dl1-f41.google.com [74.125.82.41]) (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 897A613D51C for ; Tue, 3 Feb 2026 19:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770146015; cv=none; b=nZp35UQTwUMSFh6Q50txHamzoJ5fg7z2SQcGfTqp6dZUkKqQVw6yOd5oG06vwFh3ADxYd2UHe0d2GHwTSDgUfPEwOWoiYp+2RM6NtXqwdUKhEvSrWg4Iq9kYIY33Z9f9IdY7n42TGOlWGP3vng7J/K8DbRylioAHeeKBj/zPW0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770146015; c=relaxed/simple; bh=G2uJppQSwpqZJiWyVdMxLT6VDEUimwVJZEaeBgSFiRc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BOyoKofcKHnYv022vqBJsJgZlO8ZWGRWYbJUh8V7fdstMkUf7aMynNTRideKBjZlIFymRoYDnrPm+BiKp+1JdJwJGB6A/zalUFltGEeH7pdwKf7Tx+jqVt5IbB3ieWDWu0K+niZ+PNYyMQwckjsLwlEXyiIc2kVj01EW++qOF3I= 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=glW+/3Ea; arc=none smtp.client-ip=74.125.82.41 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="glW+/3Ea" Received: by mail-dl1-f41.google.com with SMTP id a92af1059eb24-11f1fb91996so3395659c88.1 for ; Tue, 03 Feb 2026 11:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1770146013; x=1770750813; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ZfpGUUC7DLfW3R45GND4ah/dTJAdyEs2bYq8haj1B1E=; b=glW+/3Ea7NWs05DjepEyJOVri+T+yGurHpXasEG0VT5MMjAL9Mw6a77hPp5g0A42X9 S66G7H/WGNODX3wt6lNLXSlGgdUMyQhZZ7ep+gweMUsAl8Po7p2Hdr29Yh6tyeFoOPyL SQN1pPGG9q0WEcO9CiAhDE4nCI9B7zMDNzq//ITvbyoQeKCioyeD9PQcCB4LQJCrxv+I VSdo9LT8aRqU0NoKfjYTHjzStgxYVBA+hI4xa6+Oe3SsZm66KIF6jnUJsp5c18bhlpwG SOVXpk89gJ0+rHIp8BYt1m3D7bEheTpPuwNm6tVeEQCUDawkJdQaKGcbKAjb08pn2ym5 peHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770146013; x=1770750813; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZfpGUUC7DLfW3R45GND4ah/dTJAdyEs2bYq8haj1B1E=; b=ZE71/BQRbnKRFGKa25ofQ6COphh0dxZhzBMiWfY1UFAOQSQFvoNW6tTI5BKE/t6AZf M+Ul1TEJh5NnLLckrW17CVs7SVkUolLdyzmpI9JkNAYfG7DD/a68WwtayzhW7iQ2n5PI KoFcXQShwXzeAzQ0tGjbTXKSvZZmgE0MT9fb8rJVlj/HNn13hZsdcbbMljMrkTuO7oXJ dTN2RCyqLA/dW5X1LImfP00YmZ/HfdroBjdQav3xqk0XuKnaMe0zwHySi+w3faQH5yhd HaAgE+nrd+IlL0R6Q7LWKLH5oggesLyZWZzkmPT2tK+E5HtY0jYsEgirkBnHaiUqAIfd nHCQ== X-Forwarded-Encrypted: i=1; AJvYcCUcZxuXvWiV+AHTboMvxH9ipl8UrWh0VWA6PWsMZ49ma+1Wz+u33JrHNMtnaUZDEV0zttHwQHjlW4vylKA=@vger.kernel.org X-Gm-Message-State: AOJu0YxypSOOAlvpehGQw7FezsUpRDxRNjlSCLHqkv4uqg8WmsEQDE/A 5z2J0pDB5XBGHd6QhCg0X/Dgcu16XTfcX76PxDJfGlJFMZIENpBzv0asiODBTXFCGno= X-Gm-Gg: AZuq6aKpMzGF005nj0o714jPU6qtsqCKzw6Eqc21NaJ7eUOew2hQn5IgerUf0sDiFTu Ga7xwRJpD7JCn+fdQ8tk9c5wc195SiYZTKXdo4mfZ+1thmKfPo6gix73/HTBLuDAIc85Bz29HZu 8fUCvNLNx9uqlZiH3s26UkHvTj2MyuX4x/pyzgKgB7JHlJNabdAAivFDKqtQNxkavaiaZzswcFK 2Vgde8/eaIz8NA9/3OQ+iJ1OFJ/zFHmmDxqcNN2IRD8fmu8X0Z2xpXkNg0BnzRUaCb+w2qlrBiF jM7w/oM2ClWU82GKBViAyL0tVjwQWsVBRJ9fz6/kohpLxb/4WhojcFw6uO7h/voXVXnsuDUI1Ky 4dFpka9yQ3FBmpRLB8EjV5xsPfUq8sVH8gqz02SeIreJKUgTYVDFP0Sch/C5lvzWnp1ddj/uuIu C7Wjpml55B9kux79zaVBvzweFBJixnGLs= X-Received: by 2002:a05:7022:6b83:b0:11a:4016:44a5 with SMTP id a92af1059eb24-126f47c4507mr220685c88.24.1770146012358; Tue, 03 Feb 2026 11:13:32 -0800 (PST) Received: from medusa.lab.kspace.sh ([208.88.152.253]) by smtp.googlemail.com with UTF8SMTPSA id a92af1059eb24-126f4e042bfsm178554c88.4.2026.02.03.11.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Feb 2026 11:13:32 -0800 (PST) Date: Tue, 3 Feb 2026 11:13:31 -0800 From: Mohamed Khalfella To: Hannes Reinecke Cc: Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , Aaron Dailey , Randy Jennings , Dhaval Giani , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 07/14] nvme: Introduce FENCING and FENCED controller states Message-ID: <20260203191331.GD3729-mkhalfella@purestorage.com> References: <20260130223531.2478849-1-mkhalfella@purestorage.com> <20260130223531.2478849-8-mkhalfella@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue 2026-02-03 06:07:35 +0100, Hannes Reinecke wrote: > On 1/30/26 23:34, Mohamed Khalfella wrote: > > 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 can not be > > reset of 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 to happen while controller is > > in FENCING state. > > > > Signed-off-by: Mohamed Khalfella > > --- > > drivers/nvme/host/core.c | 25 +++++++++++++++++++++++-- > > drivers/nvme/host/nvme.h | 4 ++++ > > drivers/nvme/host/sysfs.c | 2 ++ > > 3 files changed, 29 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > > index 8961d612ccb0..3e1e02822dd4 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 = true; > > + fallthrough; > > + default: > > + break; > > + } > > + break; > > + case NVME_CTRL_FENCED:> + switch (old_state) { > > + case NVME_CTRL_FENCING: > > + changed = 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 = true; > > fallthrough; > > default: > > @@ -760,6 +779,7 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl, > > > > if (state != NVME_CTRL_DELETING_NOIO && > > state != NVME_CTRL_DELETING && > > + state != NVME_CTRL_FENCING && > > Shouldn't 'FENCED' be in here, too? Agreed. Will add FENCED to the two places. > > > state != NVME_CTRL_DEAD && > > !test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) && > > !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH)) > > @@ -802,10 +822,11 @@ bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, > > req->cmd->fabrics.fctype == nvme_fabrics_type_auth_receive)) > > return true; > > break; > > - default: > > - break; > > + case NVME_CTRL_FENCING: > > Similar here. > > > case NVME_CTRL_DEAD: > > return false; > > + default: > > + break; > > } > > } > > > > diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h > > index 9dd9f179ad88..00866bbc66f3 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, > > @@ -777,6 +779,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 f81bbb6ec768..4ec9dfeb736e 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[] = { > > [NVME_CTRL_NEW] = "new", > > [NVME_CTRL_LIVE] = "live", > > + [NVME_CTRL_FENCING] = "fencing", > > + [NVME_CTRL_FENCED] = "fenced", > > [NVME_CTRL_RESETTING] = "resetting", > > [NVME_CTRL_CONNECTING] = "connecting", > > [NVME_CTRL_DELETING] = "deleting", > > You need to modify nvme-tcp.c:nvme_tcp_timeout() too, as this checks > 'just' for 'LIVE' state and will abort/terminate commands when in > FENCING. Similar argument for nvme-rdma.c. And nvme-fc.c also needs an > audit to ensure it works correctly. Exactly. The changes to nvme-tcp, nvme-rdma, and nvme-fc are in transport specific patches. For tcp and rdma the timeout callback handler has been modified to do what you mentioned. For nvme-fc nvme_fc_start_ioerr_recovery() does nothing if the controller is in FENCING state.