From b2746eb5fa64e0ec58e99eed5be10c98ea4e1c1e Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Fri, 19 Aug 2022 12:12:43 +0530 Subject: [PATCH] vfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_SYMLINKAT BUG: https://bugzilla.samba.org/show_bug.cgi?id=15157 Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison --- source3/modules/vfs_glusterfs.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index dfed5c739cc..808dc72f902 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -2017,24 +2017,42 @@ static int vfs_gluster_symlinkat(struct vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *new_smb_fname) { - struct smb_filename *full_fname = NULL; int ret; +#ifdef HAVE_GFAPI_VER_7_11 + glfs_fd_t *pglfd = NULL; + + START_PROFILE(syscall_symlinkat); + + pglfd = vfs_gluster_fetch_glfd(handle, dirfsp); + if (pglfd == NULL) { + END_PROFILE(syscall_symlinkat); + DBG_ERR("Failed to fetch gluster fd\n"); + return -1; + } + + ret = glfs_symlinkat(link_target->base_name, + pglfd, + new_smb_fname->base_name); +#else + struct smb_filename *full_fname = NULL; + START_PROFILE(syscall_symlinkat); full_fname = full_path_from_dirfsp_atname(talloc_tos(), - dirfsp, - new_smb_fname); + dirfsp, + new_smb_fname); if (full_fname == NULL) { END_PROFILE(syscall_symlinkat); return -1; } ret = glfs_symlink(handle->data, - link_target->base_name, - full_fname->base_name); + link_target->base_name, + full_fname->base_name); TALLOC_FREE(full_fname); +#endif END_PROFILE(syscall_symlinkat); -- 2.11.4.GIT