Skip to content

Commit 3bc2ac2

Browse files
jtlaytonkdave
authored andcommitted
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>
1 parent c0247d2 commit 3bc2ac2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,6 +4195,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
41954195

41964196
btrfs_i_size_write(dir, dir->vfs_inode.i_size - name->len * 2);
41974197
inode_inc_iversion(&inode->vfs_inode);
4198+
inode_set_ctime_current(&inode->vfs_inode);
41984199
inode_inc_iversion(&dir->vfs_inode);
41994200
inode_set_mtime_to_ts(&dir->vfs_inode, inode_set_ctime_current(&dir->vfs_inode));
42004201
ret = btrfs_update_inode(trans, dir);

0 commit comments

Comments
 (0)