]> git.ipfire.org Git - thirdparty/samba.git/commit
vfs_ceph_new: Handle the special case of UTIME_NOW
authorAnoop C S <anoopcs@samba.org>
Sat, 14 Jun 2025 09:02:28 +0000 (14:32 +0530)
committerRalph Boehme <slow@samba.org>
Mon, 30 Jun 2025 14:16:52 +0000 (14:16 +0000)
commita9fc256afa387eb72dad9bace20950fe3b0a06d0
treeeed7b8a05aa333ee50b8e3d57cb7dedc0cd60e8a
parenta9aa159c7b9d49e92fe43ed037b638d957e192fd
vfs_ceph_new: Handle the special case of UTIME_NOW

As per utimensat(2)[1]:
. . .
If the tv_nsec field of one of the timespec structures has the special
value UTIME_NOW, then the corresponding file timestamp is set to the
current time.
. . .

Instead of utimes() or futimes() we make use of ceph_ll_setattr() with
appropriate mask to update timsestamps. It is also important to note
that ceph_ll_setattr() does not handle timestamps in pairs of timespec
structs. This had a shortcoming that the special consideration for the
magic value UTIME_NOW was left unattended resulting in epoch timestamps.
Therefore we reset those timestamps where UTIME_NOW is set in tv_nsec
with the current time.

[1] https://www.man7.org/linux/man-pages/man2/utimensat.2.html

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Jun 30 14:16:52 UTC 2025 on atb-devel-224
source3/modules/vfs_ceph_new.c