]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_glusterfs: Do not use glfs_fgetxattr() for SMB_VFS_GET_REAL_FILENAME_AT
authorAnoop C S <anoopcs@samba.org>
Tue, 11 Oct 2022 17:57:37 +0000 (23:27 +0530)
committerRalph Boehme <slow@samba.org>
Wed, 12 Oct 2022 11:46:36 +0000 (11:46 +0000)
glfs_fgetxattr() or generally fgetxattr() will return EBADF as dirfsp
here is a pathref fsp. GlusterFS client log had following entries
indicating the error:

W [MSGID: 114031] [client-rpc-fops_v2.c:993:client4_0_fgetxattr_cbk] \
  0-vol-client-0: remote operation failed. [{errno=9}, {error=Bad file descriptor}]

Therefore use glfs_getxattr() only for implementing get_real_filename_at
logic.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_glusterfs.c

index 69bc4ab06c6d3cc586e7ca30c6df027d3979c6b9..ed224a61e1c459c8423ac67c18eb0edfe839da47 100644 (file)
@@ -2267,9 +2267,6 @@ static NTSTATUS vfs_gluster_get_real_filename_at(
        int ret;
        char key_buf[GLUSTER_NAME_MAX + 64];
        char val_buf[GLUSTER_NAME_MAX + 1];
-#ifdef HAVE_GFAPI_VER_7_11
-       glfs_fd_t *pglfd = NULL;
-#endif
 
        if (strlen(name) >= GLUSTER_NAME_MAX) {
                return NT_STATUS_OBJECT_NAME_INVALID;
@@ -2278,22 +2275,11 @@ static NTSTATUS vfs_gluster_get_real_filename_at(
        snprintf(key_buf, GLUSTER_NAME_MAX + 64,
                 "glusterfs.get_real_filename:%s", name);
 
-#ifdef HAVE_GFAPI_VER_7_11
-       pglfd = vfs_gluster_fetch_glfd(handle, dirfsp);
-       if (pglfd == NULL) {
-               DBG_ERR("Failed to fetch gluster fd\n");
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
-       ret = glfs_fgetxattr(pglfd, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
-#else
        ret = glfs_getxattr(handle->data,
                            dirfsp->fsp_name->base_name,
                            key_buf,
                            val_buf,
                            GLUSTER_NAME_MAX + 1);
-#endif
-
        if (ret == -1) {
                if (errno == ENOATTR) {
                        errno = ENOENT;