mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] NFS/flexfiles: Don't treat a locally aborted read as a DS failure
@ 2026-11-20  1:06 Tim Menninger
  0 siblings, 0 replies; only message in thread
From: Tim Menninger @ 2026-11-20  1:06 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker
  Cc: Benjamin Coddington, Mike Snitzer, Jeff Layton, Tigran Mkrtchyan,
	Jon Curley, Eric Badger, Shiva Lingappa, linux-nfs, linux-kernel,
	stable

When a flexfiles read asks for a pNFS resend, ff_layout_resend_pnfs_read()
treats the failure as a DS problem. It moves to the next mirror and sends
LAYOUTERROR, or, if no other mirror is usable, marks the layout for
return.

That is the wrong response when the client aborted the read itself.
Relevant cases which don't establish a new DS failure, and therefore no
longer drive another layout return:

    ECANCELED
        pnfs_lseg_cancel_io() cancelled the I/O because its layout
        segment was being returned or invalidated.

    EAGAIN with the current RPC attempt unsent and hdr->lseg invalid
        ff_layout_read_prepare_common() found the segment already
        invalidated and exited the task before transmission.

This was observed on 7.4-rc3 on a one-client one-DS system under
sustained direct-read I/O over pNFS/RDMA after restarting the nfs
service on the DS. Marking the layout for return cancels the reads of
the segments obtained in the meantime, which then fail the same way. The
client marked the layout for return from this path about 8,000 times a
second and reconnected transports about 300 times a second. With this
change, the layout was no longer marked for return from this path and
transports reconnected about 10 times a second.

Detect these local aborts before attempting DS failover and resend
through pNFS using the current mirror index as the starting point.
Skip the explicit LAYOUTERROR and layout-return requests in this
resend handler, leaving existing error recording unchanged.

Fixes: b739a5bd9d9f ("NFSv4/flexfiles: Cancel I/O if the layout is recalled or revoked")
Cc: stable@vger.kernel.org
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
---
 fs/nfs/flexfilelayout/flexfilelayout.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 5c289737366f2..31f17d79b270a 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1313,6 +1313,16 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
 	}
 }
 
+static bool ff_layout_read_aborted_locally(const struct nfs_pgio_header *hdr)
+{
+	const struct rpc_task *task = &hdr->task;
+
+	return task->tk_status == -ECANCELED ||
+	       (task->tk_status == -EAGAIN &&
+		!RPC_WAS_SENT(task) &&
+		!pnfs_is_valid_lseg(hdr->lseg));
+}
+
 static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)
 {
 	u32 idx = hdr->pgio_mirror_idx + 1;
@@ -1320,6 +1330,15 @@ static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)
 	u32 dss_id = 0;
 	struct nfs4_ff_layout_ds *mirror_ds;
 
+	/*
+	 * A local abort is no evidence against the DS, so skip DS failover
+	 * and don't request another layout return.
+	 */
+	if (ff_layout_read_aborted_locally(hdr)) {
+		pnfs_read_resend_pnfs(hdr, hdr->pgio_mirror_idx);
+		return;
+	}
+
 	mirror_ds = ff_layout_choose_any_ds_for_read(hdr->lseg, idx, &new_idx,
 						     hdr->args.offset, &dss_id);
 	if (IS_ERR(mirror_ds)) {

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-20  1:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20  1:06 [PATCH] NFS/flexfiles: Don't treat a locally aborted read as a DS failure Tim Menninger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®