diff mbox series

[v2,01/13] fs: export mnt_idmap_get/mnt_idmap_put

Message ID 20230524153316.476973-2-aleksandr.mikhalitsyn@canonical.com (mailing list archive)
State Changes Requested
Headers show
Series ceph: support idmapped mounts | expand

Commit Message

Aleksandr Mikhalitsyn May 24, 2023, 3:33 p.m. UTC
These helpers are required to support idmapped mounts in the Cephfs.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
---
 fs/mnt_idmapping.c            | 2 ++
 include/linux/mnt_idmapping.h | 3 +++
 2 files changed, 5 insertions(+)

Comments

Xiubo Li June 2, 2023, 1:16 a.m. UTC | #1
On 5/24/23 23:33, Alexander Mikhalitsyn wrote:
> These helpers are required to support idmapped mounts in the Cephfs.
>
> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> ---
>   fs/mnt_idmapping.c            | 2 ++
>   include/linux/mnt_idmapping.h | 3 +++
>   2 files changed, 5 insertions(+)
>
> diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c
> index 4905665c47d0..5a579e809bcf 100644
> --- a/fs/mnt_idmapping.c
> +++ b/fs/mnt_idmapping.c
> @@ -256,6 +256,7 @@ struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap)
>   
>   	return idmap;
>   }
> +EXPORT_SYMBOL(mnt_idmap_get);
>   
>   /**
>    * mnt_idmap_put - put a reference to an idmapping
> @@ -271,3 +272,4 @@ void mnt_idmap_put(struct mnt_idmap *idmap)
>   		kfree(idmap);
>   	}
>   }
> +EXPORT_SYMBOL(mnt_idmap_put);
> diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h
> index 057c89867aa2..b8da2db4ecd2 100644
> --- a/include/linux/mnt_idmapping.h
> +++ b/include/linux/mnt_idmapping.h
> @@ -115,6 +115,9 @@ static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid)
>   
>   int vfsgid_in_group_p(vfsgid_t vfsgid);
>   
> +struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap);
> +void mnt_idmap_put(struct mnt_idmap *idmap);
> +
>   vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
>   		     struct user_namespace *fs_userns, kuid_t kuid);
>   

Hi Alexander,

This needs the "fs/mnt_idmapping.c" maintainer's ack.

Thanks

- Xiubo
Aleksandr Mikhalitsyn June 2, 2023, 9:55 a.m. UTC | #2
On Fri, Jun 2, 2023 at 3:17 AM Xiubo Li <xiubli@redhat.com> wrote:
>
>
> On 5/24/23 23:33, Alexander Mikhalitsyn wrote:
> > These helpers are required to support idmapped mounts in the Cephfs.
> >
> > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> > ---
> >   fs/mnt_idmapping.c            | 2 ++
> >   include/linux/mnt_idmapping.h | 3 +++
> >   2 files changed, 5 insertions(+)
> >
> > diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c
> > index 4905665c47d0..5a579e809bcf 100644
> > --- a/fs/mnt_idmapping.c
> > +++ b/fs/mnt_idmapping.c
> > @@ -256,6 +256,7 @@ struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap)
> >
> >       return idmap;
> >   }
> > +EXPORT_SYMBOL(mnt_idmap_get);
> >
> >   /**
> >    * mnt_idmap_put - put a reference to an idmapping
> > @@ -271,3 +272,4 @@ void mnt_idmap_put(struct mnt_idmap *idmap)
> >               kfree(idmap);
> >       }
> >   }
> > +EXPORT_SYMBOL(mnt_idmap_put);
> > diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h
> > index 057c89867aa2..b8da2db4ecd2 100644
> > --- a/include/linux/mnt_idmapping.h
> > +++ b/include/linux/mnt_idmapping.h
> > @@ -115,6 +115,9 @@ static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid)
> >
> >   int vfsgid_in_group_p(vfsgid_t vfsgid);
> >
> > +struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap);
> > +void mnt_idmap_put(struct mnt_idmap *idmap);
> > +
> >   vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
> >                    struct user_namespace *fs_userns, kuid_t kuid);
> >
>
> Hi Alexander,

Hi, Xiubo!

>
> This needs the "fs/mnt_idmapping.c" maintainer's ack.

Sure, I hope that Christian will take a look.

Thanks,
Alex

>
> Thanks
>
> - Xiubo
>
Christian Brauner June 2, 2023, 12:40 p.m. UTC | #3
On Wed, May 24, 2023 at 05:33:03PM +0200, Alexander Mikhalitsyn wrote:
> These helpers are required to support idmapped mounts in the Cephfs.
> 
> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> ---

It's fine by me to export them. The explicit contract is that _nothing
and absolutely nothing_ outside of core VFS code can directly peak into
struct mnt_idmap internals. That's the only invariant we care about.o 

Reviewed-by: Christian Brauner <brauner@kernel.org>
Christoph Hellwig June 5, 2023, 1:53 p.m. UTC | #4
On Fri, Jun 02, 2023 at 02:40:27PM +0200, Christian Brauner wrote:
> On Wed, May 24, 2023 at 05:33:03PM +0200, Alexander Mikhalitsyn wrote:
> > These helpers are required to support idmapped mounts in the Cephfs.
> > 
> > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> > ---
> 
> It's fine by me to export them. The explicit contract is that _nothing
> and absolutely nothing_ outside of core VFS code can directly peak into
> struct mnt_idmap internals. That's the only invariant we care about.o 

It would be good if we could keep all these somewhat internal exports
as EXPORT_SYMBOL_GPL, though.
Aleksandr Mikhalitsyn June 5, 2023, 2:06 p.m. UTC | #5
On Mon, Jun 5, 2023 at 3:53 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Fri, Jun 02, 2023 at 02:40:27PM +0200, Christian Brauner wrote:
> > On Wed, May 24, 2023 at 05:33:03PM +0200, Alexander Mikhalitsyn wrote:
> > > These helpers are required to support idmapped mounts in the Cephfs.
> > >
> > > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> > > ---
> >
> > It's fine by me to export them. The explicit contract is that _nothing
> > and absolutely nothing_ outside of core VFS code can directly peak into
> > struct mnt_idmap internals. That's the only invariant we care about.o
>
> It would be good if we could keep all these somewhat internal exports
> as EXPORT_SYMBOL_GPL, though.

Dear Christoph,

Well noticed! Thanks, I will do it.

Kind regards,
Alex

>
diff mbox series

Patch

diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c
index 4905665c47d0..5a579e809bcf 100644
--- a/fs/mnt_idmapping.c
+++ b/fs/mnt_idmapping.c
@@ -256,6 +256,7 @@  struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap)
 
 	return idmap;
 }
+EXPORT_SYMBOL(mnt_idmap_get);
 
 /**
  * mnt_idmap_put - put a reference to an idmapping
@@ -271,3 +272,4 @@  void mnt_idmap_put(struct mnt_idmap *idmap)
 		kfree(idmap);
 	}
 }
+EXPORT_SYMBOL(mnt_idmap_put);
diff --git a/include/linux/mnt_idmapping.h b/include/linux/mnt_idmapping.h
index 057c89867aa2..b8da2db4ecd2 100644
--- a/include/linux/mnt_idmapping.h
+++ b/include/linux/mnt_idmapping.h
@@ -115,6 +115,9 @@  static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid)
 
 int vfsgid_in_group_p(vfsgid_t vfsgid);
 
+struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap);
+void mnt_idmap_put(struct mnt_idmap *idmap);
+
 vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
 		     struct user_namespace *fs_userns, kuid_t kuid);