On Tue, May 17, 2022 at 01:28:16PM +0200, Jan Kara wrote: > On Mon 16-05-22 09:47:10, Stefan Roesch wrote: > > This introduces an optimization for the update time flag and async > > buffered writes. While an update of the file modification time is > > pending and is handled by the workers, concurrent writes do not need > > to wait for this time update to complete. > > > > Signed-off-by: Stefan Roesch <shr@xxxxxx> > > --- > > fs/inode.c | 1 + > > include/linux/fs.h | 3 +++ > > 2 files changed, 4 insertions(+) > > > > diff --git a/fs/inode.c b/fs/inode.c > > index 1d0b02763e98..fd18b2c1b7c4 100644 > > --- a/fs/inode.c > > +++ b/fs/inode.c > > @@ -2091,6 +2091,7 @@ static int do_file_update_time(struct inode *inode, struct file *file, > > return 0; > > > > ret = inode_update_time(inode, now, sync_mode); > > + inode->i_flags &= ~S_PENDING_TIME; > > So what protects this update of inode->i_flags? Usually we use > inode->i_rwsem for that but not all file_update_time() callers hold it... I think the confusion might come about because file_modified() mentions that the caller is expected to hold file's inode_lock()... Another reason why we should probably add more kernel doc with a "Context:" line explaining what locks are expected to be held to these helpers.