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

Submitted by Stanislav Kinsburskiy on June 23, 2017, 1:42 p.m.

Details

Message ID 20170623134223.959832.51726.stgit@skinsbursky-vz7.qa.sw.ru
State New
Series "Suppress SUNRPC traffic on "fast stop"."
Headers show

Commit Message

Stanislav Kinsburskiy June 23, 2017, 1:42 p.m.
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@virtuozzo.com>
---
 lib/env_nsops.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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)

Comments

Stanislav Kinsburskiy June 26, 2017, 2 p.m.
Please, drop this patch.

I'll sent next version.


23.06.2017 15:42, Stanislav Kinsburskiy пишет:
> 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@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)
>
> _______________________________________________
> Devel mailing list
> Devel@openvz.org
> https://lists.openvz.org/mailman/listinfo/devel