@@ -222,6 +222,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 ctime, uctime;
if (file->f_flags & O_NOATIME)
return;
@@ -232,10 +233,12 @@ static void ovl_file_accessed(struct file *file)
if (!upperinode)
return;
+ ctime = ctime_peek(inode);
+ uctime = ctime_peek(upperinode);
if ((!timespec64_equal(&inode->i_mtime, &upperinode->i_mtime) ||
- !timespec64_equal(&inode->i_ctime, &upperinode->i_ctime))) {
+ !timespec64_equal(&ctime, &uctime))) {
inode->i_mtime = upperinode->i_mtime;
- inode->i_ctime = upperinode->i_ctime;
+ inode->i_ctime = uctime;
}
touch_atime(&file->f_path);
@@ -1117,6 +1117,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->i_ctime = ctime_peek(realinode);
i_size_write(inode, i_size_read(realinode));
}
Ensure that we strip off the I_CTIME_QUERIED bit when copying up. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- fs/overlayfs/file.c | 7 +++++-- fs/overlayfs/util.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)