mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #48850 from JSchltggr/fix-sed-nix-dind
Fix concurrency issue in dind
This commit is contained in:
16
hack/dind
16
hack/dind
@@ -62,10 +62,18 @@ if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
|
||||
# otherwise writing subtree_control fails with EBUSY.
|
||||
# An error during moving non-existent process (i.e., "cat") is ignored.
|
||||
mkdir -p /sys/fs/cgroup/init
|
||||
xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || :
|
||||
# enable controllers
|
||||
sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
|
||||
> /sys/fs/cgroup/cgroup.subtree_control
|
||||
# this happens in a loop because things like "docker exec" on our dind
|
||||
# container will create new processes, which creates a race between our
|
||||
# moving everything to "init" and enabling subtree_control
|
||||
while ! {
|
||||
# move the processes from the root group to the /init group,
|
||||
# otherwise writing subtree_control fails with EBUSY.
|
||||
# An error during moving non-existent process (i.e., "cat") is ignored.
|
||||
xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || :
|
||||
# enable controllers
|
||||
sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
|
||||
> /sys/fs/cgroup/cgroup.subtree_control
|
||||
}; do true; done
|
||||
fi
|
||||
|
||||
# Change mount propagation to shared to make the environment more similar to a
|
||||
|
||||
Reference in New Issue
Block a user