From a749da2a5d6775b0e583822d461a1884a44e5a1f Mon Sep 17 00:00:00 2001 From: Noel Power Date: Tue, 6 Apr 2021 17:10:35 +0100 Subject: [PATCH] VFS: ceph: Allow cephwrap_fchmod() to cope with pathref fsps. Ensure it only uses an io fd for a handle based call. Otherwise fall back to pathname based. Signed-off-by: Noel Power Reviewed-by: Ralph Boehme --- source3/modules/vfs_ceph.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 634222df764..8e6bab0fea7 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -875,7 +875,19 @@ static int cephwrap_fchmod(struct vfs_handle_struct *handle, files_struct *fsp, int result; DBG_DEBUG("[CEPH] fchmod(%p, %p, %d)\n", handle, fsp, mode); - result = ceph_fchmod(handle->data, fsp_get_io_fd(fsp), mode); + if (!fsp->fsp_flags.is_pathref) { + /* + * We can use an io_fd to remove xattrs. + */ + result = ceph_fchmod(handle->data, fsp_get_io_fd(fsp), mode); + } else { + /* + * This is no longer a handle based call. + */ + result = ceph_chmod(handle->data, + fsp->fsp_name->base_name, + mode); + } DBG_DEBUG("[CEPH] fchmod(...) = %d\n", result); WRAP_RETURN(result); } -- 2.47.3