From: Anoop C S Date: Fri, 19 Aug 2022 06:43:33 +0000 (+0530) Subject: vfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READLINKAT X-Git-Tag: talloc-2.4.0~1286 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=58b6cdabc0c3d788b407d3bfa46570311e910180;p=thirdparty%2Fsamba.git vfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READLINKAT BUG: https://bugzilla.samba.org/show_bug.cgi?id=15157 Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 808dc72f902..1f2aab256ed 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -2065,14 +2065,29 @@ static int vfs_gluster_readlinkat(struct vfs_handle_struct *handle, char *buf, size_t bufsiz) { - struct smb_filename *full_fname = NULL; int ret; +#ifdef HAVE_GFAPI_VER_7_11 + glfs_fd_t *pglfd = NULL; + + START_PROFILE(syscall_readlinkat); + + pglfd = vfs_gluster_fetch_glfd(handle, dirfsp); + if (pglfd == NULL) { + END_PROFILE(syscall_readlinkat); + DBG_ERR("Failed to fetch gluster fd\n"); + return -1; + } + + ret = glfs_readlinkat(pglfd, smb_fname->base_name, buf, bufsiz); +#else + struct smb_filename *full_fname = NULL; + START_PROFILE(syscall_readlinkat); full_fname = full_path_from_dirfsp_atname(talloc_tos(), - dirfsp, - smb_fname); + dirfsp, + smb_fname); if (full_fname == NULL) { END_PROFILE(syscall_readlinkat); return -1; @@ -2081,6 +2096,7 @@ static int vfs_gluster_readlinkat(struct vfs_handle_struct *handle, ret = glfs_readlink(handle->data, full_fname->base_name, buf, bufsiz); TALLOC_FREE(full_fname); +#endif END_PROFILE(syscall_readlinkat);