From: Jeff Layton <jlayton@kernel.org>
To: Steve Dickson <steved@redhat.com>, Chuck Lever <cel@kernel.org>,
NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Mike Snitzer <snitzer@kernel.org>
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH nfs-utils 3/4] exportfs: Display and document riomode= and wiomode=
Date: Tue, 27 Oct 2026 12:50:25 -0400 [thread overview]
Message-ID: <20261027-master-v1-3-6f1f7a35a83b@kernel.org> (raw)
In-Reply-To: <20261027-master-v1-0-6f1f7a35a83b@kernel.org>
Show explicitly-set I/O modes in "exportfs -v" output and document the
new options in exports(5). Warn when exporting if the running kernel,
or no-netlink, means they will be ignored.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
support/include/nfslib.h | 1 +
utils/exportfs/exportfs.c | 34 ++++++++++++++++++++++++++++++++++
utils/exportfs/exports.man | 22 ++++++++++++++++++++++
3 files changed, 57 insertions(+)
diff --git a/support/include/nfslib.h b/support/include/nfslib.h
index f2be65b55f8c..8b515eb1fd5e 100644
--- a/support/include/nfslib.h
+++ b/support/include/nfslib.h
@@ -79,6 +79,7 @@ struct xprtsec_entry {
* Per-export I/O modes for riomode=/wiomode=. Values must match the
* kernel's NFSD_IO_* enum (fs/nfsd/nfsd.h). NFSD_IO_UNSET means no
* option was given; the export follows the server's global setting.
+ * It matches the kernel's NFSD_IO_DEFAULT value.
*/
#define NFSD_IO_BUFFERED 0
#define NFSD_IO_DONTCACHE 1
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index ecf66fd07fd1..6061b2f03d7f 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -614,6 +614,32 @@ try_proc:
return 1;
}
+/*
+ * mountd passes riomode= and wiomode= to the kernel only over netlink, and
+ * only to a kernel that takes them. @test_result is from can_test().
+ */
+static void
+validate_iomode(nfs_export *exp, const char *path, int test_result)
+{
+ static int supported = -1;
+
+ if (exp->m_export.e_riomode == NFSD_IO_UNSET &&
+ exp->m_export.e_wiomode == NFSD_IO_UNSET)
+ return;
+
+ if (supported < 0)
+ supported = test_result == 2 ?
+ nfsd_export_iomode_supported() : 0;
+ /* nfsd is not loaded, so there is no telling yet */
+ if (supported < 0)
+ return;
+
+ if (!supported)
+ xlog(L_WARNING, "%s: ignoring riomode= and wiomode=: %s", path,
+ no_netlink ? "no-netlink is set" :
+ "not supported by the running kernel");
+}
+
static void
validate_export(nfs_export *exp)
{
@@ -642,6 +668,8 @@ validate_export(nfs_export *exp)
if (!test_result)
return;
+ validate_iomode(exp, path, test_result);
+
/*
* When netlink is available, skip the export_test() probe.
* mountd/exportd will validate exports at cache-fill time.
@@ -838,6 +866,12 @@ dump(int verbose, int export_format)
c = dumpopt(c, "no_acl");
if (ep->e_flags & NFSEXP_PNFS)
c = dumpopt(c, "pnfs");
+ if (ep->e_riomode != NFSD_IO_UNSET)
+ c = dumpopt(c, "riomode=%s",
+ iomode_name(ep->e_riomode));
+ if (ep->e_wiomode != NFSD_IO_UNSET)
+ c = dumpopt(c, "wiomode=%s",
+ iomode_name(ep->e_wiomode));
if (ep->e_flags & NFSEXP_FSID)
c = dumpopt(c, "fsid=%d", ep->e_fsid);
if (ep->e_uuid)
diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man
index 7f0278fb8d33..2dfb12c6a4db 100644
--- a/utils/exportfs/exports.man
+++ b/utils/exportfs/exports.man
@@ -477,6 +477,28 @@ devices. The default can be explicitly requested with the
.I no_pnfs
option.
+.TP
+.IR riomode= buffered|dontcache|direct
+This option selects the I/O mode the server uses for NFS READ requests
+to this export:
+.I buffered
+uses the page cache,
+.I dontcache
+uses the page cache but drops the data behind on completion, and
+.I direct
+uses direct I/O.
+If the option is not specified, the export follows the server's global
+setting, which defaults to
+.IR buffered .
+If the kernel does not support per-export I/O modes, the option is
+ignored and a warning is logged.
+
+.TP
+.IR wiomode= buffered|dontcache|direct
+This option selects the I/O mode the server uses for NFS WRITE requests
+to this export, with the same values and default as
+.IR riomode= .
+
.TP
.IR security_label
With this option set, clients using NFSv4.2 or higher will be able to
--
2.56.0
next prev parent reply other threads:[~2026-10-27 16:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:50 [PATCH nfs-utils 0/4] exports: add support for new riomode= and wiomode= export options Jeff Layton
2026-10-27 16:50 ` [PATCH nfs-utils 1/4] exportfs/mountd/exportd: track the svc_export policy highest attribute Jeff Layton
2026-10-27 16:50 ` [PATCH nfs-utils 2/4] exports: Add riomode= and wiomode= export options Jeff Layton
2026-10-27 16:50 ` Jeff Layton [this message]
2026-10-27 16:50 ` [PATCH nfs-utils 4/4] nfsd-iomode-advisor: recommend riomode= and wiomode= for an export Jeff Layton
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=20261027-master-v1-3-6f1f7a35a83b@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=cel@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=snitzer@kernel.org \
--cc=steved@redhat.com \
--cc=tom@talpey.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.