Merge pull request #2802 from dm0-/rkt

app-emulation/rkt: Bump to 1.29.0
This commit is contained in:
David Michael 2017-10-04 13:39:24 -07:00 committed by GitHub
commit 2705dea842
4 changed files with 5 additions and 116 deletions

View File

@ -1,2 +1,2 @@
DIST rkt-pxe-amd64-usr-1235.0.0.img 243713684 SHA256 988e4ad8e044dd8bff54cb5e0a34a1ed25cf7bc8cc241f1a90e3fe7f1412f315 SHA512 b19821c63b7b53a1aad3b6e279189f9ceed1f5db1a691d12a70eb7340cceb4c3fd4f7f61a913d9482aec5ce28740b9ee777f86a1ce54f597f50341d701372542 WHIRLPOOL f3905ce3a2a55a027197a2d11ca541323fdfd560d186b4a2c39a8f45e19811067d5de4fbd3656935b12787e1dec79d118d7a01d52a8ef7abd0dad4f38a222b1c
DIST rkt-pxe-arm64-usr-1235.0.0.img 186763263 SHA256 c6effdf8fbab241cd10fdd71ab705f92b8d3ae67dcc58ec8050e00daaa58d4f5 SHA512 03ec6cb79d6175994a55f1e98fadbc584e92f095afed1612b1f64cb0fde723381eefb5ae2432de27534ba36d2debbddfd528dc7e52c5adfe32fa2b8e778100cb WHIRLPOOL 164e6ac91db0105ccb028d6498537307ab9c0b5fb51fe626ff2a4ed1ac33a2819a8be36cb95e777709d544cf5fc1d4eccfb9d73d5113c3f43bdfd727cb786bab
DIST rkt-pxe-amd64-usr-1478.0.0.img 264382497 SHA256 9897f9e78e207da42a75d03f7ff74c4400dce15843b752adcb3182ebe66c9868 SHA512 5f462b6223a141d72a38857fff26f4f70c0a36f21d1cc69623d946ba42f8b15fa994f222b1934cd16cc5b4e306cf5a8850295492dfb637f2a8fee8b774d7c1e4 WHIRLPOOL 6eed288afed99f26c892af4fdfea23bde5cb617918d34ba7132765bf11bdfc478f364b123d4c505d474740b5381b7f149dba856288ea59dbb5171782975d821b
DIST rkt-pxe-arm64-usr-1478.0.0.img 202610087 SHA256 30242967a3d86d0e0b4fc22017aea6a192b281dce97865f11e623ffca3363f11 SHA512 a91cb5fb40a522d8e624520aae9046ce5ac1756253191b704af52286af2ac29c10fa9053c4d115745125333a4b403aa792dfe16a3c3181e014505b8f8d10d147 WHIRLPOOL b2bf47ae2897c0b1e7070fa17c1dd8d4156ce0cae3136100f7efce6258f677f15470c191803ee7ee50eac53b74bfb9a5df4d1724684a12f40c47a6186520c744

View File

