overlayfs: convert to new timestamp accessors

Convert to using the new inode timestamp accessor functions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20231004185347.80880-58-jlayton@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Jeff Layton 2023-10-04 14:52:45 -04:00 committed by Christian Brauner
parent 702ed7f1c9
commit 4ddbd0f1fe
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
3 changed files with 10 additions and 6 deletions

View File

@ -239,6 +239,7 @@ static void ovl_file_accessed(struct file *file)
{
struct inode *inode, *upperinode;
struct timespec64 ctime, uctime;
struct timespec64 mtime, umtime;
if (file->f_flags & O_NOATIME)
return;
@ -251,9 +252,11 @@ static void ovl_file_accessed(struct file *file)
ctime = inode_get_ctime(inode);
uctime = inode_get_ctime(upperinode);
if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
!timespec64_equal(&ctime, &uctime))) {
inode->i_mtime = upperinode->i_mtime;
mtime = inode_get_mtime(inode);
umtime = inode_get_mtime(upperinode);
if ((!timespec64_equal(&mtime, &umtime)) ||
!timespec64_equal(&ctime, &uctime)) {
inode_set_mtime_to_ts(inode, inode_get_mtime(upperinode));
inode_set_ctime_to_ts(inode, uctime);
}

View File

@ -704,7 +704,8 @@ int ovl_update_time(struct inode *inode, int flags)
if (upperpath.dentry) {
touch_atime(&upperpath);
inode->i_atime = d_inode(upperpath.dentry)->i_atime;
inode_set_atime_to_ts(inode,
inode_get_atime(d_inode(upperpath.dentry)));
}
}
return 0;

View File

@ -1409,8 +1409,8 @@ void ovl_copyattr(struct inode *inode)
inode->i_uid = vfsuid_into_kuid(vfsuid);
inode->i_gid = vfsgid_into_kgid(vfsgid);
inode->i_mode = realinode->i_mode;
inode->i_atime = realinode->i_atime;
inode->i_mtime = realinode->i_mtime;
inode_set_atime_to_ts(inode, inode_get_atime(realinode));
inode_set_mtime_to_ts(inode, inode_get_mtime(realinode));
inode_set_ctime_to_ts(inode, inode_get_ctime(realinode));
i_size_write(inode, i_size_read(realinode));
}