This repository was archived by the owner on Oct 13, 2023. It is now read-only.
[18.09] backport Fix mount propagation for btrfs#86
Merged
andrewhsu merged 3 commits intodocker-archive:18.09from Oct 13, 2018
Merged
[18.09] backport Fix mount propagation for btrfs#86andrewhsu merged 3 commits intodocker-archive:18.09from
andrewhsu merged 3 commits intodocker-archive:18.09from
Conversation
1. There is no need to specify rw argument -- bind mounts are read-write by default. 2. There is no point in parsing /proc/self/mountinfo after performing a mount, especially if we don't check whether the fs is mounted or not -- the only outcome from it could be an error from our mountinfo parser, which makes no sense in this context. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit f01297d)
This function ensures the argument is the mount point (i.e. if it's not, it bind mounts it to itself). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 8abadb3)
For some reason, shared mount propagation between the host
and a container does not work for btrfs, unless container
root directory (i.e. graphdriver home) is a bind mount.
The above issue was reproduced on SLES 12sp3 + btrfs using
the following script:
#!/bin/bash
set -eux -o pipefail
# DIR should not be under a subvolume
DIR=${DIR:-/lib}
MNT=$DIR/my-mnt
FILE=$MNT/file
ID=$(docker run -d --privileged -v $DIR:$DIR:rshared ubuntu sleep 24h)
docker exec $ID mkdir -p $MNT
docker exec $ID mount -t tmpfs tmpfs $MNT
docker exec $ID touch $FILE
ls -l $FILE
umount $MNT
docker rm -f $ID
which fails this way:
+ ls -l /lib/my-mnt/file
ls: cannot access '/lib/my-mnt/file': No such file or directory
meaning the mount performed inside a priviledged container is not
propagated back to the host (even if all the mounts have "shared"
propagation mode).
The remedy to the above is to make graphdriver home a bind mount.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 16d822b)
seemethere
approved these changes
Oct 12, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of moby#38026. Clean cherry-pick, no issues.