]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph: add fs_capabilities hook to avoid local statvfs
authorDavid Disseldorp <ddiss@samba.org>
Wed, 10 Jan 2018 00:37:14 +0000 (01:37 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 22 Jan 2018 07:50:09 +0000 (08:50 +0100)
Adding the fs_capabilities() hook to the CephFS VFS module avoids
fallback to the vfs_default code-path, which calls statvfs() against the
share path on the *local* filesystem.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13208

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2724e0cac29cd1632ea28075a740fcc888affb36)

source3/modules/vfs_ceph.c

index e3d22bfce29953dcb0b6352e8db31df4bd1d22a7..28426472dee8719b20588e18620ea172fdce1379 100644 (file)
@@ -251,6 +251,20 @@ static int cephwrap_statvfs(struct vfs_handle_struct *handle,  const char *path,
        return ret;
 }
 
+static uint32_t cephwrap_fs_capabilities(struct vfs_handle_struct *handle,
+                                        enum timestamp_set_resolution *p_ts_res)
+{
+       uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+
+#ifdef HAVE_CEPH_STATX
+       *p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
+#else
+       *p_ts_res = TIMESTAMP_SET_MSEC;
+#endif
+
+       return caps;
+}
+
 /* Directory operations */
 
 static DIR *cephwrap_opendir(struct vfs_handle_struct *handle,
@@ -1339,6 +1353,7 @@ static struct vfs_fn_pointers ceph_fns = {
        .get_quota_fn = cephwrap_get_quota,
        .set_quota_fn = cephwrap_set_quota,
        .statvfs_fn = cephwrap_statvfs,
+       .fs_capabilities_fn = cephwrap_fs_capabilities,
 
        /* Directory operations */