From 7d6d1fa4c0018a5a0ed12f6f4d6f49d8d2ee0ac6 Mon Sep 17 00:00:00 2001 From: Guenther Deschner Date: Thu, 5 Sep 2024 13:13:38 +0530 Subject: [PATCH] vfs_ceph_new: Introduce new parametric option 'proxy' Provide early support for consuming yet to come libcephfs proxy[1] for optimized resource utilization. For better control we make use of an additional module specific option 'proxy' to specify the intent to load proxy library. With the default value 'no' a regular cephfs connection is established. There is also an 'auto' mode which can fall back to the regular connection if proxy requirements are not met. [1] https://github.com/ceph/ceph/pull/58376 BUG: https://bugzilla.samba.org/show_bug.cgi?id=15703 Signed-off-by: Guenther Deschner Reviewed-by: Guenther Deschner (cherry picked from commit 90464bdcafda0f0f0e4d2b549fd1675c076ee188) --- source3/modules/vfs_ceph_new.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index 87f58364f8e..fd977dbe7ef 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -78,12 +78,34 @@ static ssize_t lstatus_code(intmax_t ret) return (ssize_t)ret; } +enum vfs_cephfs_proxy_mode { + VFS_CEPHFS_PROXY_NO = 0, + VFS_CEPHFS_PROXY_YES, + VFS_CEPHFS_PROXY_AUTO +}; + +static const struct enum_list enum_vfs_cephfs_proxy_vals[] = { + {VFS_CEPHFS_PROXY_NO, "No"}, + {VFS_CEPHFS_PROXY_NO, "False"}, + {VFS_CEPHFS_PROXY_NO, "0"}, + {VFS_CEPHFS_PROXY_NO, "Off"}, + {VFS_CEPHFS_PROXY_NO, "disable"}, + {VFS_CEPHFS_PROXY_YES, "Yes"}, + {VFS_CEPHFS_PROXY_YES, "True"}, + {VFS_CEPHFS_PROXY_YES, "1"}, + {VFS_CEPHFS_PROXY_YES, "On"}, + {VFS_CEPHFS_PROXY_YES, "enable"}, + {VFS_CEPHFS_PROXY_AUTO, "auto"}, + {-1, NULL} +}; + struct vfs_ceph_config { const char *conf_file; const char *user_id; const char *fsname; struct cephmount_cached *mount_entry; struct ceph_mount_info *mount; + enum vfs_cephfs_proxy_mode proxy; }; /* @@ -275,6 +297,13 @@ static bool vfs_ceph_load_config(struct vfs_handle_struct *handle, "user_id", ""); config_tmp->fsname = lp_parm_const_string(snum, module_name, "filesystem", ""); + config_tmp->proxy = lp_parm_enum(snum, module_name, "proxy", + enum_vfs_cephfs_proxy_vals, + VFS_CEPHFS_PROXY_NO); + if (config_tmp->proxy == -1) { + DBG_ERR("value for proxy: mode unknown\n"); + return false; + } SMB_VFS_HANDLE_SET_DATA(handle, config_tmp, NULL, struct vfs_ceph_config, return false); -- 2.47.2