From: Christian Brauner <brauner@kernel.org>
To: Eryu Guan <guan@eryu.me>
Cc: fstests@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Seth Forshee <sforshee@digitalocean.com>,
Eryu Guan <guaneryu@gmail.com>
Subject: Re: [PATCH 1/2] idmapped-mounts: add fs_allow_idmap() helper
Date: Tue, 18 Jan 2022 14:33:22 +0100 [thread overview]
Message-ID: <20220118133322.dbxytrlj6uvqgzha@wittgenstein> (raw)
In-Reply-To: <YeOkVHBnpkQRQlIR@desktop>
On Sun, Jan 16, 2022 at 12:51:32PM +0800, Eryu Guan wrote:
> On Thu, Jan 13, 2022 at 02:24:20PM +0100, Christian Brauner wrote:
> > Move the check whether the underlying filesystem supports idmapped
> > mounts into a separate helper. We will use it in the following patch to
> > make it possible to always run all tests that don't require idmapped
> > mounts.
> >
> > Cc: Seth Forshee <sforshee@digitalocean.com>
> > Cc: Eryu Guan <guaneryu@gmail.com>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: fstests@vger.kernel.org
> > Signed-off-by: Christian Brauner <brauner@kernel.org>
> > ---
> > src/idmapped-mounts/idmapped-mounts.c | 57 ++++++++++++++-------------
> > 1 file changed, 30 insertions(+), 27 deletions(-)
> >
> > diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
> > index da690779..a78a901f 100644
> > --- a/src/idmapped-mounts/idmapped-mounts.c
> > +++ b/src/idmapped-mounts/idmapped-mounts.c
> > @@ -13907,6 +13907,35 @@ static bool run_test(struct t_idmapped_mounts suite[], size_t suite_size)
> > return true;
> > }
> >
> > +static bool fs_allow_idmap(void)
> > +{
> > + int ret;
> > + int open_tree_fd = -EBADF;
> > + struct mount_attr attr = {
> > + .attr_set = MOUNT_ATTR_IDMAP,
> > + .userns_fd = -EBADF,
> > + };
> > +
> > + /* Changing mount properties on a detached mount. */
> > + attr.userns_fd = get_userns_fd(0, 1000, 1);
> > + if (attr.userns_fd < 0)
> > + exit(EXIT_FAILURE);
>
> IMHO, it'd be better to return false here and let caller decide if we
> should exit or not.
Agreed.
prev parent reply other threads:[~2022-01-18 13:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-13 13:24 [PATCH 1/2] idmapped-mounts: add fs_allow_idmap() helper Christian Brauner
2022-01-13 13:24 ` [PATCH 2/2] idmapped-mounts: always run generic vfs tests Christian Brauner
2022-01-16 4:52 ` Eryu Guan
2022-01-18 13:37 ` Christian Brauner
2022-01-18 13:40 ` Eryu Guan
2022-01-16 4:51 ` [PATCH 1/2] idmapped-mounts: add fs_allow_idmap() helper Eryu Guan
2022-01-18 13:33 ` Christian Brauner [this message]
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=20220118133322.dbxytrlj6uvqgzha@wittgenstein \
--to=brauner@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=guaneryu@gmail.com \
--cc=hch@lst.de \
--cc=sforshee@digitalocean.com \
/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