From 526c3e04ae90a7948596aa428301ad20c7f23dca Mon Sep 17 00:00:00 2001 From: Andrew Jeddeloh Date: Thu, 24 May 2018 11:42:36 -0700 Subject: [PATCH] */docker: fix bind mount bug Fix issue where bind mounts do not start for docker 18.05.0. Backports moby/moby commit 379845ec20ae651831dcfb0587b95c38a1631a53. --- ...8.05.0.ebuild => docker-18.05.0-r1.ebuild} | 0 .../app-emulation/docker/docker-9999.ebuild | 4 +- .../docker/files/fix-bind-mount-bug2440.patch | 66 +++++++++++++++++++ .../app-torcx/docker/docker-18.05.ebuild | 2 +- 4 files changed, 70 insertions(+), 2 deletions(-) rename sdk_container/src/third_party/coreos-overlay/app-emulation/docker/{docker-18.05.0.ebuild => docker-18.05.0-r1.ebuild} (100%) create mode 100644 sdk_container/src/third_party/coreos-overlay/app-emulation/docker/files/fix-bind-mount-bug2440.patch diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-18.05.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-18.05.0-r1.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-18.05.0.ebuild rename to sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-18.05.0-r1.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild index 4e2dfc09a2..4f69a01f0a 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/docker-9999.ebuild @@ -74,7 +74,9 @@ RESTRICT="installsources strip" S="${WORKDIR}/${P}/src/${COREOS_GO_PACKAGE}" -ENGINE_PATCHES=() +ENGINE_PATCHES=( + "${FILESDIR}/fix-bind-mount-bug2440.patch" +) # see "contrib/check-config.sh" from upstream's sources CONFIG_CHECK=" diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/files/fix-bind-mount-bug2440.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/files/fix-bind-mount-bug2440.patch new file mode 100644 index 0000000000..84827600e2 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/docker/files/fix-bind-mount-bug2440.patch @@ -0,0 +1,66 @@ +From d8fd6137a1f6d95a2bcdfeb6e1dfa6b816790c5e Mon Sep 17 00:00:00 2001 +From: Kir Kolyshkin +Date: Thu, 10 May 2018 12:01:50 -0700 +Subject: [PATCH] daemon.getSourceMount(): fix for / mount point + +A recent optimization in getSourceMount() made it return an error +in case when the found mount point is "/". This prevented bind-mounted +volumes from working in such cases. + +A (rather trivial but adeqate) unit test case is added. + +Fixes: 871c957242 ("getSourceMount(): simplify") +Signed-off-by: Kir Kolyshkin +--- + daemon/oci_linux.go | 8 +------- + daemon/oci_linux_test.go | 14 ++++++++++++++ + 2 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/daemon/oci_linux.go b/daemon/oci_linux.go +index 62e7c7f1d682..766701a41683 100644 +--- a/daemon/oci_linux.go ++++ b/daemon/oci_linux.go +@@ -405,13 +405,7 @@ func getSourceMount(source string) (string, string, error) { + idx = i + } + } +- // and return it unless it's "/" +- if mi[idx].Mountpoint != "/" { +- return mi[idx].Mountpoint, mi[idx].Optional, nil +- } +- +- // If we are here, we did not find parent mount. Something is wrong. +- return "", "", fmt.Errorf("Could not find source mount of %s", source) ++ return mi[idx].Mountpoint, mi[idx].Optional, nil + } + + const ( +diff --git a/daemon/oci_linux_test.go b/daemon/oci_linux_test.go +index 5f2731b8d652..e28fac004efd 100644 +--- a/daemon/oci_linux_test.go ++++ b/daemon/oci_linux_test.go +@@ -1,6 +1,7 @@ + package daemon // import "github.com/docker/docker/daemon" + + import ( ++ "os" + "testing" + + containertypes "github.com/docker/docker/api/types/container" +@@ -86,3 +87,16 @@ func TestIpcPrivateVsReadonly(t *testing.T) { + assert.Check(t, is.Equal(false, inSlice(m.Options, "ro"))) + } + } ++ ++func TestGetSourceMount(t *testing.T) { ++ // must be able to find source mount for / ++ mnt, _, err := getSourceMount("/") ++ assert.NilError(t, err) ++ assert.Equal(t, mnt, "/") ++ ++ // must be able to find source mount for current directory ++ cwd, err := os.Getwd() ++ assert.NilError(t, err) ++ _, _, err = getSourceMount(cwd) ++ assert.NilError(t, err) ++} diff --git a/sdk_container/src/third_party/coreos-overlay/app-torcx/docker/docker-18.05.ebuild b/sdk_container/src/third_party/coreos-overlay/app-torcx/docker/docker-18.05.ebuild index 4b09ba4ea2..b4b9099253 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-torcx/docker/docker-18.05.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-torcx/docker/docker-18.05.ebuild @@ -11,7 +11,7 @@ KEYWORDS="amd64 arm64" # Explicitly list all packages that will be built into the image. RDEPEND=" - =app-emulation/docker-18.05.0 + =app-emulation/docker-18.05.0-r1 =app-emulation/containerd-1.0.3 =app-emulation/docker-proxy-0.8.0_p20180411 =app-emulation/docker-runc-1.0.0_rc5