Skip to content

Commit

Permalink
exfat: ensure that ctime is updated whenever the mtime is
Browse files Browse the repository at this point in the history
When removing entries from a directory, the ctime must also be updated
alongside the mtime.

Signed-off-by: Jeff Layton <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
jtlayton authored and namjaejeon committed Nov 2, 2023
1 parent 98f3631 commit 6eb9af0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,9 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
dir->i_version++;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
dir->i_mtime = dir->i_atime = current_time(dir);
dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir);
#else
dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC;
dir->i_mtime = dir->i_atime = dir->i_ctime = CURRENT_TIME_SEC;
#endif
exfat_truncate_atime(&dir->i_atime);
if (IS_DIRSYNC(dir))
Expand All @@ -915,9 +915,9 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)

clear_nlink(inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
inode->i_mtime = inode->i_atime = current_time(inode);
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
#else
inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
inode->i_mtime = inode->i_atime = dir->i_ctime = CURRENT_TIME_SEC;
#endif
exfat_truncate_atime(&inode->i_atime);
exfat_unhash_inode(inode);
Expand Down Expand Up @@ -1111,9 +1111,9 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
dir->i_version++;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
dir->i_mtime = dir->i_atime = current_time(dir);
dir->i_mtime = dir->i_atime = dir->i_ctime = current_time(dir);
#else
dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC;
dir->i_mtime = dir->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
#endif
exfat_truncate_atime(&dir->i_atime);
if (IS_DIRSYNC(dir))
Expand All @@ -1124,9 +1124,9 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)

clear_nlink(inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
inode->i_mtime = inode->i_atime = current_time(inode);
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
#else
inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
#endif
exfat_truncate_atime(&inode->i_atime);
exfat_unhash_inode(inode);
Expand Down

0 comments on commit 6eb9af0

Please sign in to comment.