lkml.org 
[lkml]   [2023]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 54/79] overlayfs: switch to new ctime accessors
On Wed, Jun 21, 2023 at 5:54 PM Jeff Layton <jlayton@kernel.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@kernel.org>
> ---

Looks ok.

Reviewed-by: Amir Goldstein <amir73il@gmail.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
>

\
 
 \ /
  Last update: 2023-06-22 08:45    [W:0.557 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site