1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

vfs_glusterfs: Do not use glfs_fgetxattr() for SMB_VFS_GET_REAL_FILENAME_AT

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>
This commit is contained in:
Anoop C S 2022-10-11 23:27:37 +05:30 committed by Ralph Boehme
parent 8cbd9e6372
commit 6a6bd1a053

View 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;