* [PATCH] NFSv4/pNFS: Don't cancel I/O when re-checking a deferred layoutreturn
@ 2026-11-20 1:04 Tim Menninger
0 siblings, 0 replies; only message in thread
From: Tim Menninger @ 2026-11-20 1:04 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker
Cc: Benjamin Coddington, linux-nfs, linux-kernel, Jon Curley,
Eric Badger, Shiva Lingappa, stable
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-20 1:04 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:04 [PATCH] NFSv4/pNFS: Don't cancel I/O when re-checking a deferred layoutreturn 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®