From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH v3 1/2] nfsd: add a runtime switch for disabling delegated timestamps
Date: Mon, 26 Jan 2026 07:10:13 -0500 [thread overview]
Message-ID: <20260126-delegts-v3-1-079f29927b83@kernel.org> (raw)
In-Reply-To: <20260126-delegts-v3-0-079f29927b83@kernel.org>
The delegated timestamp code seems to be working well enough now that we
want to make it always be built in. In the event that there are problems
though, we still want to be able to disable them for debugging purposes.
Add a switch to debugfs to enable them at runtime.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/debugfs.c | 4 ++++
fs/nfsd/nfs4state.c | 8 ++++++++
fs/nfsd/nfsd.h | 1 +
3 files changed, 13 insertions(+)
diff --git a/fs/nfsd/debugfs.c b/fs/nfsd/debugfs.c
index 7f44689e0a53edbfd6ade9dda6af4052976a65d3..386fd1c54f5277fd9b9544caa5220e234915264d 100644
--- a/fs/nfsd/debugfs.c
+++ b/fs/nfsd/debugfs.c
@@ -140,4 +140,8 @@ void nfsd_debugfs_init(void)
debugfs_create_file("io_cache_write", 0644, nfsd_top_dir, NULL,
&nfsd_io_cache_write_fops);
+#ifdef CONFIG_NFSD_V4
+ debugfs_create_bool("delegated_timestamps", 0644, nfsd_top_dir,
+ &nfsd_delegts_enabled);
+#endif
}
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 583c13b5aaf3cd12a87c7aae62fe6a8223368f55..2251ff43aac8ef8a3d01d7094d40f9b2604763d6 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -76,6 +76,8 @@ static const stateid_t close_stateid = {
static u64 current_sessionid = 1;
+bool nfsd_delegts_enabled __read_mostly = true;
+
#define ZERO_STATEID(stateid) (!memcmp((stateid), &zero_stateid, sizeof(stateid_t)))
#define ONE_STATEID(stateid) (!memcmp((stateid), &one_stateid, sizeof(stateid_t)))
#define CURRENT_STATEID(stateid) (!memcmp((stateid), ¤tstateid, sizeof(stateid_t)))
@@ -6046,8 +6048,14 @@ nfsd4_verify_setuid_write(struct nfsd4_open *open, struct nfsd_file *nf)
}
#ifdef CONFIG_NFSD_V4_DELEG_TIMESTAMPS
+/*
+ * Timestamp delegation was introduced in RFC7862. Runtime switch for disabling
+ * this feature is /sys/kernel/debug/nfsd/delegated_timestamps.
+ */
static bool nfsd4_want_deleg_timestamps(const struct nfsd4_open *open)
{
+ if (!nfsd_delegts_enabled)
+ return false;
return open->op_deleg_want & OPEN4_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS;
}
#else /* CONFIG_NFSD_V4_DELEG_TIMESTAMPS */
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index a2e35a4fa105380c2d99cb0865003e0f7f4a8e8d..7c009f07c90b50d7074695d4665a2eca85140eda 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -160,6 +160,7 @@ static inline void nfsd_debugfs_exit(void) {}
#endif
extern bool nfsd_disable_splice_read __read_mostly;
+extern bool nfsd_delegts_enabled __read_mostly;
enum {
/* Any new NFSD_IO enum value must be added at the end */
--
2.52.0
next prev parent reply other threads:[~2026-01-26 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 12:10 [PATCH v3 0/2] nfsd: move delegated timestamps to being runtime disabled instead of compile time Jeff Layton
2026-01-26 12:10 ` Jeff Layton [this message]
2026-01-26 12:10 ` [PATCH v3 2/2] nfsd: remove NFSD_V4_DELEG_TIMESTAMPS Kconfig option Jeff Layton
2026-01-26 18:27 ` [PATCH v3 0/2] nfsd: move delegated timestamps to being runtime disabled instead of compile time Chuck Lever
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=20260126-delegts-v3-1-079f29927b83@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.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