Skip to content

Change mount point propogation to default to slave - #12273

Closed
rhatdan wants to merge 2 commits into
moby:masterfrom
rhatdan:devicemapperslave
Closed

rhatdan wants to merge 2 commits into
moby:masterfrom
rhatdan:devicemapperslave

Conversation

@rhatdan

@rhatdan rhatdan commented Apr 10, 2015

Copy link
Copy Markdown
Contributor

As an admin I would expect that if I volume mount a partition into a container, and then later add a mount point to the volume, it will show up in the container.

Docker-DCO-1.1-Signed-off-by: Dan Walsh [email protected] (github: rhatdan)

@rhatdan

rhatdan commented Apr 10, 2015

Copy link
Copy Markdown
Contributor Author

@alexlarsson Do you remember why we went with the default of MS_PRIVATE instead of MS_SLAVE?

As an admin I would expect that if I volume mount a partition into a container, and then later add a mount point to the volume, it will show up in the container.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <[email protected]> (github: rhatdan)
@rhatdan
rhatdan force-pushed the devicemapperslave branch from 0bdd630 to 842b849 Compare April 13, 2015 12:28
@alexlarsson

Copy link
Copy Markdown
Contributor

Wasn't the whole point of making this private to avoid performance issues with propagating mounts into this namespace due to the kernel being shit? I'm not 100% sure here, but this may be causing a performance regression wrt that.

@unclejack

Copy link
Copy Markdown
Contributor

There's an issue related to this performance problem: #2891

@alexlarsson

Copy link
Copy Markdown
Contributor

I think the issue was that if you have a 1000 containers running. Then when you start a new one it will create a new mount in the global namespace. This will propagate into all the running containers, as it may possibly be wanted there. However, in practice /var/docker is not available in those containers so the propagation is a no-op. However, the kernel code for this was pretty dumb, so it only noticed it was a no-op after a lot of work (O(n) in the number of mounts i think) had been done, and this for each sub-namespace.

The end result was that to start a container we did O(n^2) work (n==number of running containers). So starting n new containers was O(n^3), and really slow. Marking the devicemapper mound directory private avoided the dumbness above by avoiding propagation early in the operation.

However, I question the above patch. Yes, the root of the container is MS_PRIVATE, but that does not necessarily hold for a volume that has been bind-mounted into the container. That bind mount should be MS_SLAVE.
I doubt the sysadmin is going to mount things inside "/var/docker/devmapper/...".

@rhatdan

rhatdan commented Apr 15, 2015

Copy link
Copy Markdown
Contributor Author

I guess I have two questions, should we optimize for the 1000s of containers use case versus the common 10's of containers use case. Not having mount propogation into a container, is very confusing.
Now if we could get just the Volumes mounted into the container to propogate and not /var/lib/docker/devicemapper would that solve the problem?

@unclejack

Copy link
Copy Markdown
Contributor

@rhatdan There are certainly Docker users and Docker deployments out there which require thousands of containers. I know there are people who are having problems because of the 1024 ports limit for the default Linux bridge.

@rhatdan

rhatdan commented Apr 15, 2015

Copy link
Copy Markdown
Contributor Author

@unclejack Understood, (openshift) for one. We need a mechanism to change the default behaviour preferable though the daemon or via docker run commands.

@alexlarsson

Copy link
Copy Markdown
Contributor

@rhatdan I don't necessarily disagree, but I don't see how the /var/lib/docker/devicemapper directory being private has to do with the volumes not being propagated. Surely the volume bind-mounts themselves are mounted as slave, and it should not matter that the root of the container is private?

@rhatdan

rhatdan commented Apr 16, 2015

Copy link
Copy Markdown
Contributor Author

I don't believe we do this now. What I was seeing even in a privileged container, was when I run

docker run -ti -v /usr:/usr fedora /bin/sh

mount --make-rslave /usr

Outside container
mount -o bind /tmp /usr/share

/usr/share would still not propagate.

When I changed libcontainer to mount "/" SLAVE and the /var/lib/docker/devmapper to SLAVE, it worked.

Propogation was failing with devmapper mounted SLAVE but libcontainer "/" mounted PRIVATE.

It only worked when "/" was also mounted SLAVE.

I have not tried again with with /var/lib/devmapper as PRIVATE.

@alexlarsson

Copy link
Copy Markdown
Contributor

Can you try "/" as slave and devmapper as private? Having devmapper as private is what fixed the performance issue i think.

@rhatdan

rhatdan commented Apr 16, 2015

Copy link
Copy Markdown
Contributor Author

Ok just tried an experiment with just the /var/lib/docker/devmapper mounted PRIVATE and it still worked.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <[email protected]> (github: rhatdan)
@rhatdan

rhatdan commented Apr 16, 2015

Copy link
Copy Markdown
Contributor Author

We are cutting a build with this change and will have performance team check if there is any performance degradation. thanks @alexlarsson

@icecrime icecrime removed the dco/yes label Apr 23, 2015
@LK4D4

LK4D4 commented May 5, 2015

Copy link
Copy Markdown
Contributor

@rhatdan Any news from your performance team?

@rhatdan

rhatdan commented May 7, 2015

Copy link
Copy Markdown
Contributor Author

They found no difference, I believe. @jerms can you confirm.

@cpuguy83

Copy link
Copy Markdown
Member

ping what do we want to do with this?

@rhatdan

rhatdan commented May 24, 2015

Copy link
Copy Markdown
Contributor Author

I think the libcontainer changes which got merged were all we needed. I will close this for now, and reopen if I find any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants