]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_glusterfs: Use glfs_readlinkat() for SMB_VFS_READLINKAT
authorAnoop C S <anoopcs@samba.org>
Fri, 19 Aug 2022 06:43:33 +0000 (12:13 +0530)
committerJeremy Allison <jra@samba.org>
Fri, 26 Aug 2022 16:31:38 +0000 (16:31 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15157

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_glusterfs.c

index 808dc72f902c1ef1ccb8e640e899165eadeebecf..1f2aab256ede19769238a86f2f5d9cf6c73c6a6e 100644 (file)
@@ -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);