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

Chuck Lever
2025-07-04T19:49:51Z

On 7/4/25 3:46 PM, Mike Snitzer wrote:
> On Mon, Jun 30, 2025 at 10:50:42AM -0400, Chuck Lever wrote:
>> On 6/19/25 4:19 PM, Mike Snitzer wrote:
>>> On Tue, Jun 17, 2025 at 01:31:23PM -0400, Chuck Lever wrote:
>>>>
>>>> If we were to make all NFS READ operations use O_DIRECT, then of course
>>>> NFSD's splice read should be removed at that point.
>>>
>>> Yes, that makes sense. I still need to try Christoph's idea (hope to
>>> do so over next 24hrs):
>>> https://lore.kernel.org/linux-nfs/aEu3o9imaQQF9vyg@infradead.org/
>>>
>>> But for now, here is my latest NFSD O_DIRECT/DONTCACHE work, think of
>>> the top 6 commits as a preview of what'll be v2 of this series:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/snitzer/linux.git/log/?h=kernel-6.12.24/nfsd-testing
>>
>> I was waiting for a series repost, but in the meantime...
>>
>> The one thing that caught my eye was the relocation of fh_getattr().
>>
>> - If fh_getattr() is to be moved to fs/nfsd/vfs.c, then it should be
>> renamed nfsd_getattr() (or similar) to match the API naming
>> convention in that file.
>>
>> - If fh_getattr() is to keep its current name, then it should be
>> moved to where the other fh_yada() functions reside, in
>> fs/nfsd/nfsfh.c
>>
>> In a private tree, I constructed a patch to do the latter. I can
>> post that for comment.
>
> Hi,
>
> Sure, I can clean it up to take your patch into account. Please share
> your patch (either pointer to commit in a branch or via email).
>
> Tangent to explain why I've fallen off the face of the earth:
> I have just been focused on trying to get client-side misaligned
> O_DIRECT READ IO to be expanded to be DIO-aligned like I did with
> NFSD. Turns out it is quite involved (took a week of focused
> development to arrive at the fact that NFS client's nfs_page and
> pagelist code's use of memory as an array is entirely incompatiable.
> Discussed with Trond and the way forward would require having NFS
> client fill in xdr_buf's bvec and manage manually.. but that's a
> serious hack. Better long term goal is to convert xdr_buf over to
> using bio_vec like NFSD is using.
>
> So rather than do any of that _now_, I just today implemented an NFS
> LOCALIO fallback to issuing the misaligned DIO READ using remote call
> to NFSD (able to do so on a per-IO basis if READ is misaligned).
> Seems to work really well, but does force LOCALIO to go remote (over
> loopback network) just so it can leverage our new NFSD mode to use
> O_DIRECT and expand misaligned writes, which is enabled with:
> echo 2 > /sys/kernel/debug/nfsd/io_cache_read
>
> All said, I'll get everything cleaned up and send out v2 of this
> patchset on Monday. (If you share your patch I can rebase ontop of it
> and hopefully still get v2 out on Monday)

https://lore.kernel.org/linux-nfs/20250702233345.1128154-1-cel@kernel.org/T/#t

But no-one has yet offered an opinion about whether to rename fh_getattr
or move it to fs/nfsd/nfsfh.c. Things might change.

--
Chuck Lever