Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Miklos Szeredi <mszeredi@redhat.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Petr Vorel <pvorel@suse.cz>,
	linux-man <linux-man@vger.kernel.org>
Subject: Re: Setting mount propagation type in new mount API
Date: Fri, 15 May 2020 15:18:59 +0200	[thread overview]
Message-ID: <CAOssrKeDE5XKEA62Kygiis+6AVZodOzLifsaQY=eR0jAa8Z23g@mail.gmail.com> (raw)
In-Reply-To: <CAOssrKeNEdpY77xCWvPg-i4vQBoKLX3Y96gvf1kL7Pe29rmq_w@mail.gmail.com>

On Fri, May 15, 2020 at 3:04 PM Miklos Szeredi <mszeredi@redhat.com> wrote:
>
> On Fri, May 15, 2020 at 1:40 PM Michael Kerrisk (man-pages)
> <mtk.manpages@gmail.com> wrote:
> >
> > Hello David, Miklos,
> >
> > I've been looking at the new mount API (fsopen(), fsconfig(),
> > fsmount(), move_mount(), etc.) and among the details that remain
> > mysterious to me is this: how does one set the propagation type
> > (private/shared/slave/unbindable) of a new mount and change the
> > propagation type of an existing mount?
>
> Existing mount can be chaged with mount(NULL, path, NULL, MS_$(propflag), NULL).
>
> To do that with a detached mount created by fsmount(2) the
> "/proc/self/fd/$fd" trick can be used.
>
> The plan was to introduce a mount_setattr(2) syscall, but that hasn't
> happened yet...  I'm not sure we should be adding propagation flags to
> fsmount(2), since that is a less generic mechanism than
> mount_setattr(2) or just plain mount(2) as shown above.

Also note that only setting MS_SHARED makes sense on a new mount
returned by fsmount(2) because

 - MS_PRIVATE is a no op, due to mount already being private

 - same for MS_SLAVE, since it's only different from MS_PRIVATE  on
mounts receiving propagation, which a new mount by definition isn't

 - MS_UNBINDABLE just prevents move_mount(2) from working so that's
not really useful, though at least it does something

A more interesting issue is whether we'd want to control the
propagation of the target when moving into a shared tree.  I.e. should
there be a MOVE_MOUNT_DONTPROPAGATE flag for move_mount(20 that
prevents the new mount from being propagated...

Thanks,
Miklos


  reply	other threads:[~2020-05-15 13:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 11:40 Michael Kerrisk (man-pages)
2020-05-15 13:04 ` Miklos Szeredi
2020-05-15 13:18   ` Miklos Szeredi [this message]
2020-05-18 14:30 ` David Howells
2020-05-18 14:42   ` 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='CAOssrKeDE5XKEA62Kygiis+6AVZodOzLifsaQY=eR0jAa8Z23g@mail.gmail.com' \
    --to=mszeredi@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=pvorel@suse.cz \
    --subject='Re: Setting mount propagation type in new mount API' \
    /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

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).