cfh->uperm);
}
+static int vfs_ceph_ll_chmod(const struct vfs_handle_struct *handle,
+ const struct vfs_ceph_iref *iref,
+ mode_t mode)
+{
+ struct ceph_statx stx = {.stx_mode = mode};
+ struct UserPerm *uperm = NULL;
+ int ret = -1;
+ struct vfs_ceph_config *config = NULL;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
+ return -ENOMEM);
+
+ DBG_DEBUG("[CEPH] ceph_ll_setattr: ino=%" PRIu64 " mode=%o\n", iref->ino, mode);
+
+ uperm = vfs_ceph_userperm_new(config, handle->conn);
+ if (uperm == NULL) {
+ return -ENOMEM;
+ }
+
+ ret = config->ceph_ll_setattr_fn(config->mount,
+ iref->inode,
+ &stx,
+ CEPH_STATX_MODE,
+ uperm);
+
+ vfs_ceph_userperm_del(config, uperm);
+ DBG_DEBUG("[CEPH] ceph_ll_setattr: ret=%d\n", ret);
+ return ret;
+}
+
static int vfs_ceph_ll_fchmod(struct vfs_handle_struct *handle,
const struct vfs_ceph_fh *cfh,
mode_t mode)
mode_t mode)
{
int result;
- struct vfs_ceph_fh *cfh = NULL;
START_PROFILE(syscall_fchmod);
DBG_DEBUG("[CEPH] fchmod(%p, %p, %d)\n", handle, fsp, mode);
- result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
- if (result != 0) {
- goto out;
- }
- result = vfs_ceph_ll_fchmod(handle, cfh, mode);
+ 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_fchmod(handle, cfh, mode);
+ } 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_chmod(handle, &iref, mode);
+ vfs_ceph_iput(handle, &iref);
+ }
out:
DBG_DEBUG("[CEPH] fchmod(...) = %d\n", result);
END_PROFILE(syscall_fchmod);