From abb97683902f50b2a57989f30c0fb53fd3492af9 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Fri, 14 Mar 2025 19:47:42 +0530 Subject: [PATCH] vfs_ceph_new: Add path based fallback for SMB_VFS_FCHOWN Fallback mechanism was missing in vfs_ceph_fchown() for path based call. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15834 Signed-off-by: Anoop C S Reviewed-by: Guenther Deschner --- source3/modules/vfs_ceph_new.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index 4b784ea68ed..a570928d9fb 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -3163,15 +3163,33 @@ static int vfs_ceph_fchown(struct vfs_handle_struct *handle, gid_t gid) { int result; - struct vfs_ceph_fh *cfh = NULL; START_PROFILE(syscall_fchown); DBG_DEBUG("[CEPH] fchown(%p, %p, %d, %d)\n", handle, fsp, uid, gid); - result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh); - if (result != 0) { - goto out; + + if (!fsp->fsp_flags.is_pathref) { + struct vfs_ceph_fh *cfh = NULL; + + result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh); + if (result != 0) { + goto out; + } + + result = vfs_ceph_ll_fchown(handle, cfh, uid, gid); + } else { + struct vfs_ceph_iref iref = {0}; + + result = vfs_ceph_iget(handle, + fsp->fsp_name->base_name, + 0, + &iref); + if (result != 0) { + goto out; + } + + result = vfs_ceph_ll_chown(handle, &iref, uid, gid); + vfs_ceph_iput(handle, &iref); } - result = vfs_ceph_ll_fchown(handle, cfh, uid, gid); out: DBG_DEBUG("[CEPH] fchown(...) = %d\n", result); END_PROFILE(syscall_fchown); -- 2.47.2