Re: [PATCH 1/6] NFSD: add the ability to enable use of RWF_DONTCACHE for all IO

Mike Snitzer
2025-06-11T10:44:12Z

On Tue, Jun 10, 2025 at 11:57:33PM -0700, Christoph Hellwig wrote:
> On Tue, Jun 10, 2025 at 04:57:32PM -0400, Mike Snitzer wrote:
> > Add 'enable-dontcache' to NFSD's debugfs interface so that: Any data
> > read or written by NFSD will either not be cached (thanks to O_DIRECT)
> > or will be removed from the page cache upon completion (DONTCACHE).
> >
> > enable-dontcache is 0 by default. It may be enabled with:
> > echo 1 > /sys/kernel/debug/nfsd/enable-dontcache
>
> Having this as a global debug-only interface feels a bit odd.
>

I generally agree, I originally proposed nfsd.nfsd_dontcache=Y
modparam:
https://lore.kernel.org/linux-nfs/20250220171205.12092-1-snitzer@kernel.org/

(and even implemented formal NFSD per-export "dontcache" control,
which Trond and I both think is probably needed).

But (ab)using debugfs is the approach Chuck and Jeff would like to
take for experimental NFSD changes so that we can kick the tires
without having to support an interface until the end of time. See
commit 9fe5ea760e64 ("NFSD: Add /sys/kernel/debug/nfsd") for more on
the general thinking. First consumer was commit c9dcd1de7977 ("NFSD:
Add experimental setting to disable the use of splice read").

I'm fine with using debugfs, means to an end with no strings attached.

Once we have confidence in what is needed we can pivot back to
a modparam or per-export controls or whatever.

Mike