mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
nsenter: remove cgroupns sync mechanism
As pointed out in TODO item added by commit64bb59f59, it is not necessary to have a special sync mechanism for cgroupns, as the parent adds runc init to cgroup way earlier (before sending nl bootstrap data. This sync was added by commitdf3fa115f9, which was also added a second cgroup manager.Apply() call, later removed in commitd1ba8e39f8. It seems the original author had the idea to wait for that second Apply(). Fixes:df3fa115f9Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -25,10 +25,6 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Synchronisation value for cgroup namespace setup.
|
||||
// The same constant is defined in nsexec.c as "CREATECGROUPNS".
|
||||
const createCgroupns = 0x80
|
||||
|
||||
type parentProcess interface {
|
||||
// pid returns the pid for the running process.
|
||||
pid() int
|
||||
@@ -411,13 +407,6 @@ func (p *initProcess) start() (retErr error) {
|
||||
}
|
||||
p.setExternalDescriptors(fds)
|
||||
|
||||
// Now it's time to setup cgroup namesapce
|
||||
if p.config.Config.Namespaces.Contains(configs.NEWCGROUP) && p.config.Config.Namespaces.PathOf(configs.NEWCGROUP) == "" {
|
||||
if _, err := p.messageSockPair.parent.Write([]byte{createCgroupns}); err != nil {
|
||||
return fmt.Errorf("error sending synchronization value to init process: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for our first child to exit
|
||||
if err := p.waitForChildExit(childPid); err != nil {
|
||||
return fmt.Errorf("error waiting for our first child to exit: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user