[Devel,libvzctl,1/2] Add "frozen" attribute to tasks kill helper

Submitted by Stanislav Kinsburskiy on July 10, 2017, 12:49 p.m.

Details

Message ID 20170710124931.494266.27931.stgit@skinsbursky-vz7.qa.sw.ru
State New
Series "Fix container stop with spfs mount and"
Headers show

Commit Message

Stanislav Kinsburskiy July 10, 2017, 12:49 p.m.
And print kill error only if it's set.
This is a precursor patch, needed to support tasks killing in thawed
container.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 lib/env_nsops.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/env_nsops.c b/lib/env_nsops.c
index 6016868..221fad7 100644
--- a/lib/env_nsops.c
+++ b/lib/env_nsops.c
@@ -1039,7 +1039,7 @@  static int ns_env_exec_fn(struct vzctl_env_handle *h, execFn fn, void *data,
 	return 0;
 }
 
-static int ns_env_kill(struct vzctl_env_handle *h)
+static int ns_env_kill(struct vzctl_env_handle *h, int frozen)
 {
 	int ret;
 	struct vzctl_str_param *it;
@@ -1058,7 +1058,7 @@  static int ns_env_kill(struct vzctl_env_handle *h)
 		}
 
 		logger(5, 0, "kill CT process pid %lu", pid);
-		if (kill(pid, SIGKILL))
+		if (kill(pid, SIGKILL) && frozen)
 			vzctl_err(-1, errno, "Failed to kill CT pid=%lu", pid);
 	}
 
@@ -1114,7 +1114,7 @@  static int ns_env_stop_force(struct vzctl_env_handle *h)
 	if (ret)
 		goto release_sunrpc;
 
-	rc = ns_env_kill(h);
+	rc = ns_env_kill(h, 1);
 
 	/* Unfreeze unconditionally */
 	ret = cg_freezer_cmd(EID(h), VZCTL_CMD_RESUME);