Skip to content

Commit 7d9ebf3

Browse files
Frank Hsiao 蕭法宣tyhicks
authored andcommitted
ecryptfs: Set s_time_gran to get correct time granularity
Set the eCryptfs superblock time granularity, using the lower filesystem's s_time_gran value, to prevent unnecessary inode timestamp truncation to the granularity of a full second. The use of utimensat(2) to set a timestamp with nanosecond precision would trigger this bug. That occurred when using the following utilities to update timestamps of a file: * cp -p: copy a file and preserve its atime and mtime * touch -r: touch a file and use a reference file's timestamps Closes: https://bugs.launchpad.net/ecryptfs/+bug/1890486 Signed-off-by: Frank Hsiao 蕭法宣 <frankhsiao@qnap.com> [tyhicks: Partially rewrite the commit message] Signed-off-by: Tyler Hicks <code@tyhicks.com>
1 parent c369299 commit 7d9ebf3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/ecryptfs/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ static int ecryptfs_get_tree(struct fs_context *fc)
531531
s->s_blocksize = path.dentry->d_sb->s_blocksize;
532532
s->s_magic = ECRYPTFS_SUPER_MAGIC;
533533
s->s_stack_depth = path.dentry->d_sb->s_stack_depth + 1;
534+
s->s_time_gran = path.dentry->d_sb->s_time_gran;
534535

535536
rc = -EINVAL;
536537
if (s->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) {

0 commit comments

Comments
 (0)