[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxi=KhEQT6nvKga7T8wJ5M8E8owO30KeE8C_E4hmmoUtyA@mail.gmail.com>
Date: Thu, 22 Jun 2023 09:44:39 +0300
From: Amir Goldstein <amir73il@...il.com>
To: Jeff Layton <jlayton@...nel.org>
Cc: Christian Brauner <brauner@...nel.org>,
Miklos Szeredi <miklos@...redi.hu>,
Al Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>,
linux-unionfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 54/79] overlayfs: switch to new ctime accessors
On Wed, Jun 21, 2023 at 5:54 PM Jeff Layton <jlayton@...nel.org> wrote:
>
> In later patches, we're going to change how the ctime.tv_nsec field is
> utilized. Switch to using accessor functions instead of raw accesses of
> inode->i_ctime.
>
> Signed-off-by: Jeff Layton <jlayton@...nel.org>
> ---
Looks ok.
Reviewed-by: Amir Goldstein <amir73il@...il.com>
Thanks,
Amir.
> fs/overlayfs/file.c | 7 +++++--
> fs/overlayfs/util.c | 2 +-
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
> index 21245b00722a..b47013d4bd4e 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -239,6 +239,7 @@ static loff_t ovl_llseek(struct file *file, loff_t offset, int whence)
> static void ovl_file_accessed(struct file *file)
> {
> struct inode *inode, *upperinode;
> + struct timespec64 ct, uct;
>
> if (file->f_flags & O_NOATIME)
> return;
> @@ -249,10 +250,12 @@ static void ovl_file_accessed(struct file *file)
> if (!upperinode)
> return;
>
> + ct = inode_ctime_peek(inode);
> + uct = inode_ctime_peek(upperinode);
> if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
> - !timespec64_equal(&inode->i_ctime, &upperinode->i_ctime))) {
> + !timespec64_equal(&ct, &uct))) {
> inode->i_mtime = upperinode->i_mtime;
> - inode->i_ctime = upperinode->i_ctime;
> + inode_ctime_set(inode, uct);
> }
>
> touch_atime(&file->f_path);
> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
> index 7ef9e13c404a..e3746f9a202f 100644
> --- a/fs/overlayfs/util.c
> +++ b/fs/overlayfs/util.c
> @@ -1202,6 +1202,6 @@ void ovl_copyattr(struct inode *inode)
> inode->i_mode = realinode->i_mode;
> inode->i_atime = realinode->i_atime;
> inode->i_mtime = realinode->i_mtime;
> - inode->i_ctime = realinode->i_ctime;
> + inode_ctime_set(inode, inode_ctime_peek(realinode));
> i_size_write(inode, i_size_read(realinode));
> }
> --
> 2.41.0
>
Powered by blists - more mailing lists