Skip to content

Commit

Permalink
autofs: set ctime as well when mtime changes on a dir
Browse files Browse the repository at this point in the history
When adding entries to a directory, POSIX generally requires that the
ctime also be updated alongside the mtime.

Signed-off-by: Jeff Layton <[email protected]>
Acked-by: Ian Kent <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
jtlayton authored and brauner committed Jun 15, 2023
1 parent 33d8b5d commit 797a1d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/autofs/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static int autofs_dir_symlink(struct mnt_idmap *idmap,
p_ino = autofs_dentry_ino(dentry->d_parent);
p_ino->count++;

dir->i_mtime = current_time(dir);
dir->i_mtime = dir->i_ctime = current_time(dir);

return 0;
}
Expand Down Expand Up @@ -633,7 +633,7 @@ static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
d_inode(dentry)->i_size = 0;
clear_nlink(d_inode(dentry));

dir->i_mtime = current_time(dir);
dir->i_mtime = dir->i_ctime = current_time(dir);

spin_lock(&sbi->lookup_lock);
__autofs_add_expiring(dentry);
Expand Down Expand Up @@ -749,7 +749,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
p_ino = autofs_dentry_ino(dentry->d_parent);
p_ino->count++;
inc_nlink(dir);
dir->i_mtime = current_time(dir);
dir->i_mtime = dir->i_ctime = current_time(dir);

return 0;
}
Expand Down

0 comments on commit 797a1d8

Please sign in to comment.