[Devel] [libvzctl PATCH 1/2] Add "frozen" attribute to tasks kill helper
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Mon Jul 10 15:49:31 MSK 2017
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 at virtuozzo.com>
---
lib/env_nsops.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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);
More information about the Devel
mailing list