From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Pavel Emelyanov <xemul@scylladb.com>,
linux-fsdevel@vger.kernel.org,
"Raphael S . Carvalho" <raphaelsc@scylladb.com>,
linux-api@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] fs: Propagate FMODE_NOCMTIME flag to user-facing O_NOCMTIME
Date: Mon, 6 Oct 2025 10:38:20 +1100 [thread overview]
Message-ID: <aOMBbKUlvv2uYLzD@dread.disaster.area> (raw)
In-Reply-To: <aOCiCkFUOBWV_1yY@infradead.org>
On Fri, Oct 03, 2025 at 09:26:50PM -0700, Christoph Hellwig wrote:
> On Fri, Oct 03, 2025 at 12:32:13PM +0300, Pavel Emelyanov wrote:
> > The FMODE_NOCMTIME flag tells that ctime and mtime stamps are not
> > updated on IO. The flag was introduced long ago by 4d4be482a4 ([XFS]
> > add a FMODE flag to make XFS invisible I/O less hacky. Back then it
> > was suggested that this flag is propagated to a O_NOCMTIME one.
>
> skipping c/mtime is dangerous. The XFS handle code allows it to
> support HSM where data is migrated out to tape, and requires
> CAP_SYS_ADMIN. Allowing it for any file owner would expand the scope
> for too much as now everyone could skip timestamp updates.
We have already provided a safe method for minimising the overhead
of c/mtime updates in the IO path - it's called lazytime. The
lazytime mount option provides eventual consistency for c/mtime
updates for IO operations instead of immediate consistency.
Timestamps are still updated to have the correct values, but the
latency/performance of the timestamp updates is greatly improved by
holding them purely in memory until some other trigger forces them
to be persisted to disk.
> > It can be used by workloads that want to write a file but don't care
> > much about the preciese timestamp on it and can update it later with
> > utimens() call.
>
> The workload might not care, the rest of the system does. ctime can't
> bet set to arbitrary values, so it is important for backups and as
> an audit trail.
Lazytime works for this use case; a call to utimens() will cause a
persistent update of the timestamps. As will any other inode
modification that has persistence requirements (e.g. block
allocation during IO or other syscalls that modify inode metadata).
> > There's another reason for having this patch. When performing AIO write,
> > the file_modified_flags() function checks whether or not to update inode
> > times. In case update is needed and iocb carries the RWF_NOWAIT flag,
> > the check return EINTR error that quickly propagates into cb completion
> > without doing any IO. This restriction effectively prevents doing AIO
> > writes with nowait flag, as file modifications really imply time update.
>
> Well, we'll need to look into that, including maybe non-blockin
> timestamp updates.
This came up recently on #xfs w.r.t. lazytime behaviour - we need to
pass the NOWAIT decision semnatics down to the filesystem to allow
lazytime to be truly non-blocking. At the moment the high level VFS
NOWAIT checks (via inode_needs_update_time()) have no visibility of
this filesystem specific functionality, so even if we can do the
lazy timestamp update without blocking we still give an -EAGAIN if
IOCB_NOWAIT is set.
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2025-10-05 23:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 9:32 [PATCH] fs: Propagate FMODE_NOCMTIME flag to user-facing O_NOCMTIME Pavel Emelyanov
2025-10-04 4:26 ` Christoph Hellwig
2025-10-04 16:08 ` Andy Lutomirski
2025-10-07 5:08 ` Christoph Hellwig
2025-10-08 15:22 ` Andy Lutomirski
2025-10-08 21:27 ` Dave Chinner
2025-10-08 21:51 ` Andy Lutomirski
2025-10-11 1:35 ` Dave Chinner
2025-10-11 4:04 ` Andy Lutomirski
2025-10-10 5:27 ` Christoph Hellwig
2025-10-10 17:35 ` Andy Lutomirski
2025-10-05 22:06 ` Dave Chinner
2025-10-07 5:10 ` Christoph Hellwig
2025-10-05 23:38 ` Dave Chinner [this message]
2025-10-06 2:16 ` Theodore Ts'o
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=aOMBbKUlvv2uYLzD@dread.disaster.area \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=raphaelsc@scylladb.com \
--cc=xemul@scylladb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.