From: Lei Yin <cybeyond@foxmail.com>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
yinlei2@lenovo.com
Subject: [PATCH] NFSv4.1/pNFS: fix LAYOUTCOMMIT retry loop on OLD_STATEID
Date: Wed, 22 Apr 2026 07:06:04 +0000 [thread overview]
Message-ID: <tencent_C3E914CD749F887888A516116FD2B970AD06@qq.com> (raw)
From: Lei Yin <yinlei2@lenovo.com>
Handle -NFS4ERR_OLD_STATEID in nfs4_layoutcommit_done().
Without refreshing data->args.stateid, LAYOUTCOMMIT can keep retrying
with the same stale stateid after OLD_STATEID, resulting in an
unbounded retry loop.
Refresh the layout stateid with nfs4_layout_refresh_old_stateid()
and restart the RPC only after a successful refresh.
This also keeps the OLD_STATEID recovery path consistent with other
pNFS layout operations.
Signed-off-by: Lei Yin <yinlei2@lenovo.com>
---
fs/nfs/nfs4proc.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d839a97df822..57a12efef0aa 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -9970,6 +9970,21 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata)
case -NFS4ERR_GRACE: /* loca_recalim always false */
task->tk_status = 0;
break;
+ case -NFS4ERR_OLD_STATEID: {
+ struct pnfs_layout_range range = {
+ .iomode = IOMODE_ANY,
+ .offset = 0,
+ .length = NFS4_MAX_UINT64,
+ };
+
+ if (nfs4_layout_refresh_old_stateid(&data->args.stateid,
+ &range,
+ data->args.inode)) {
+ rpc_restart_call_prepare(task);
+ return;
+ }
+ fallthrough;
+ }
case 0:
break;
default:
--
2.43.0
reply other threads:[~2026-04-22 7:06 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=tencent_C3E914CD749F887888A516116FD2B970AD06@qq.com \
--to=cybeyond@foxmail.com \
--cc=anna@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
--cc=yinlei2@lenovo.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).