]> git.ipfire.org Git - thirdparty/linux.git/commit
fs: fix forced iversion increment on lazytime timestamp updates
authorPankaj Raghav <p.raghav@samsung.com>
Mon, 11 May 2026 11:19:18 +0000 (13:19 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 May 2026 13:32:12 +0000 (15:32 +0200)
commit834e98acb748025c04fed3cac9c8954454f4b520
treed24970dced05eb29599f39a0b3463ac5b8fe1717
parentc3880a7b10e487e033dc6f388bda118436566f7a
fs: fix forced iversion increment on lazytime timestamp updates

When updating timestamps with lazytime enabled, if only I_DIRTY_TIME is
set (pure lazytime update), inode_maybe_inc_iversion() should not be
forced to increment i_version. The force parameter should only be true
when actual data or metadata changes require an iversion bump.

The current code uses "!!dirty" which evaluates to true whenever dirty
has any bits set, including the I_DIRTY_TIME bit alone. This forces an
iversion increment on every lazytime timestamp update, which then sets
I_DIRTY_SYNC, triggering expensive log flushes on subsequent fdatasync
calls. Andres reported this issue when he noticed a perf regression[1].

Fix this by using "dirty != I_DIRTY_TIME" as the force parameter. This
passes false for pure lazytime updates (allowing the I_VERSION_QUERIED
optimization to work), while still forcing the increment when dirty
contains other flags indicating real changes that require iversion
updates.

[1] https://lore.kernel.org/linux-xfs/7ys6erh3nnyeerv2nybyfvp7dmaknuxrlxv74wx56ocdothkc6@ekfiadtkfn2r/

Fixes: 85c871a02b03 ("fs: add support for non-blocking timestamp updates")
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Link: https://patch.msgid.link/20260511111918.1793689-1-p.raghav@samsung.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/inode.c