]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph_rgw: Add get_real_filename_at, get/set dos attribute methods
authorVinit Agnihotri <vagnihot@redhat.com>
Thu, 1 Jan 2026 12:10:35 +0000 (17:40 +0530)
committerAnoop C S <anoopcs@samba.org>
Thu, 18 Jun 2026 14:56:29 +0000 (14:56 +0000)
Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/modules/vfs_ceph_rgw.c

index 8d25a7daa4a6e9fdd0cd70bf0dd0206a587a0831..300a10876a2777da6e1d7ae66a132ea4b7640610 100644 (file)
@@ -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,