-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix runc kill
and runc delete
for containers with no init and no private PID namespace
#4102
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d9f2a24
libct: replace runType with hasInit
kolyshkin 542cce0
libct: Signal: slight refactor
kolyshkin dcf1b73
runc kill: fix sending KILL to non-pidns container
kolyshkin 29283bb
runc delete -f: fix for no pidns + no init case
kolyshkin d3d7f7d
libct/cg: improve cgroup removal logic
kolyshkin 7396ca9
runc delete: do not ignore error from destroy
kolyshkin ab3cd8d
runc delete, container.Destroy: kill all processes
kolyshkin a6f4081
libct: Destroy: don't proceed in case of errors
kolyshkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ func (r *runningState) status() Status { | |
func (r *runningState) transition(s containerState) error { | ||
switch s.(type) { | ||
case *stoppedState: | ||
if r.c.runType() == Running { | ||
if r.c.hasInit() { | ||
return ErrRunning | ||
} | ||
r.c.state = s | ||
|
@@ -118,7 +118,7 @@ func (r *runningState) transition(s containerState) error { | |
} | ||
|
||
func (r *runningState) destroy() error { | ||
if r.c.runType() == Running { | ||
if r.c.hasInit() { | ||
return ErrRunning | ||
} | ||
return destroy(r.c) | ||
|
@@ -170,14 +170,13 @@ func (p *pausedState) transition(s containerState) error { | |
} | ||
|
||
func (p *pausedState) destroy() error { | ||
t := p.c.runType() | ||
if t != Running && t != Created { | ||
if err := p.c.cgroupManager.Freeze(configs.Thawed); err != nil { | ||
return err | ||
} | ||
return destroy(p.c) | ||
if p.c.hasInit() { | ||
return ErrPaused | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when
|
||
} | ||
if err := p.c.cgroupManager.Freeze(configs.Thawed); err != nil { | ||
return err | ||
} | ||
return ErrPaused | ||
return destroy(p.c) | ||
} | ||
|
||
// restoredState is the same as the running state but also has associated checkpoint | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems also changed the logic about the container status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have some problems when you using runc, feel free to open an issue.