On Fri 12-09-25 13:52:43, Christian Brauner wrote:
> Support the generic ns lookup infrastructure to support file handles for
> namespaces.
>
> Signed-off-by: Christian Brauner <brauner@kernel.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> ipc/msgutil.c | 1 +
> ipc/namespace.c | 3 +++
> ipc/shm.c | 2 ++
> 3 files changed, 6 insertions(+)
>
> diff --git a/ipc/msgutil.c b/ipc/msgutil.c
> index c7be0c792647..bbf61275df41 100644
> --- a/ipc/msgutil.c
> +++ b/ipc/msgutil.c
> @@ -15,6 +15,7 @@
> #include <linux/proc_ns.h>
> #include <linux/uaccess.h>
> #include <linux/sched.h>
> +#include <linux/nstree.h>
>
> #include "util.h"
>
> diff --git a/ipc/namespace.c b/ipc/namespace.c
> index d4188a88ee57..9f923c1a1eb3 100644
> --- a/ipc/namespace.c
> +++ b/ipc/namespace.c
> @@ -15,6 +15,7 @@
> #include <linux/mount.h>
> #include <linux/user_namespace.h>
> #include <linux/proc_ns.h>
> +#include <linux/nstree.h>
> #include <linux/sched/task.h>
>
> #include "util.h"
> @@ -85,6 +86,7 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
>
> sem_init_ns(ns);
> shm_init_ns(ns);
> + ns_tree_add(ns);
>
> return ns;
>
> @@ -201,6 +203,7 @@ void put_ipc_ns(struct ipc_namespace *ns)
> mq_clear_sbinfo(ns);
> spin_unlock(&mq_lock);
>
> + ns_tree_remove(ns);
> if (llist_add(&ns->mnt_llist, &free_ipc_list))
> schedule_work(&free_ipc_work);
> }
> diff --git a/ipc/shm.c b/ipc/shm.c
> index a9310b6dbbc3..3db36773dd10 100644
> --- a/ipc/shm.c
> +++ b/ipc/shm.c
> @@ -45,6 +45,7 @@
> #include <linux/mount.h>
> #include <linux/ipc_namespace.h>
> #include <linux/rhashtable.h>
> +#include <linux/nstree.h>
>
> #include <linux/uaccess.h>
>
> @@ -148,6 +149,7 @@ void shm_exit_ns(struct ipc_namespace *ns)
> static int __init ipc_ns_init(void)
> {
> shm_init_ns(&init_ipc_ns);
> + ns_tree_add(&init_ipc_ns);
> return 0;
> }
>
>
> --
> 2.47.3
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR