From: Christian Brauner <christian.brauner@ubuntu.com>
To: David Howells <dhowells@redhat.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
Christian Brauner <christian@brauner.io>,
linux-fsdevel@vger.kernel.org, Al Viro <viro@ZenIV.linux.org.uk>,
Miklos Szeredi <miklos@szeredi.hu>
Subject: Re: Feature bug with the new mount API: no way of doing read only bind mounts
Date: Thu, 21 Nov 2019 15:54:11 +0100 [thread overview]
Message-ID: <20191121145410.lxrkxzmfioxbll37@wittgenstein> (raw)
In-Reply-To: <17268.1574323839@warthog.procyon.org.uk>
On Thu, Nov 21, 2019 at 08:10:39AM +0000, David Howells wrote:
> James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
>
> > I was looking to use the read only bind mount as a template for
> > reimplementing shiftfs when I discovered that you can't actually create a
> > read only bind mount with the new API. The problem is that fspick() will
> > only reconfigure the underlying superblock, which you don't want because you
> > only want the bound subtree to become read only and open_tree()/move_mount()
> > doesn't give you any facility to add or change options on the bind.
>
> You'd use open_tree() with OPEN_TREE_CLONE and possibly AT_RECURSIVE rather
> than fspick(). fspick() is, as you observed, more for reconfiguring the
> superblock.
>
> What is missing is a mount_setattr() syscall - something like:
>
> mount_setattr(int dfd, const char *path, unsigned int at_flags,
> unsigned int attr_change_mask, unsigned int attrs);
>
> which would allow what you want to be done like:
>
> fd = open_tree(AT_FDCWD, "/my/source/", OPEN_TREE_CLONE);
> mount_setattr(fd, "", AT_EMPTY_PATH | AT_RECURSIVE,
> MOUNT_ATTR_RDONLY, MOUNT_ATTR_RDONLY);
> move_mount(fd, "", AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);
>
> Christian: you said you wanted to have a look at doing this - is that still
> your intention?
Yes, it is. I can't put an exact time-frame on this rn.
Also, I thought we've agreed a while back that the flags would move into
a struct since mount is gaining flags quickly too. :)
Christian
next prev parent reply other threads:[~2019-11-21 14:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-21 0:11 Feature bug with the new mount API: no way of doing read only bind mounts James Bottomley
2019-11-21 8:10 ` David Howells
2019-11-21 14:54 ` Christian Brauner [this message]
2019-11-21 15:00 ` James Bottomley
2019-11-21 15:04 ` David Howells
2019-11-21 16:15 ` James Bottomley
2019-11-27 20:32 ` James Bottomley
2019-11-27 20:33 ` [RFC 1/6] logger: add a limited buffer logging facility James Bottomley
2019-11-27 20:34 ` [RFC 2/6] configfd: add generic file descriptor based configuration parser James Bottomley
2019-11-27 20:35 ` [RFC 3/6] configfd: syscall: wire up configfd syscalls James Bottomley
2019-11-27 20:36 ` [RFC 4/6] fs: implement fsconfig via configfd James Bottomley
2019-11-27 20:37 ` [RFC 5/6] fs: expose internal interfaces open_detached_copy and do_reconfigure_mount James Bottomley
2019-11-27 20:38 ` [RFC 6/6] fs: bind: add configfs type for bind mounts James Bottomley
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=20191121145410.lxrkxzmfioxbll37@wittgenstein \
--to=christian.brauner@ubuntu.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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;
as well as URLs for NNTP newsgroup(s).