]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph_fs.h: add separate owner_{u,g}id fields 53138/head
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Thu, 3 Aug 2023 12:15:28 +0000 (14:15 +0200)
committerAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Thu, 24 Aug 2023 12:38:57 +0000 (14:38 +0200)
commit811895bd761160bca2cf0acf8ddda3d3c29fd35f
tree30ad18b287f4d563064f081d0a0d88f4a738e391
parent85d2a2eff44aa5030b6784e939b8d423e87669d4
ceph_fs.h: add separate owner_{u,g}id fields

This patch adds separate fields to pass inode owner's UID/GID
for operations which create new inodes:
CEPH_MDS_OP_CREATE, CEPH_MDS_OP_MKNOD, CEPH_MDS_OP_RENAME,
CEPH_MDS_OP_MKDIR, CEPH_MDS_OP_SYMLINK.

Before we have used caller_{u,g}id fields for two purposes:
- for MDS permission checks
- to set UID/GID for new inodes

but during a long discussion around adding idmapped mounts
support to cephfs kernel client we decided to extend wire protocol [1].

Originally, Christian Brauner pointed to this problem [2], but
a few initial versions of "ceph: support idmapped mounts" patchset
were based on a compromise between bringing idmapped mounts support
and changing on-wire data structures. The only problem with this approach
is that if we have UID/GID-based permission checks on the MDS side they
won't work as intended. Xiubo Li pointed to this issue and said that
it's critical enough to not being ignored.

This patch does not change behavior for client or MDS, because
in the current client implementation we do:
req->set_inode_owner_uid_gid(perms.uid(), perms.gid());
so, these new fields contain the same value as caller_{u,g}id.

This new extension will be used in a non-trivial way in the Linux kernel client.

[1] https://lore.kernel.org/lkml/CAEivzxcipdTQ9-b2zk-7-AMDfwPk2Brtp=X6H8xXsHMEtQJKFQ@mail.gmail.com/
[2] https://lore.kernel.org/all/20220104140414.155198-3-brauner@kernel.org/

Fixes: https://tracker.ceph.com/issues/62217
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
(cherry picked from commit 46cb244b9c8397870b99037434d627a63dcb1363)
src/client/Client.cc
src/client/MetaRequest.cc
src/client/MetaRequest.h
src/include/ceph_fs.h
src/mds/Server.cc
src/mds/cephfs_features.cc
src/mds/cephfs_features.h
src/messages/MClientRequest.h