The branch, master has been updated
via a9fc256afa3 vfs_ceph_new: Handle the special case of UTIME_NOW
via a9aa159c7b9 vfs_ceph: Handle the special case of UTIME_NOW
via 639646be35c vfs_ceph: Add ctime processing to SMB_VFS_FNTIMES
from 5b9492ada40 s3:winbind: Correct spelling in debug messages related
to ADS
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a9fc256afa387eb72dad9bace20950fe3b0a06d0
Author: Anoop C S <[email protected]>
Date: Sat Jun 14 14:32:28 2025 +0530
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 <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
Autobuild-User(master): Ralph Böhme <[email protected]>
Autobuild-Date(master): Mon Jun 30 14:16:52 UTC 2025 on atb-devel-224
commit a9aa159c7b9d49e92fe43ed037b638d957e192fd
Author: Anoop C S <[email protected]>
Date: Sat Jun 14 14:54:52 2025 +0530
vfs_ceph: 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_setattrx() with
appropriate mask to update timsestamps. It is also important to note
that ceph_setattrx() 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 <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 639646be35c78596777e5d842d14d17457874701
Author: Anoop C S <[email protected]>
Date: Sat Jun 14 14:29:00 2025 +0530
vfs_ceph: Add ctime processing to SMB_VFS_FNTIMES
ctime was only missing from the list of timestamps processed for various
checks.
Signed-off-by: Anoop C S <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_ceph.c | 17 +++++++++++++++++
source3/modules/vfs_ceph_new.c | 20 +++++++++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 3913cb01b2c..8ea7eb09099 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -954,16 +954,33 @@ static int cephwrap_fntimes(struct vfs_handle_struct
*handle,
struct ceph_statx stx = { 0 };
int result;
int mask = 0;
+ struct timespec time_now = timespec_current();
if (!is_omit_timespec(&ft->atime)) {
+ if (ft->atime.tv_nsec == UTIME_NOW) {
+ ft->atime = time_now;
+ }
stx.stx_atime = ft->atime;
mask |= CEPH_SETATTR_ATIME;
}
if (!is_omit_timespec(&ft->mtime)) {
+ if (ft->mtime.tv_nsec == UTIME_NOW) {
+ ft->mtime = time_now;
+ }
stx.stx_mtime = ft->mtime;
mask |= CEPH_SETATTR_MTIME;
}
+ if (!is_omit_timespec(&ft->ctime)) {
+ if (ft->ctime.tv_nsec == UTIME_NOW) {
+ ft->ctime = time_now;
+ }
+ stx.stx_ctime = ft->ctime;
+ mask |= CEPH_SETATTR_CTIME;
+ }
if (!is_omit_timespec(&ft->create_time)) {
+ if (ft->create_time.tv_nsec == UTIME_NOW) {
+ ft->create_time = time_now;
+ }
stx.stx_btime = ft->create_time;
mask |= CEPH_SETATTR_BTIME;
}
diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c
index 04694d56baf..caafdad12af 100644
--- a/source3/modules/vfs_ceph_new.c
+++ b/source3/modules/vfs_ceph_new.c
@@ -1031,23 +1031,37 @@ static int vfs_ceph_ll_fchmod(struct vfs_handle_struct
*handle,
cfh->uperm);
}
-static void vfs_ceph_fill_statx_mask_from_ft(const struct smb_file_time *ft,
+static void vfs_ceph_fill_statx_mask_from_ft(struct smb_file_time *ft,
struct ceph_statx *stx,
int *mask)
{
+ struct timespec time_now = timespec_current();
+
if (!is_omit_timespec(&ft->atime)) {
+ if (ft->atime.tv_nsec == UTIME_NOW) {
+ ft->atime = time_now;
+ }
stx->stx_atime = ft->atime;
*mask |= CEPH_SETATTR_ATIME;
}
if (!is_omit_timespec(&ft->mtime)) {
+ if (ft->mtime.tv_nsec == UTIME_NOW) {
+ ft->mtime = time_now;
+ }
stx->stx_mtime = ft->mtime;
*mask |= CEPH_SETATTR_MTIME;
}
if (!is_omit_timespec(&ft->ctime)) {
+ if (ft->ctime.tv_nsec == UTIME_NOW) {
+ ft->ctime = time_now;
+ }
stx->stx_ctime = ft->ctime;
*mask |= CEPH_SETATTR_CTIME;
}
if (!is_omit_timespec(&ft->create_time)) {
+ if (ft->create_time.tv_nsec == UTIME_NOW) {
+ ft->create_time = time_now;
+ }
stx->stx_btime = ft->create_time;
*mask |= CEPH_SETATTR_BTIME;
}
@@ -1055,7 +1069,7 @@ static void vfs_ceph_fill_statx_mask_from_ft(const struct
smb_file_time *ft,
static int vfs_ceph_ll_utimes(struct vfs_handle_struct *handle,
const struct vfs_ceph_iref *iref,
- const struct smb_file_time *ft)
+ struct smb_file_time *ft)
{
struct ceph_statx stx = {0};
struct UserPerm *uperm = NULL;
@@ -1094,7 +1108,7 @@ static int vfs_ceph_ll_utimes(struct vfs_handle_struct
*handle,
static int vfs_ceph_ll_futimes(struct vfs_handle_struct *handle,
const struct vfs_ceph_fh *cfh,
- const struct smb_file_time *ft)
+ struct smb_file_time *ft)
{
struct ceph_statx stx = {0};
int mask = 0;
--
Samba Shared Repository