[Devel] [PATCH libvzctl] Suppress SUNRPC traffic on "fast stop".

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Fri Jun 23 16:42:30 MSK 2017


This is needed to break infinite loop in SUNRPC state machine, leading to
unstoppable container in case of unreachable network.

https://jira.sw.ru/browse/PSBM-67544

Note: needs kernel rh7-3.10.0-514.16.1.vz7.32.12 or newer

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

diff --git a/lib/env_nsops.c b/lib/env_nsops.c
index d62dff4..e46a1e6 100644
--- a/lib/env_nsops.c
+++ b/lib/env_nsops.c
@@ -1071,23 +1071,33 @@ static int ns_env_stop_force(struct vzctl_env_handle *h)
 {
 	int ret, rc;
 
+	ret = cg_set_param(EID(h), CG_VE, "ve.sunrpc_abort", "1");
+	if (ret)
+		return ret;
+
 	logger(0, 0, "Forcibly stop the Container...");
 
 	ret = cg_freezer_cmd(EID(h), VZCTL_CMD_FREEZE);
 	if (ret)
-		return ret;
+		goto release_sunrpc;
 
 	rc = ns_env_kill(h);
 
 	/* Unfreeze unconditionally */
 	ret = cg_freezer_cmd(EID(h), VZCTL_CMD_RESUME);
-	if (ret || rc)
-		return ret ?: rc;
+	if (ret || rc) {
+		ret = ret ?: rc;
+		goto release_sunrpc;
+	}
 
 	if (wait_env_state(h, VZCTL_ENV_STOPPED, MAX_SHTD_TM))
 		return vzctl_err(-1, 0, "Failed to stop Container:"
 				" operation timed out");
 	return 0;
+
+release_sunrpc:
+	(void) cg_set_param(EID(h), CG_VE, "ve.sunrpc_abort", "0");
+	return ret;
 }
 
 static int ns_env_cleanup(struct vzctl_env_handle *h, int flags)



More information about the Devel mailing list