Re: [PATCH 02/14] fs: lift the FMODE_NOCMTIME check into file_update_time_flags

Jan Kara <[email protected]>
Newsgroups dev.linux.lists.gfs2,org.infradead.lists.linux-mtd,org.kernel.vger.io-uring,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs,org.kernel.vger.linux-unionfs,org.kernel.vger.linux-xfs
Message-ID <5wv5u2sto54yelpzkxtdoekhfix7tsh5v7cyjrbnbvdvqmlssz@zpomezchur2d>
On Fri 14-11-25 07:26:05, Christoph Hellwig wrote:
> FMODE_NOCMTIME used to be just a hack for the legacy XFS handle-based
> "invisible I/O", but commit e5e9b24ab8fa ("nfsd: freeze c/mtime updates
> with outstanding WRITE_ATTRS delegation") started using it from
> generic callers.
> 
> I'm not sure other file systems are actually read for this in general,
						^^ ready

> so the above commit should get a closer look, but for it to make any
> sense, file_update_time needs to respect the flag.
> 
> Lift the check from file_modified_flags to file_update_time so that
> users of file_update_time inherit the behavior and so that all the
> checks are done in one place.
> 
> Fixes: e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation")
> Signed-off-by: Christoph Hellwig <[email protected]>

Reagrdless whether FMODE_NOCMTIME works properly for all filesystems this
looks like a sensible step so feel free to add:

Reviewed-by: Jan Kara <[email protected]>

								Honza

> ---
>  fs/inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/inode.c b/fs/inode.c
> index 4884ffa931e7..24dab63844db 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2320,6 +2320,8 @@ static int file_update_time_flags(struct file *file, unsigned int flags)
>  	/* First try to exhaust all avenues to not sync */
>  	if (IS_NOCMTIME(inode))
>  		return 0;
> +	if (unlikely(file->f_mode & FMODE_NOCMTIME))
> +		return 0;
>  
>  	now = current_time(inode);
>  
> @@ -2391,8 +2393,6 @@ static int file_modified_flags(struct file *file, int flags)
>  	ret = file_remove_privs_flags(file, flags);
>  	if (ret)
>  		return ret;
> -	if (unlikely(file->f_mode & FMODE_NOCMTIME))
> -		return 0;
>  	return file_update_time_flags(file, flags);
>  }
>  
> -- 
> 2.47.3
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.