]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_glusterfs: Use glfs_symlinkat() for SMB_VFS_SYMLINKAT
authorAnoop C S <anoopcs@samba.org>
Fri, 19 Aug 2022 06:42:43 +0000 (12:12 +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 dfed5c739cc351b5fd513b5cd0bd4057822890f2..808dc72f902c1ef1ccb8e640e899165eadeebecf 100644 (file)
@@ -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);