]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: ceph_snapshots: In ceph_snap_gmt_convert_dir() - change to use ceph_snap_get...
authorJeremy Allison <jra@samba.org>
Wed, 23 Jun 2021 18:44:23 +0000 (11:44 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 25 Jun 2021 15:53:31 +0000 (15:53 +0000)
Comment out ceph_snap_get_btime() as it has no more callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_ceph_snapshots.c

index 13b9dfa64e811bcc124878019b43be1c0475b8ba..3b2289d37d6fc189ec1a7ddb8f689483d886a80d 100644 (file)
@@ -48,6 +48,7 @@
  */
 #define CEPH_SNAP_BTIME_XATTR "ceph.snap.btime"
 
+#if 0
 static int ceph_snap_get_btime(struct vfs_handle_struct *handle,
                               struct smb_filename *smb_fname,
                               time_t *_snap_secs)
@@ -112,6 +113,7 @@ static int ceph_snap_get_btime(struct vfs_handle_struct *handle,
 
        return 0;
 }
+#endif
 
 static int ceph_snap_get_btime_fsp(struct vfs_handle_struct *handle,
                                   struct files_struct *fsp,
@@ -647,7 +649,8 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle,
         while ((dname = ReadDirName(dir_hnd, &offset, NULL, &talloced))
               != NULL)
        {
-               struct smb_filename *smb_fname;
+               struct smb_filename *smb_fname = NULL;
+               struct smb_filename *atname = NULL;
                time_t snap_secs = 0;
 
                if (ISDOT(dname) || ISDOTDOT(dname)) {
@@ -673,11 +676,43 @@ static int ceph_snap_gmt_convert_dir(struct vfs_handle_struct *handle,
                        goto err_out;
                }
 
-               ret = ceph_snap_get_btime(handle, smb_fname, &snap_secs);
+               ret = vfs_stat(handle->conn, smb_fname);
                if (ret < 0) {
+                       ret = -errno;
+                       TALLOC_FREE(smb_fname);
                        goto err_out;
                }
 
+               atname = synthetic_smb_fname(tmp_ctx,
+                                            dname,
+                                            NULL,
+                                            &smb_fname->st,
+                                            0,
+                                            0);
+               if (atname == NULL) {
+                       TALLOC_FREE(smb_fname);
+                       ret = -ENOMEM;
+                       goto err_out;
+               }
+
+               status = openat_pathref_fsp(dirfsp, atname);
+               if (!NT_STATUS_IS_OK(status)) {
+                       TALLOC_FREE(smb_fname);
+                       TALLOC_FREE(atname);
+                       ret = -map_errno_from_nt_status(status);
+                       goto err_out;
+               }
+
+               ret = ceph_snap_get_btime_fsp(handle, atname->fsp, &snap_secs);
+               if (ret < 0) {
+                       TALLOC_FREE(smb_fname);
+                       TALLOC_FREE(atname);
+                       goto err_out;
+               }
+
+               TALLOC_FREE(smb_fname);
+               TALLOC_FREE(atname);
+
                /*
                 * check gmt_snap_time matches @timestamp
                 */