From: Anoop C S Date: Fri, 14 Mar 2025 14:17:42 +0000 (+0530) Subject: vfs_ceph_new: Add path based fallback for SMB_VFS_FCHOWN X-Git-Tag: samba-4.22.1~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=112099fb1107f39577843bb428d3efed0c25323e;p=thirdparty%2Fsamba.git 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 (cherry picked from commit abb97683902f50b2a57989f30c0fb53fd3492af9) --- diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c index 4f1849b3ed5..e85995cc2d0 100644 --- a/source3/modules/vfs_ceph_new.c +++ b/source3/modules/vfs_ceph_new.c @@ -3168,15 +3168,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);