Merge pull request #2811 from Random-Liu/lock-kill-all

Lock `KillAll`.
This commit is contained in:
Phil Estes 2018-11-20 22:36:30 +08:00 committed by GitHub
commit 1a62577719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -356,6 +356,9 @@ func (p *Init) kill(ctx context.Context, signal uint32, all bool) error {
// KillAll processes belonging to the init process // KillAll processes belonging to the init process
func (p *Init) KillAll(ctx context.Context) error { func (p *Init) KillAll(ctx context.Context) error {
p.mu.Lock()
defer p.mu.Unlock()
err := p.runtime.Kill(ctx, p.id, int(syscall.SIGKILL), &runc.KillOpts{ err := p.runtime.Kill(ctx, p.id, int(syscall.SIGKILL), &runc.KillOpts{
All: true, All: true,
}) })