Skip to content

Commit 5cbe42a

Browse files
authored
Merge pull request #2818 from Random-Liu/cherrypick-2811-release-1.1
[release/1.1] Cherrypick: Lock `KillAll`.
2 parents 943f15f + 4cb837a commit 5cbe42a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

linux/proc/init.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func (p *Init) setExited(status int) {
290290
}
291291

292292
func (p *Init) delete(context context.Context) error {
293-
p.KillAll(context)
293+
p.killAll(context)
294294
p.wg.Wait()
295295
err := p.runtime.Delete(context, p.id, nil)
296296
// ignore errors if a runtime has already deleted the process
@@ -346,6 +346,12 @@ func (p *Init) kill(context context.Context, signal uint32, all bool) error {
346346

347347
// KillAll processes belonging to the init process
348348
func (p *Init) KillAll(context context.Context) error {
349+
p.mu.Lock()
350+
defer p.mu.Unlock()
351+
return p.killAll(context)
352+
}
353+
354+
func (p *Init) killAll(context context.Context) error {
349355
err := p.runtime.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{
350356
All: true,
351357
})

0 commit comments

Comments
 (0)