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 <ben.coddington@hammerspace.com>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jon Curley <jcurley@everpuredata.com>,
	Eric Badger <ebadger@everpuredata.com>,
	Shiva Lingappa <slingappa@everpuredata.com>,
	stable@vger.kernel.org
Subject: [PATCH] NFSv4/pNFS: Don't cancel I/O when re-checking a deferred layoutreturn
Date: Fri, 20 Nov 2026 01:04:54 +0000	[thread overview]
Message-ID: <20261120010454.2153387-1-tmenninger@everpuredata.com> (raw)

pnfs_layout_need_return() runs whenever a reference to a layout header
is put while a return is pending. It marks the segments covered by the
pending return and, if none of them is still in use, lets the caller
send the LAYOUTRETURN; otherwise the return stays deferred until they
drain.

Since commit b739a5bd9d9f ("NFSv4/flexfiles: Cancel I/O if the layout
is recalled or revoked"), this re-check also requests cancellation of
I/O on matching segments still in use. Changed-layout recalls,
error-driven returns, and file bulk returns already request cancellation
when initiating the return.

As segments drain, the pending return's sequence cutoff can advance,
so a later re-check can also cover newly acquired segments. Cancelling
their I/O can perpetuate a cancellation and retry cycle.

Disable cancellation in the deferred re-check, while retaining segment
invalidation and waiting for outstanding references to drain. Explicit
cancellation by the initiating paths is unchanged.

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, with "NFS/flexfiles: Don't treat a locally aborted
read as a DS failure" applied. Once LAYOUTRETURNs were being sent again,
the re-check kept cancelling the reads of freshly obtained segments, at
about ten transport reconnects per second. With this change, once the DS
was back no reads were cancelled and no transports were reconnected.

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/pnfs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 14f4a4b12ffd3..a60df3bdab921 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -480,15 +480,16 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
 
 static int pnfs_mark_layout_stateid_return(struct pnfs_layout_hdr *lo,
 					   struct list_head *lseg_list,
-					   enum pnfs_iomode iomode, u32 seq)
+					   enum pnfs_iomode iomode, u32 seq,
+					   bool cancel_io)
 {
 	struct pnfs_layout_range range = {
 		.iomode = iomode,
 		.length = NFS4_MAX_UINT64,
 	};
 
-	return pnfs_mark_matching_lsegs_return(lo, lseg_list, &range, seq, true,
-					       NULL);
+	return pnfs_mark_matching_lsegs_return(lo, lseg_list, &range, seq,
+					       cancel_io, NULL);
 }
 
 static int
@@ -903,7 +904,7 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
 		list_del_init(&lo->plh_bulk_destroy);
 		if (mode == PNFS_LAYOUT_FILE_BULK_RETURN) {
 			pnfs_mark_layout_stateid_return(lo, &lseg_list,
-							IOMODE_ANY, 0);
+							IOMODE_ANY, 0, true);
 		} else if (pnfs_mark_layout_stateid_invalid(lo, &lseg_list)) {
 			if (mode == PNFS_LAYOUT_BULK_RETURN)
 				set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
@@ -1405,7 +1406,8 @@ pnfs_layout_need_return(struct pnfs_layout_hdr *lo)
 		return false;
 	return pnfs_mark_layout_stateid_return(lo, &lo->plh_return_segs,
 					       lo->plh_return_iomode,
-					       lo->plh_return_seq) != -EBUSY;
+					       lo->plh_return_seq,
+					       false) != -EBUSY;
 }
 
 static void pnfs_layoutreturn_before_put_layout_hdr(struct pnfs_layout_hdr *lo)

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
-- 
2.53.0


                 reply	other threads:[~2026-11-20  1:04 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=20261120010454.2153387-1-tmenninger@everpuredata.com \
    --to=tmenninger@everpuredata.com \
    --cc=anna@kernel.org \
    --cc=ben.coddington@hammerspace.com \
    --cc=ebadger@everpuredata.com \
    --cc=jcurley@everpuredata.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=slingappa@everpuredata.com \
    --cc=stable@vger.kernel.org \
    --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®