From e4540a6b6351a0c3c3a810d1100892fb23e19b7b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 11 Mar 2021 22:55:33 -0800 Subject: [PATCH] VFS: ceph: Ensure cephwrap_flistxattr() only uses an io fd for a handle based call. Otherwise fall back to pathname based. This is the same as the fallback used in vfs_default.c Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/modules/vfs_ceph.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 6eb432e2c98..90dd0355db9 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1283,7 +1283,23 @@ static ssize_t cephwrap_flistxattr(struct vfs_handle_struct *handle, struct file int ret; DBG_DEBUG("[CEPH] flistxattr(%p, %p, %p, %llu)\n", handle, fsp, list, llu(size)); - ret = ceph_flistxattr(handle->data, fsp_get_io_fd(fsp), list, size); + if (!fsp->fsp_flags.is_pathref) { + /* + * We can use an io_fd to list xattrs. + */ + ret = ceph_flistxattr(handle->data, + fsp_get_io_fd(fsp), + list, + size); + } else { + /* + * This is no longer a handle based call. + */ + ret = ceph_listxattr(handle->data, + fsp->fsp_name->base_name, + list, + size); + } DBG_DEBUG("[CEPH] flistxattr(...) = %d\n", ret); if (ret < 0) { WRAP_RETURN(ret); -- 2.47.3