utimes: Clamp the timestamps in notify_change()
Push clamping timestamps into notify_change(), so in-kernel
callers like nfsd and overlayfs will get similar timestamp
set behavior as utimes.
AV: get rid of clamping in ->setattr() instances; we don't need
to bother with that there, with notify_change() doing normalization
in all cases now (it already did for implicit case, since current_time()
clamps).
Suggested-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 42e729b9dd
("utimes: Clamp the timestamps before update")
Cc: stable@vger.kernel.org # v5.4
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -36,14 +36,14 @@ static int utimes_common(const struct path *path, struct timespec64 *times)
|
||||
if (times[0].tv_nsec == UTIME_OMIT)
|
||||
newattrs.ia_valid &= ~ATTR_ATIME;
|
||||
else if (times[0].tv_nsec != UTIME_NOW) {
|
||||
newattrs.ia_atime = timestamp_truncate(times[0], inode);
|
||||
newattrs.ia_atime = times[0];
|
||||
newattrs.ia_valid |= ATTR_ATIME_SET;
|
||||
}
|
||||
|
||||
if (times[1].tv_nsec == UTIME_OMIT)
|
||||
newattrs.ia_valid &= ~ATTR_MTIME;
|
||||
else if (times[1].tv_nsec != UTIME_NOW) {
|
||||
newattrs.ia_mtime = timestamp_truncate(times[1], inode);
|
||||
newattrs.ia_mtime = times[1];
|
||||
newattrs.ia_valid |= ATTR_MTIME_SET;
|
||||
}
|
||||
/*
|
||||
|
Reference in New Issue
Block a user