Skip to content

Commit

Permalink
Merge pull request #2818 from Random-Liu/cherrypick-2811-release-1.1
Browse files Browse the repository at this point in the history
[release/1.1] Cherrypick: Lock `KillAll`.
  • Loading branch information
dmcgowan committed Nov 20, 2018
2 parents 943f15f + 4cb837a commit 5cbe42a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion linux/proc/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (p *Init) setExited(status int) {
}

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

// KillAll processes belonging to the init process
func (p *Init) KillAll(context context.Context) error {
p.mu.Lock()
defer p.mu.Unlock()
return p.killAll(context)
}

func (p *Init) killAll(context context.Context) error {
err := p.runtime.Kill(context, p.id, int(syscall.SIGKILL), &runc.KillOpts{
All: true,
})
Expand Down

0 comments on commit 5cbe42a

Please sign in to comment.