From: Vinit Agnihotri Date: Thu, 1 Jan 2026 12:10:35 +0000 (+0530) Subject: vfs_ceph_rgw: Add get_real_filename_at, get/set dos attribute methods X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e73ac22e87a10d762f4dcbaa2f353fda13083391;p=thirdparty%2Fsamba.git vfs_ceph_rgw: Add get_real_filename_at, get/set dos attribute methods Signed-off-by: Vinit Agnihotri Reviewed-by: Shachar Sharon Reviewed-by: Anoop C S Reviewed-by: Guenther Deschner --- diff --git a/source3/modules/vfs_ceph_rgw.c b/source3/modules/vfs_ceph_rgw.c index 8d25a7daa4a..300a10876a2 100644 --- a/source3/modules/vfs_ceph_rgw.c +++ b/source3/modules/vfs_ceph_rgw.c @@ -793,6 +793,67 @@ out: return rc; } +static NTSTATUS vfs_ceph_rgw_get_real_filename_at( + struct vfs_handle_struct *handle, + struct files_struct *dirfsp, + const char *name, + TALLOC_CTX *mem_ctx, + char **found_name) +{ + return NT_STATUS_NOT_SUPPORTED; +} + +static NTSTATUS vfs_ceph_rgw_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; + + if (is_special_name(fsp->fsp_name->base_name)) { + return NT_STATUS_NOT_IMPLEMENTED; + } + + status = fget_ea_dos_attribute(fsp, dosmode); + + /* + * 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 status; +} + +static NTSTATUS vfs_ceph_rgw_fset_dos_attributes( + struct vfs_handle_struct *handle, + struct files_struct *fsp, + uint32_t dosmode) +{ + NTSTATUS status; + struct timespec saved_btime = fsp->fsp_name->st.st_ex_btime; + + if (is_special_name(fsp->fsp_name->base_name)) { + return NT_STATUS_NOT_IMPLEMENTED; + } + + 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; +} + static bool vfs_ceph_rgw_mount_bucket(struct vfs_ceph_rgw_config *config) { int rc = 0; @@ -1067,9 +1128,9 @@ static struct vfs_fn_pointers ceph_rgw_fns = { .mknodat_fn = vfs_not_implemented_mknodat, .realpath_fn = vfs_ceph_rgw_realpath, .fchflags_fn = vfs_not_implemented_fchflags, - .get_real_filename_at_fn = vfs_not_implemented_get_real_filename_at, - .fget_dos_attributes_fn = vfs_not_implemented_fget_dos_attributes, - .fset_dos_attributes_fn = vfs_not_implemented_fset_dos_attributes, + .get_real_filename_at_fn = vfs_ceph_rgw_get_real_filename_at, + .fget_dos_attributes_fn = vfs_ceph_rgw_fget_dos_attributes, + .fset_dos_attributes_fn = vfs_ceph_rgw_fset_dos_attributes, /* EA operations. */ .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,