Re: [PATCH v1 4/9] fs/fuse: support idmapped getattr inode op

From: Alexander Mikhalitsyn
Date: Mon Jan 29 2024 - 10:43:57 EST


On Sat, 20 Jan 2024 16:21:08 +0100
Christian Brauner <brauner@xxxxxxxxxx> wrote:

> > int fuse_update_attributes(struct inode *inode, struct file *file, u32 mask)
> > {
> > - return fuse_update_get_attr(inode, file, NULL, mask, 0);
> > + return fuse_update_get_attr(&nop_mnt_idmap, inode, file, NULL, mask, 0);
> > }
> >
> > int fuse_reverse_inval_entry(struct fuse_conn *fc, u64 parent_nodeid,
> > @@ -1506,7 +1510,7 @@ static int fuse_perm_getattr(struct inode *inode, int mask)
> > return -ECHILD;
> >
> > forget_all_cached_acls(inode);
> > - return fuse_do_getattr(inode, NULL, NULL);
> > + return fuse_do_getattr(&nop_mnt_idmap, inode, NULL, NULL);
> > }
> >
> > /*
> > @@ -2062,7 +2066,7 @@ static int fuse_setattr(struct mnt_idmap *idmap, struct dentry *entry,
> > * ia_mode calculation may have used stale i_mode.
> > * Refresh and recalculate.
> > */
> > - ret = fuse_do_getattr(inode, NULL, file);
> > + ret = fuse_do_getattr(&nop_mnt_idmap, inode, NULL, file);
> > if (ret)
> > return ret;
>

Hi, Christian!

> These are internal getattr requests that don't originate from a specific mount?

These requests do originate from a specific mount, but we don't need an idmapping in there
because 3rd argument of fuse_do_getattr(struct mnt_idmap *idmap, struct inode *inode, struct kstat *stat, struct file *file) is NULL,
which means that this request will not fill an stat structure => we don't need to take an idmapping into account.

> Can you please add a comment about this in the commit message so it's
> clear why it's ok to not pass the idmapping?

Sure, that's my bad that I haven't added this explanation! It's not obvious at all.

Will be fixed in -v2.

Thanks,
Alex