diff options
author | Jeremy Allison <jra@samba.org> | 2021-06-23 11:29:18 -0700 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2021-06-25 15:53:31 +0000 |
commit | 8fc84ac100d80aced6f1d852ae17bebd4e855b16 (patch) | |
tree | f03b241ae35b5ff58ff0cb19f6ec4dadb79efe39 /source3 | |
parent | abe3a396e0e32f72a4fc0f9b2b10a968c8542fea (diff) | |
download | samba-8fc84ac100d80aced6f1d852ae17bebd4e855b16.tar.gz |
s3: VFS: ceph_snapshots: In ceph_snap_fill_label(), use ceph_snap_get_btime_fsp() instead of ceph_snap_get_btime().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_ceph_snapshots.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 0ed79920064..13b9dfa64e8 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -113,7 +113,6 @@ static int ceph_snap_get_btime(struct vfs_handle_struct *handle, return 0; } -#if 0 static int ceph_snap_get_btime_fsp(struct vfs_handle_struct *handle, struct files_struct *fsp, time_t *_snap_secs) @@ -181,7 +180,6 @@ static int ceph_snap_get_btime_fsp(struct vfs_handle_struct *handle, return 0; } -#endif /* * XXX Ceph snapshots can be created with sub-second granularity, which means @@ -198,12 +196,14 @@ static int ceph_snap_fill_label(struct vfs_handle_struct *handle, { const char *parent_snapsdir = dirfsp->fsp_name->base_name; struct smb_filename *smb_fname; + struct smb_filename *atname = NULL; time_t snap_secs; struct tm gmt_snap_time; struct tm *tm_ret; size_t str_sz; char snap_path[PATH_MAX + 1]; int ret; + NTSTATUS status; /* * CephFS snapshot creation times are available via a special @@ -225,11 +225,40 @@ static int ceph_snap_fill_label(struct vfs_handle_struct *handle, return -ENOMEM; } - 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); return ret; } + atname = synthetic_smb_fname(tmp_ctx, + subdir, + NULL, + &smb_fname->st, + 0, + 0); + if (atname == NULL) { + TALLOC_FREE(smb_fname); + return -ENOMEM; + } + + status = openat_pathref_fsp(dirfsp, atname); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + return -map_errno_from_nt_status(status); + } + + ret = ceph_snap_get_btime_fsp(handle, atname->fsp, &snap_secs); + if (ret < 0) { + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + return ret; + } + TALLOC_FREE(smb_fname); + TALLOC_FREE(atname); + tm_ret = gmtime_r(&snap_secs, &gmt_snap_time); if (tm_ret == NULL) { return -EINVAL; |