VFS: glusterfs: Ensure vfs_gluster_flistxattr() only uses an io fd for a handle based...
authorJeremy Allison <jra@samba.org>
Fri, 12 Mar 2021 07:03:19 +0000 (23:03 -0800)
committerJeremy Allison <jra@samba.org>
Fri, 12 Mar 2021 19:25:34 +0000 (19:25 +0000)
Otherwise fall back to pathname based. This is the same as the
fallback used in vfs_default.c

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_glusterfs.c

index c3fe1c60f7f8a464acdbbf5b20a4da6b038c8049..86a5a88b14dfb2f744b142112d3b20965020ceac 100644 (file)
@@ -2049,8 +2049,20 @@ static ssize_t vfs_gluster_flistxattr(struct vfs_handle_struct *handle,
                DBG_ERR("Failed to fetch gluster fd\n");
                return -1;
        }
-
-       return glfs_flistxattr(glfd, list, size);
+       if (!fsp->fsp_flags.is_pathref) {
+               /*
+                * We can use an io_fd to list xattrs.
+                */
+               return glfs_flistxattr(glfd, list, size);
+       } else {
+               /*
+                * This is no longer a handle based call.
+                */
+               return glfs_listxattr(handle->data,
+                               fsp->fsp_name->base_name,
+                               list,
+                               size);
+       }
 }
 
 static int vfs_gluster_removexattr(struct vfs_handle_struct *handle,