11 Feb, 2020

1 commit

  • commit eb31e2f63d85d1bec4f7b136f317e03c03db5503 upstream.

    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
    Fixes: 42e729b9ddbb ("utimes: Clamp the timestamps before update")
    Cc: stable@vger.kernel.org # v5.4
    Cc: Deepa Dinamani
    Cc: Jeff Layton
    Signed-off-by: Amir Goldstein
    Signed-off-by: Al Viro
    Signed-off-by: Greg Kroah-Hartman

    Amir Goldstein
     

30 Aug, 2019

1 commit

  • POSIX is ambiguous on the behavior of timestamps for
    futimens, utimensat and utimes. Whether to return an
    error or silently clamp a timestamp beyond the range
    supported by the underlying filesystems is not clear.

    POSIX.1 section for futimens, utimensat and utimes says:
    (http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html)

    The file's relevant timestamp shall be set to the greatest
    value supported by the file system that is not greater
    than the specified time.

    If the tv_nsec field of a timespec structure has the special
    value UTIME_NOW, the file's relevant timestamp shall be set
    to the greatest value supported by the file system that is
    not greater than the current time.

    [EINVAL]
    A new file timestamp would be a value whose tv_sec
    component is not a value supported by the file system.

    The patch chooses to clamp the timestamps according to the
    filesystem timestamp ranges and does not return an error.
    This is in line with the behavior of utime syscall also
    since the POSIX page(http://pubs.opengroup.org/onlinepubs/009695399/functions/utime.html)
    for utime does not mention returning an error or clamping like above.

    Same for utimes http://pubs.opengroup.org/onlinepubs/009695399/functions/utimes.html

    Signed-off-by: Deepa Dinamani
    Acked-by: Jeff Layton

    Deepa Dinamani