From: Anoop C S Date: Thu, 21 Mar 2024 11:19:04 +0000 (+0530) Subject: vfs_ceph: Implement SMB_VFS_FGET_DOS_ATTRIBUTES to preserve create_time X-Git-Tag: tdb-1.4.11~1296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd2289eb3ae83b6586493a14098a7e7eddc1ec63;p=thirdparty%2Fsamba.git vfs_ceph: Implement SMB_VFS_FGET_DOS_ATTRIBUTES to preserve create_time In order to avoid the dependency on dos attribute for create_time we now preserve the btime before parsing dos attribute which may update btime from its value with an old one unless we explicitly reset dos attribute with new create_time in SMB_VFS_FNTIMES implementation. Therefore have an implementation for SMB_VFS_FGET_DOS_ATTRIBUTES to save and restore updated create_time. Signed-off-by: Anoop C S Reviewed-by: Ralph Boehme Autobuild-User(master): Anoop C S Autobuild-Date(master): Mon Apr 1 15:24:39 UTC 2024 on atb-devel-224 --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index c9ee5414f03..6dae8a5f9e8 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1569,6 +1569,29 @@ static const char *cephwrap_connectpath( return handle->conn->connectpath; } +static NTSTATUS cephwrap_fget_dos_attributes(struct vfs_handle_struct *handle, + struct files_struct *fsp, + uint32_t *dosmode) +{ + struct timespec saved_btime = fsp->fsp_name->st.st_ex_btime; + NTSTATUS status; + + status = fget_ea_dos_attribute(fsp, dosmode); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + /* + * Restore previously stored btime from statx timestamps as it should be + * the only source of truth. create_time from dos attribute, if any, may + * have older values which isn't trustworthy to be looked at for other + * open file handle operations. + */ + fsp->fsp_name->st.st_ex_btime = saved_btime; + + return NT_STATUS_OK; +} + /**************************************************************** Extended attribute operations. *****************************************************************/ @@ -1933,6 +1956,7 @@ static struct vfs_fn_pointers ceph_fns = { .fchflags_fn = cephwrap_fchflags, .get_real_filename_at_fn = cephwrap_get_real_filename_at, .connectpath_fn = cephwrap_connectpath, + .fget_dos_attributes_fn = cephwrap_fget_dos_attributes, /* EA operations. */ .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,