From: Christoph Hellwig <hch@infradead.org>
To: Chuck Lever <cel@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Mike Snitzer <snitzer@kernel.org>, NeilBrown <neil@brown.name>,
Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH v4 2/3] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE
Date: Wed, 22 Oct 2025 22:46:08 -0700 [thread overview]
Message-ID: <aPnBIGeFjrZLbxBG@infradead.org> (raw)
In-Reply-To: <ee1eba86-a5ce-4cb8-9124-78a53eae6fc8@kernel.org>
On Wed, Oct 22, 2025 at 10:37:35AM -0400, Chuck Lever wrote:
> What I'm hearing is that nfsd_vfs_write() should never see -ENOTBLK, so
> this check is essentially dead code.
That's how iomap_dio_rw is designed to work. If it ever leaks out,
that is a file system bug because no other caller of ->write_iter
handles -ENOTBLK.
> >>>> These changes served as the original starting point for the NFS
> >>>> client's misaligned O_DIRECT support that landed with
> >>>> commit c817248fc831 ("nfs/localio: add proper O_DIRECT support for
> >>>> READ and WRITE"). But NFSD's support is simpler because it currently
> >>>> doesn't use AIO completion.
> >>>
> >>> I don't understand this paragraph. What does starting point mean
> >>> here? How does it matter for the patch description?
> >>
> >> This patch's NFSD changes were starting point for NFS commit
> >> c817248fc831
> >
> > But that commit is already in? This sentence really confuses me.
>
> I'm not convinced this paragraph in the patch description is needed.
> Can it be removed?
I guess Mike wants to say the two are based on the concept. But given
that c817248fc831 is already in I'd expect to word it as "these changes
are similar to the direct I/O writes implemented for the NFS client
local I/O feature in commit c817248fc831 <insert subject line here>.
But I'm not really sure there is much of a point in that.
> (Perhaps to get us started, Christoph, do you know of specific code that
> shows how this code could be reorganized?)
>
This is what I had in mind:
https://lore.kernel.org/linux-block/20251014150456.2219261-1-kbusch@meta.com/T/#m3588b5824b7fa76f001d57e54664889b73471422
It records the alignment while building (or iterating for another
reason), and then just checking a mask later. For nfsd this would be a
bit different as you'd also record the boundaries of the aligned
segments, but the idea is the same.
> If NFSD responds with NFS_FILE_SYNC here, then timestamps need to be
> persisted as well as data. As discussed in other threads, currently
> nfsd_vfs_write() seems to miss that mark.
>
> So either: return NFS_DATA_SYNC (which means we've persisted only the
> data) or make this path persist the timestamps too.
>
> I haven't seen any existing code that convinces me that setting both
> IOCB_SYNC and IOCB_DSYNC is necessary.
iocb_flags is the canonical place. IOCB_DSYNC is the main path driving
the syncing, and IOCB_SYNC drivers the additional syncing of the
timestamps.
This is all a bit odd, because Linux historically only supposed the
O_SYNC flag, but used it for O_DSYNC semantics. When I fixed that,
I had to do a few non-standard things so that we could keep existing
binaries work as expected despite renaming the flags. See commit
6b2f3d1f769b ("vfs: Implement proper O_SYNC semantics") for details.
next prev parent reply other threads:[~2025-10-23 5:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 0:54 [PATCH v4 0/3] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Chuck Lever
2025-10-18 0:54 ` [PATCH v4 1/3] NFSD: Enable return of an updated stable_how to NFS clients Chuck Lever
2025-10-20 7:02 ` Christoph Hellwig
2025-10-18 0:54 ` [PATCH v4 2/3] NFSD: Implement NFSD_IO_DIRECT for NFS WRITE Chuck Lever
2025-10-20 7:19 ` Christoph Hellwig
2025-10-20 13:56 ` Chuck Lever
2025-10-20 14:05 ` Christoph Hellwig
2025-10-20 16:27 ` Mike Snitzer
2025-10-22 5:14 ` Christoph Hellwig
2025-10-22 14:37 ` Chuck Lever
2025-10-23 5:46 ` Christoph Hellwig [this message]
2025-10-21 11:24 ` Jeff Layton
2025-10-22 5:16 ` Christoph Hellwig
2025-10-22 10:15 ` Jeff Layton
2025-10-22 11:17 ` Christoph Hellwig
2025-10-22 11:30 ` Jeff Layton
2025-10-22 13:31 ` Chuck Lever
2025-10-23 5:27 ` Christoph Hellwig
2025-10-22 17:59 ` Chuck Lever
2025-10-23 5:52 ` Christoph Hellwig
2025-10-18 0:54 ` [PATCH v4 3/3] svcrdma: Mark Read chunks 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=aPnBIGeFjrZLbxBG@infradead.org \
--to=hch@infradead.org \
--cc=cel@kernel.org \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=snitzer@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).