The branch, master has been updated via 4cade04d1f1 vfs_ceph: Implement SMB_VFS_FSET_DOS_ATTRIBUTES for precise btime via c36e79ef810 vfs_ceph: Simplify SMB_VFS_FGET_DOS_ATTRIBUTES from 98b443d9033 fuzzing: fix fuzz_stable_sort_r_unstable comparison
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 4cade04d1f1e7f1bbd99776bcf876a42488d0f78 Author: Anoop C S <anoo...@samba.org> Date: Fri May 17 11:57:26 2024 +0530 vfs_ceph: Implement SMB_VFS_FSET_DOS_ATTRIBUTES for precise btime Previously we added an implementation for SMB_VFS_FGET_DOS_ATTRIBUTES so that the btime is always preserved unless explicitly changed using SMB_VFS_FNTIMES. But there are situations with open file handle where btime stored on dos attributes as create_time has to be precise for comparison because a one-to-one conversion between timepsec and nttime is not always guaranteed. Accordingly preserve btime via SMB_VFS_FSET_DOS_ATTRIBUTES so that we always compare the exact btime from fsp stat information while the file handle is still open. Signed-off-by: Anoop C S <anoo...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> Autobuild-User(master): Anoop C S <anoo...@samba.org> Autobuild-Date(master): Mon Jun 3 11:10:11 UTC 2024 on atb-devel-224 commit c36e79ef8104b84c9df638cbec984ec3491d875b Author: Anoop C S <anoo...@samba.org> Date: Sat May 18 12:37:44 2024 +0530 vfs_ceph: Simplify SMB_VFS_FGET_DOS_ATTRIBUTES Signed-off-by: Anoop C S <anoo...@samba.org> Reviewed-by: David Disseldorp <dd...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/modules/vfs_ceph.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 6dae8a5f9e8..bb1650446c9 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1577,9 +1577,6 @@ static NTSTATUS cephwrap_fget_dos_attributes(struct vfs_handle_struct *handle, 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 @@ -1589,7 +1586,27 @@ static NTSTATUS cephwrap_fget_dos_attributes(struct vfs_handle_struct *handle, */ fsp->fsp_name->st.st_ex_btime = saved_btime; - return NT_STATUS_OK; + return status; +} + +static NTSTATUS cephwrap_fset_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 = set_ea_dos_attribute(handle->conn, fsp->fsp_name, dosmode); + + /* + * Restore previously stored btime from statx timestamps. This is done + * to ensure that we have the exact btime in fsp stat information while + * the file handle is still open since the create_time stored as part of + * dos attributes can loose its precision when converted back to btime. + */ + fsp->fsp_name->st.st_ex_btime = saved_btime; + + return status; } /**************************************************************** @@ -1957,6 +1974,7 @@ static struct vfs_fn_pointers ceph_fns = { .get_real_filename_at_fn = cephwrap_get_real_filename_at, .connectpath_fn = cephwrap_connectpath, .fget_dos_attributes_fn = cephwrap_fget_dos_attributes, + .fset_dos_attributes_fn = cephwrap_fset_dos_attributes, /* EA operations. */ .getxattrat_send_fn = vfs_not_implemented_getxattrat_send, -- Samba Shared Repository