From: sashiko-bot@kernel.org
To: "Mike Snitzer" <snitzer@kernel.org>,
"Matthew Wilcox" <willy@infradead.org>, "Jan Kara" <jack@suse.cz>,
linux-mm@kvack.org, "Christian Brauner" <brauner@kernel.org>
Subject: Re: [PATCH v13 7/7] NFSD: do not kick DONTCACHE writeback for a WRITE that NFSD syncs
Date: Sat, 05 Dec 2026 07:39:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-251241@kernel.org> (raw)
In-Reply-To: <6d449a5fa8ed7d1ed8bb997383ff8fae040e448b.1796367526.git.snitzer@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] nfsd: nfsd-io-modes.rst overbroadly excludes non-iomap fs from
sync no-kick
- [Low] nfsd: nfsd_direct_write() sets IOCB_DONTCACHE_NOKICK without
IOCB_DONTCACHE
--
commit 03778400aa9b1b1cb98cb34dfd15e5c34e3cade8
Author: Mike Snitzer <snitzer@kernel.org>
NFSD: do not kick DONTCACHE writeback for a WRITE that NFSD syncs
This commit sets IOCB_DONTCACHE_NOKICK on segments of a split synchronous
WRITE in nfsd_direct_write() and documents how partial DONTCACHE edge
pages are retained and written back.
> diff --git a/Documentation/filesystems/nfs/nfsd-io-modes.rst b/Documentation/filesystems/nfs/nfsd-io-modes.rst
> index 28235eceb0c7d..b59fa6e3fd44a 100644
> --- a/Documentation/filesystems/nfs/nfsd-io-modes.rst
> +++ b/Documentation/filesystems/nfs/nfsd-io-modes.rst
> @@ -197,6 +197,22 @@ Misaligned WRITE:
> above. Set it to N for a workload that reads back or rewrites what
> it just wrote.
>
> + The page holding a start or end segment is shared with the other
> + WRITEs that cover the rest of the page, which may arrive before,
> + after or at the same time, from any client. So that the later WRITEs
> + to such a page do not have to read it back from disk, the page cache
> + keeps a page that a DONTCACHE write covers only partially until a
> + write completes it, and drops it once it is written back. A page
> + that no other WRITE completes stays cached until it is reclaimed.
> + The first and last pages of a WRITE that is not split are handled
> + the same way. A split FILE_SYNC or DATA_SYNC WRITE does not kick
> + DONTCACHE writeback for its buffered segments: its own sync writes
> + them back.
> +
> + None of this applies when the start and end segments are normal
> + buffered IO, or for a filesystem that does not use iomap for
> + buffered writes.
[Severity: Low]
Does "None of this applies ... for a filesystem that does not use iomap
for buffered writes" overstate the scope for the last sentence of the
preceding paragraph?
generic_write_sync() honors IOCB_DONTCACHE_NOKICK regardless of iomap, so
non-iomap FOP_DONTCACHE filesystems such as ext4 (on its
generic_perform_write() path) or NFS re-exports still skip the DONTCACHE
writeback kick on split FILE_SYNC and DATA_SYNC WRITEs.
Only the partial edge-page retention is iomap-specific.
[ ... ]
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index a990c76dce0fc..67f4d3c7faaff 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
[ ... ]
> @@ -1565,6 +1566,8 @@ nfsd_direct_write(struct svc_rqst *rqstp, struct svc_fh *fhp,
> *cnt = 0;
> for (i = 0; i < nsegs; i++) {
> kiocb->ki_flags = segments[i].flags & ~sync_flags;
> + if (sync_flags)
> + kiocb->ki_flags |= IOCB_DONTCACHE_NOKICK;
[Severity: Low]
Should IOCB_DONTCACHE_NOKICK only be set when kiocb->ki_flags also has
IOCB_DONTCACHE?
In nfsd_write_dio_iters_init(), IOCB_DONTCACHE is unset when the exported
filesystem lacks FOP_DONTCACHE (such as f2fs) or on buffered edge segments
when nfsd_direct_misaligned_dontcache is disabled.
Setting IOCB_DONTCACHE_NOKICK alone violates its documented pairing in
include/linux/fs.h and causes tracepoints using TRACE_IOCB_STRINGS (such
as iomap_dio_rw_begin) to log DONTCACHE_NOKICK on non-DONTCACHE writes.
Checking sync_flags && (kiocb->ki_flags & IOCB_DONTCACHE) avoids this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796367526.git.snitzer@kernel.org?part=7
prev parent reply other threads:[~2026-12-05 7:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 7:38 [PATCH v13 0/7] mm, iomap, NFSD: stop DONTCACHE writes reading back shared pages Mike Snitzer
2026-12-04 7:38 ` [PATCH v13 1/7] mm: move clearing the dropbehind flag of a found folio into a helper Mike Snitzer
2026-12-04 7:38 ` [PATCH v13 2/7] mm: take a folio off WB_DONTCACHE_DIRTY only if it was counted there Mike Snitzer
2026-12-05 7:39 ` sashiko-bot
2026-12-04 7:38 ` [PATCH v13 3/7] mm: expose WB_DONTCACHE_DIRTY in bdi debugfs stats Mike Snitzer
2026-12-05 7:39 ` sashiko-bot
2026-12-04 7:38 ` [PATCH v13 4/7] mm: add folio_mark_dropbehind() to mark a folio dropbehind and account it Mike Snitzer
2026-12-05 7:39 ` sashiko-bot
2026-12-04 7:38 ` [PATCH v13 5/7] iomap: keep a DONTCACHE edge folio until a write completes it Mike Snitzer
2026-12-05 7:39 ` sashiko-bot
2026-12-04 7:38 ` [PATCH v13 6/7] fs: let a DONTCACHE writer that syncs the range itself skip the kick Mike Snitzer
2026-12-04 7:38 ` [PATCH v13 7/7] NFSD: do not kick DONTCACHE writeback for a WRITE that NFSD syncs Mike Snitzer
2026-12-05 7:39 ` sashiko-bot [this message]
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=sashiko-outbox-251241@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-mm@kvack.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=snitzer@kernel.org \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox