Re: [PATCH 2/6] NFSD: Apply per-export I/O modes to READ and WRITE

From: Jeff Layton

Date: Tue Oct 27 2026 - 14:00:17 EST


On Tue, 2026-10-27 at 13:54 -0400, Chuck Lever wrote:
> On 10/27/26 12:45 PM, Jeff Layton wrote:
> > Resolve each export's effective I/O mode (explicit setting, else the
> > global io_cache_read/write knob) in nfsd_iter_read and nfsd_vfs_write,
> > and skip splice for reads on exports whose effective read mode is not
> > buffered. Update the debugfs knob comments to match.
>
> [ ... ]
>
> > - if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp))
> > + if (file->f_op->splice_read && nfsd_read_splice_ok(rqstp) &&
> > + nfsd_read_iomode(fhp->fh_export) == NFSD_IO_BUFFERED)
> > err = nfsd_splice_read(rqstp, fhp, file, offset, count, eof);
>
> nfsd_io_cache_read_set() still sets nfsd_disable_splice_read whenever
> the global knob is switched to dontcache or direct, so
> nfsd_read_splice_ok() returns false before this per-export test is
> reached. An export pinned to riomode=buffered on such a server never
> gets splice; it falls through to nfsd_iter_read() and does vector
> buffered reads. The same applies to the splice_ok decisions in
> nfsd4_encode_read() and nfsd4_encode_read_plus_data().
>
> Patch 3/6 says an explicit per-export setting pins that export's
> IO mode "regardless of the global knob", and that isn't quite true
> now for the buffered case.
>
> I need to think carefully about the interaction between the "disable
> splice" setting, which is global, and the per-export I/O setting.
>

Maybe disable_splice should be an export option of its own? It seems
like that should be doable.

> Separately, on the names of the export options: "riomode" and
> "wiomode" are hard to read, and "mode" might suggest "permission bits"
> to an administrator. How about read_io= and write_io= instead? They
> follow the underscore style of the other multi-word export options
> (no_subtree_check, root_squash, security_label) and read naturally:
>
> /srv/data client(rw,read_io=direct,write_io=dontcache)
>
> The values buffered, dontcache, and direct then carry the meaning
> without "cache" or "mode" in the name.
>
> The name appears in the exports syntax, the nfsd.export/content
> output, the netlink YAML spec, and the forthcoming nfs-utils series,
> so it's worth settling before v2 and before the nfs-utils side gets
> merged.
>

Ok, I'll look at renaming them. Thanks for the initial review!
--
Jeff Layton <jlayton@xxxxxxxxxx>