[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts
From: |
Vivek Goyal |
Subject: |
Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts |
Date: |
Wed, 29 Apr 2020 08:41:29 -0400 |
On Wed, Apr 29, 2020 at 08:34:24AM -0400, Vivek Goyal wrote:
> On Wed, Apr 29, 2020 at 11:26:49AM +0200, Miklos Szeredi wrote:
> > On Wed, Apr 29, 2020 at 9:59 AM Miklos Szeredi <address@hidden> wrote:
> > >
> > > On Tue, Apr 28, 2020 at 9:15 PM Dr. David Alan Gilbert
> > > <address@hidden> wrote:
> > >
> > > > So our current sequence is:
> > > >
> > > > (new namespace)
> > > > 1) if (mount(NULL, "/", NULL, MS_REC | MS_SLAVE, NULL) < 0) {
> > > > 2) if (mount("proc", "/proc", "proc",
> > > > ....
> > > > 3) if (mount(source, source, NULL, MS_BIND | MS_REC, NULL) < 0) {
> > > > 4) (chdir newroot, pivot, chdir oldroot)
> > > > 5) if (mount("", ".", "", MS_SLAVE | MS_REC, NULL) < 0) {
> > > > 6) if (umount2(".", MNT_DETACH) < 0) {
> > > >
> > > > So are you saying we need a:
> > > > if (mount(NULL, "/", NULL, MS_REC | MS_SHARED, NULL) < 0) {
> > > >
> > > > and can this go straight after (1) ?
> > >
> > > Or right before (3). Important thing is that that new mount will
> > > only receive propagation if the type of the mount at source (before
> > > (3) is performed) is shared.
> >
> > And seems I was wrong. Bind mounting clones the slave property, hence
> > no need to set MS_SHARED. I.e. if the source was a slave, the bind
> > mount will be a slave to the same master as well; the two slaves won't
> > receive propagation between each other, but both will receive
> > propagation from the master.
>
> Agreed. I was playing with it yesterday and noticed the same thing. Wanted
> to test more before I said anything
>
> Anyway, I did following.
>
> $ mkdir /tmp/a /tmp/a/c /tmp/b
> $ mount --bind /tmp/a /tmp/a
>
> $ findmnt -o +PROPAGATION /tmp/a
> TARGET SOURCE FSTYPE OPTIONS PROPAGATION
> /tmp/a tmpfs[/a] tmpfs rw,nosuid,nodev,seclabel shared
A note, this is "shared" by default becase parent mount ("/") is "shared"
by default due to systemd settings. Some distributions make "/" private
instead and in that case, new mount namespace will not be "slave" and
will not receive propagation events.
In that case we will have to document to bind mount source directory
with "shared" propagation so that mounts done later on host can
propagate into virtiofsd namespace.
Thanks
Vivek
- Re: [PATCH] virtiofsd: Show submounts, (continued)
Re: [PATCH] virtiofsd: Show submounts, Daniel P . Berrangé, 2020/04/28
Re: [PATCH] virtiofsd: Show submounts, Stefan Hajnoczi, 2020/04/28
- Re: [PATCH] virtiofsd: Show submounts, Daniel P . Berrangé, 2020/04/28
- Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Miklos Szeredi, 2020/04/28
- Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Dr. David Alan Gilbert, 2020/04/28
- Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Miklos Szeredi, 2020/04/29
- Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Miklos Szeredi, 2020/04/29
- Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Vivek Goyal, 2020/04/29
- Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts,
Vivek Goyal <=
Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Max Reitz, 2020/04/29
Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Miklos Szeredi, 2020/04/29
Re: [Virtio-fs] [PATCH] virtiofsd: Show submounts, Max Reitz, 2020/04/29
Re: [PATCH] virtiofsd: Show submounts, Dr. David Alan Gilbert, 2020/04/29
- Re: [PATCH] virtiofsd: Show submounts, Vivek Goyal, 2020/04/29
- Re: [PATCH] virtiofsd: Show submounts, Max Reitz, 2020/04/30
- Re: [PATCH] virtiofsd: Show submounts, Dr. David Alan Gilbert, 2020/04/30
- Re: [PATCH] virtiofsd: Show submounts, Max Reitz, 2020/04/30
- Re: [PATCH] virtiofsd: Show submounts, Max Reitz, 2020/04/30
Re: [PATCH] virtiofsd: Show submounts, Vivek Goyal, 2020/04/30