@ -1,109 +0,0 @@
From a778cd1b33d191e83178879cd23732f1c106a0ef Mon Sep 17 00:00:00 2001
From: Luca Bruno <lucab@debian.org>
Date: Wed, 20 Sep 2017 10:10:37 +0000
Subject: [PATCH] stage0/gc: try to avoid double overlay mounts
Before Linux 4.13, it used to be possible to perform double overlayfs
mounts in place. This now fails at mount() with EBUSY.
We were abusing this feature to unconditionally ensure that the stage1
image overlay mount was present before calling gc entrypoint.
This improves stage0 logic to perform the stage1 image overlay mount
only if it doesn't already exist.
---
rkt/gc.go | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
diff --git a/rkt/gc.go b/rkt/gc.go
index 5e025bb96..1ecdd8faf 100644
--- a/rkt/gc.go
+++ b/rkt/gc.go
@@ -26,6 +26,7 @@ import (
"github.com/hashicorp/errwrap"
"github.com/rkt/rkt/common"
+ "github.com/rkt/rkt/pkg/mountinfo"
pkgPod "github.com/rkt/rkt/pkg/pod"
"github.com/rkt/rkt/stage0"
"github.com/rkt/rkt/store/imagestore"
@@ -197,29 +198,51 @@ func emptyGarbage() error {
return nil
}
-func mountPodStage1(ts *treestore.Store, p *pkgPod.Pod) error {
+// mountPodStage1 tries to remount stage1 image overlay in case
+// it is not anymore available in place (e.g. a reboot happened
+// in-between). If an overlay mount is already there, we assume
+// stage1 image is properly in place and we don't perform any
+// further actions. A boolean is returned to signal whether a
+// a new mount was performed.
+func mountPodStage1(ts *treestore.Store, p *pkgPod.Pod) (bool, error) {
if !p.UsesOverlay() {
- return nil
+ return false, nil
}
s1Id, err := p.GetStage1TreeStoreID()
if err != nil {
- return errwrap.Wrap(errors.New("error getting stage1 treeStoreID"), err)
+ return false, errwrap.Wrap(errors.New("error getting stage1 treeStoreID"), err)
}
s1rootfs := ts.GetRootFS(s1Id)
-
stage1Dir := common.Stage1RootfsPath(p.Path())
+
+ if mounts, err := mountinfo.ParseMounts(0); err == nil {
+ for _, m := range mounts {
+ if m.MountPoint == stage1Dir {
+ // stage1 image overlay already in place
+ return false, nil
+ }
+ }
+ }
+
overlayDir := filepath.Join(p.Path(), "overlay")
imgDir := filepath.Join(overlayDir, s1Id)
upperDir := filepath.Join(imgDir, "upper")
workDir := filepath.Join(imgDir, "work")
opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", s1rootfs, upperDir, workDir)
- if err := syscall.Mount("overlay", stage1Dir, "overlay", 0, opts); err != nil {
- return errwrap.Wrap(errors.New("error mounting stage1"), err)
+ err = syscall.Mount("overlay", stage1Dir, "overlay", 0, opts)
+ if err != nil {
+ // -EBUSY means the overlay mount is already present.
+ // This behavior was introduced in Linux 4.13, double-mounts were allowed
+ // in older kernels.
+ if err == syscall.EBUSY {
+ stderr.Println("mount detected on stage1 target, skipping overlay mount")
+ return false, nil
+ }
+ return false, errwrap.Wrap(errors.New("error mounting stage1"), err)
}
-
- return nil
+ return true, nil
}
// deletePod cleans up files and resource associated with the pod
@@ -250,16 +273,15 @@ func deletePod(p *pkgPod.Pod) bool {
stage0.InitDebug()
}
- if err := mountPodStage1(ts, p); err == nil {
+ if newMount, err := mountPodStage1(ts, p); err == nil {
if err = stage0.GC(p.Path(), p.UUID, globalFlags.LocalConfigDir); err != nil {
stderr.PrintE(fmt.Sprintf("problem performing stage1 GC on %q", p.UUID), err)
}
- // an overlay fs can be mounted over itself, let's unmount it here
- // if we mounted it before to avoid problems when running
- // stage0.MountGC
- if p.UsesOverlay() {
+ // Linux <4.13 allows an overlay fs to be mounted over itself, so let's
+ // unmount it here to avoid problems when running stage0.MountGC
+ if p.UsesOverlay() && newMount {
stage1Mnt := common.Stage1RootfsPath(p.Path())
- if err := syscall.Unmount(stage1Mnt, 0); err != nil {
+ if err := syscall.Unmount(stage1Mnt, 0); err != nil && err != syscall.EBUSY {
stderr.PrintE("error unmounting stage1", err)
}
}

View File

@ -17,11 +17,11 @@ if [[ "${PV}" == "9999" ]]; then
KEYWORDS="~amd64 ~arm64"
else
KEYWORDS="amd64 arm64"
CROS_WORKON_COMMIT="3abde24bc284b7ded5784c56b4e8184c28999641" # v1.28.1
CROS_WORKON_COMMIT="6de500a70706403c8c611d80491aea64019141b0" # v1.29.0
fi
PXE_VERSION="1235.0.0"
PXE_SYSTEMD_VERSION="v231"
PXE_VERSION="1478.0.0"
PXE_SYSTEMD_VERSION="v233"
PXE_FILE="${PN}-pxe-${ARCH}-usr-${PXE_VERSION}.img"
PXE_URI_AMD64="https://alpha.release.core-os.net/amd64-usr/${PXE_VERSION}/coreos_production_pxe_image.cpio.gz"
@ -76,8 +76,6 @@ function add_stage1() {
}
src_prepare() {
epatch "${FILESDIR}/${PN}-1.28.1-avoid-double-overlay-mounts.patch"
# ensure we use a CoreOS PXE image version that matches rkt's expectations.
local rkt_coreos_version