mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Menninger <tmenninger@everpuredata.com>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: Benjamin Coddington <bcodding@hammerspace.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Jeff Layton <jlayton@kernel.org>,
	Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>,
	Jon Curley <jcurley@everpuredata.com>,
	Eric Badger <ebadger@everpuredata.com>,
	Shiva Lingappa <slingappa@everpuredata.com>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH] NFS/flexfiles: Don't treat a locally aborted read as a DS failure
Date: Fri, 20 Nov 2026 01:06:24 +0000	[thread overview]
Message-ID: <20261120010624.2154348-1-tmenninger@everpuredata.com> (raw)

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


                 reply	other threads:[~2026-11-20  1:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120010624.2154348-1-tmenninger@everpuredata.com \
    --to=tmenninger@everpuredata.com \
    --cc=anna@kernel.org \
    --cc=bcodding@hammerspace.com \
    --cc=ebadger@everpuredata.com \
    --cc=jcurley@everpuredata.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=slingappa@everpuredata.com \
    --cc=snitzer@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tigran.mkrtchyan@desy.de \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®