From 5572400a975a07905f7cb0f3611590dfaf787311 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Sat, 11 Nov 2023 11:07:28 +0530 Subject: [PATCH] vfs_ceph: Add path based fallback mechanism for SMB_VFS_CHOWN Fallback mechanism was missing in cephwrap_fchown() for path based call. Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison --- source3/modules/vfs_ceph.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 4bcefcf91e8..521e8303218 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1048,7 +1048,24 @@ static int cephwrap_fchown(struct vfs_handle_struct *handle, files_struct *fsp, int result; DBG_DEBUG("[CEPH] fchown(%p, %p, %d, %d)\n", handle, fsp, uid, gid); - result = ceph_fchown(handle->data, fsp_get_io_fd(fsp), uid, gid); + if (!fsp->fsp_flags.is_pathref) { + /* + * We can use an io_fd to change ownership. + */ + result = ceph_fchown(handle->data, + fsp_get_io_fd(fsp), + uid, + gid); + } else { + /* + * This is no longer a handle based call. + */ + result = ceph_chown(handle->data, + fsp->fsp_name->base_name, + uid, + gid); + } + DBG_DEBUG("[CEPH] fchown(...) = %d\n", result); WRAP_RETURN(result); }