From: Christian Brauner <brauner@kernel.org>
To: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Cc: mszeredi@redhat.com, linux-fsdevel@vger.kernel.org,
Miklos Szeredi <miklos@szeredi.hu>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>, Seth Forshee <sforshee@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/3] fs/mnt_idmapping: introduce an invalid_mnt_idmap
Date: Mon, 9 Sep 2024 14:57:46 +0200 [thread overview]
Message-ID: <20240909-moosbedeckt-landnahme-61cecf06e530@brauner> (raw)
In-Reply-To: <20240906143453.179506-2-aleksandr.mikhalitsyn@canonical.com>
On Fri, Sep 06, 2024 at 04:34:52PM GMT, Alexander Mikhalitsyn wrote:
> Link: https://lore.kernel.org/linux-fsdevel/20240904-baugrube-erhoben-b3c1c49a2645@brauner/
> Suggested-by: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> ---
> fs/mnt_idmapping.c | 22 ++++++++++++++++++++--
> include/linux/mnt_idmapping.h | 1 +
> 2 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c
> index 3c60f1eaca61..cbca6500848e 100644
> --- a/fs/mnt_idmapping.c
> +++ b/fs/mnt_idmapping.c
> @@ -32,6 +32,15 @@ struct mnt_idmap nop_mnt_idmap = {
> };
> EXPORT_SYMBOL_GPL(nop_mnt_idmap);
>
> +/*
> + * Carries the invalid idmapping of a full 0-4294967295 {g,u}id range.
> + * This means that all {g,u}ids are mapped to INVALID_VFS{G,U}ID.
> + */
> +struct mnt_idmap invalid_mnt_idmap = {
> + .count = REFCOUNT_INIT(1),
> +};
> +EXPORT_SYMBOL_GPL(invalid_mnt_idmap);
> +
> /**
> * initial_idmapping - check whether this is the initial mapping
> * @ns: idmapping to check
> @@ -75,6 +84,8 @@ vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
>
> if (idmap == &nop_mnt_idmap)
> return VFSUIDT_INIT(kuid);
> + if (idmap == &invalid_mnt_idmap)
> + return INVALID_VFSUID;
Could possibly deserve an:
if (unlikely(idmap == &invalid_mnt_idmap))
return INVALID_VFSUID;
and technically I guess we could also do:
if (likely(idmap == &nop_mnt_idmap))
return VFSUIDT_INIT(kuid);
but not that relevant for this patch.
next prev parent reply other threads:[~2024-09-09 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 14:34 [PATCH v1 1/3] fs/fuse: introduce and use fuse_simple_idmap_request() helper Alexander Mikhalitsyn
2024-09-06 14:34 ` [PATCH v1 2/3] fs/mnt_idmapping: introduce an invalid_mnt_idmap Alexander Mikhalitsyn
2024-09-09 12:57 ` Christian Brauner [this message]
2024-09-09 13:01 ` Christian Brauner
2024-09-09 16:09 ` Aleksandr Mikhalitsyn
2024-09-23 8:37 ` Aleksandr Mikhalitsyn
2024-09-06 14:34 ` [PATCH v1 3/3] fs/fuse: convert to use invalid_mnt_idmap Alexander Mikhalitsyn
2024-09-09 12:59 ` Christian Brauner
2024-09-09 12:55 ` [PATCH v1 1/3] fs/fuse: introduce and use fuse_simple_idmap_request() helper Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240909-moosbedeckt-landnahme-61cecf06e530@brauner \
--to=brauner@kernel.org \
--cc=aleksandr.mikhalitsyn@canonical.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi@redhat.com \
--cc=sforshee@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®