Re: [PATCH v2 10/13] ceph: allow idmapped setattr inode op

From: Christian Brauner
Date: Fri Jun 02 2023 - 09:08:44 EST


On Fri, Jun 02, 2023 at 03:05:50PM +0200, Aleksandr Mikhalitsyn wrote:
> On Fri, Jun 2, 2023 at 2:54 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
> >
> > On Fri, Jun 02, 2023 at 02:45:30PM +0200, Aleksandr Mikhalitsyn wrote:
> > > On Fri, Jun 2, 2023 at 3:30 AM Xiubo Li <xiubli@xxxxxxxxxx> wrote:
> > > >
> > > >
> > > > On 5/24/23 23:33, Alexander Mikhalitsyn wrote:
> > > > > From: Christian Brauner <christian.brauner@xxxxxxxxxx>
> > > > >
> > > > > Enable __ceph_setattr() to handle idmapped mounts. This is just a matter
> > > > > of passing down the mount's idmapping.
> > > > >
> > > > > Cc: Jeff Layton <jlayton@xxxxxxxxxx>
> > > > > Cc: Ilya Dryomov <idryomov@xxxxxxxxx>
> > > > > Cc: ceph-devel@xxxxxxxxxxxxxxx
> > > > > Signed-off-by: Christian Brauner <christian.brauner@xxxxxxxxxx>
> > > > > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>
> > > > > ---
> > > > > fs/ceph/inode.c | 11 +++++++++--
> > > > > 1 file changed, 9 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> > > > > index 37e1cbfc7c89..f1f934439be0 100644
> > > > > --- a/fs/ceph/inode.c
> > > > > +++ b/fs/ceph/inode.c
> > > > > @@ -2050,6 +2050,13 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
> > > > >
> > > > > dout("setattr %p issued %s\n", inode, ceph_cap_string(issued));
> > > > >
> > > > > + /*
> > > > > + * The attr->ia_{g,u}id members contain the target {g,u}id we're
> >
> > This is now obsolete... In earlier imlementations attr->ia_{g,u}id was
> > used and contained the filesystem wide value, not the idmapped mount
> > value.
> >
> > However, this was misleading and we changed that in commit b27c82e12965
> > ("attr: port attribute changes to new types") and introduced dedicated
> > new types into struct iattr->ia_vfs{g,u}id. So the you need to use
> > attr->ia_vfs{g,u}id as documented in include/linux/fs.h and you need to
> > transform them into filesystem wide values and then to raw values you
> > send over the wire.
> >
> > Alex should be able to figure this out though.
>
> Hi Christian,
>
> Thanks for pointing this out. Unfortunately I wasn't able to notice
> that. I'll take a look closer and fix that.

Just to clarify: I wasn't trying to imply that you should've figured
this out on your own. I was just trying to say that you should be able
figure out the exact details how to implement this in ceph after I told
you about the attr->ia_vfs{g,u}id change.