From: Vinit Agnihotri Date: Tue, 2 Jun 2026 11:15:20 +0000 (+0530) Subject: vfs_ceph_rgw: Add fchown method X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcba116db813f3b1609c91aa922ea45d54909829;p=thirdparty%2Fsamba.git vfs_ceph_rgw: Add fchown method Signed-off-by: Vinit Agnihotri Reviewed-by: Shachar Sharon Reviewed-by: Anoop C S Reviewed-by: Guenther Deschner --- diff --git a/source3/modules/vfs_ceph_rgw.c b/source3/modules/vfs_ceph_rgw.c index 64a83f866e1..f329b316fc5 100644 --- a/source3/modules/vfs_ceph_rgw.c +++ b/source3/modules/vfs_ceph_rgw.c @@ -1817,6 +1817,33 @@ out: return status_code(rc); } +static int vfs_ceph_rgw_fchown(struct vfs_handle_struct *handle, + files_struct *fsp, + uid_t uid, + gid_t gid) +{ + int rc = -ENOMEM; + uint32_t mask = RGW_SETATTR_UID | RGW_SETATTR_GID; + struct stat st = {0}; + + START_PROFILE_X(SNUM(handle->conn), syscall_fchown); + + st.st_uid = uid; + st.st_gid = gid; + rc = vfs_ceph_rgw_setattr(handle, fsp, mask, &st); + if (rc < 0) { + DBG_ERR("[CEPH_RGW] Unable to change owner. rc = %d\n", rc); + goto out; + } + +out: + DBG_DEBUG("[CEPH_RGW] fchown: fsp_name=%s result=%d\n", + fsp_str_dbg(fsp), + rc); + END_PROFILE_X(syscall_fchown); + return status_code(rc); +} + static bool vfs_ceph_rgw_mount_bucket(struct vfs_ceph_rgw_config *config) { int rc = 0; @@ -2074,7 +2101,7 @@ static struct vfs_fn_pointers ceph_rgw_fns = { .fstatat_fn = vfs_not_implemented_fstatat, .unlinkat_fn = vfs_ceph_rgw_unlinkat, .fchmod_fn = vfs_ceph_rgw_fchmod, - .fchown_fn = vfs_not_implemented_fchown, + .fchown_fn = vfs_ceph_rgw_fchown, .lchown_fn = vfs_not_implemented_lchown, .chdir_fn = vfs_ceph_rgw_chdir, .fntimes_fn = vfs_ceph_rgw_fntimes,