diff options
author | Jeff Layton <jlayton@kernel.org> | 2024-08-12 12:30:52 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-08-15 20:35:44 +0200 |
commit | 3bc2ac2f8f0b78a13140fc72022771efe0c9b778 (patch) | |
tree | 9e76fc7c339646aadcf53501d8e5fbc3eddc136a /fs | |
parent | c0247d289e73e18f6ddb0895de30c09770fbed95 (diff) | |
download | linux-stable-3bc2ac2f8f0b78a13140fc72022771efe0c9b778.tar.gz linux-stable-3bc2ac2f8f0b78a13140fc72022771efe0c9b778.tar.bz2 linux-stable-3bc2ac2f8f0b78a13140fc72022771efe0c9b778.zip |
btrfs: update target inode's ctime on unlink
Unlink changes the link count on the target inode. POSIX mandates that
the ctime must also change when this occurs.
According to https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html:
"Upon successful completion, unlink() shall mark for update the last data
modification and last file status change timestamps of the parent
directory. Also, if the file's link count is not 0, the last file status
change timestamp of the file shall be marked for update."
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: David Sterba <dsterba@suse.com>
[ add link to the opengroup docs ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 333b0e8587a2..b1b6564ab68f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4195,6 +4195,7 @@ err: btrfs_i_size_write(dir, dir->vfs_inode.i_size - name->len * 2); inode_inc_iversion(&inode->vfs_inode); + inode_set_ctime_current(&inode->vfs_inode); inode_inc_iversion(&dir->vfs_inode); inode_set_mtime_to_ts(&dir->vfs_inode, inode_set_ctime_current(&dir->vfs_inode)); ret = btrfs_update_inode(trans, dir); |