|
|
533c21 |
From e330568504ec379ea42460d21a2e20b1652d9445 Mon Sep 17 00:00:00 2001
|
|
|
533c21 |
From: Reid Wahl <nrwahl@protonmail.com>
|
|
|
533c21 |
Date: Fri, 14 Jan 2022 01:35:35 -0800
|
|
|
533c21 |
Subject: [PATCH] Fix: fencing: Don't set stonith action to pending if fork
|
|
|
533c21 |
fails
|
|
|
533c21 |
|
|
|
533c21 |
Currently, we set a stonith action to pending if
|
|
|
533c21 |
services_action_async_fork_notify() returns true. However, "true" means
|
|
|
533c21 |
that the svc_action should not be freed. This might be because the
|
|
|
533c21 |
svc_action forked successfully and is pending, or it might be because
|
|
|
533c21 |
the svc_action has already been freed.
|
|
|
533c21 |
|
|
|
533c21 |
In the case of stonith actions, if we fail to fork, the stonith_action_t
|
|
|
533c21 |
object stored in svc_action->cb_data gets freed by the done callback,
|
|
|
533c21 |
and services_action_async_fork_notify() returns true. If we try to set
|
|
|
533c21 |
the action to pending, it causes a segfault.
|
|
|
533c21 |
|
|
|
533c21 |
This commit moves the "set to pending" step to the
|
|
|
533c21 |
stonith_action_async_forked() callback. We avoid the segfault and only
|
|
|
533c21 |
set it to pending if it's actually pending.
|
|
|
533c21 |
|
|
|
533c21 |
A slight difference in ordering was required to achieve this. Now, the
|
|
|
533c21 |
action gets set to pending immediately before being added to the
|
|
|
533c21 |
mainloop, instead of immediately after.
|
|
|
533c21 |
|
|
|
533c21 |
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
|
|
533c21 |
---
|
|
|
533c21 |
lib/fencing/st_actions.c | 5 +++--
|
|
|
533c21 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
533c21 |
|
|
|
533c21 |
diff --git a/lib/fencing/st_actions.c b/lib/fencing/st_actions.c
|
|
|
533c21 |
index e4e43225cd..306001af69 100644
|
|
|
533c21 |
--- a/lib/fencing/st_actions.c
|
|
|
533c21 |
+++ b/lib/fencing/st_actions.c
|
|
|
533c21 |
@@ -550,6 +550,9 @@ stonith_action_async_forked(svc_action_t *svc_action)
|
|
|
533c21 |
(action->fork_cb) (svc_action->pid, action->userdata);
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
+ pcmk__set_result(&(action->result), PCMK_OCF_UNKNOWN, PCMK_EXEC_PENDING,
|
|
|
533c21 |
+ NULL);
|
|
|
533c21 |
+
|
|
|
533c21 |
crm_trace("Child process %d performing action '%s' successfully forked",
|
|
|
533c21 |
action->pid, action->action);
|
|
|
533c21 |
}
|
|
|
533c21 |
@@ -619,8 +622,6 @@ internal_stonith_action_execute(stonith_action_t * action)
|
|
|
533c21 |
if (services_action_async_fork_notify(svc_action,
|
|
|
533c21 |
&stonith_action_async_done,
|
|
|
533c21 |
&stonith_action_async_forked)) {
|
|
|
533c21 |
- pcmk__set_result(&(action->result), PCMK_OCF_UNKNOWN,
|
|
|
533c21 |
- PCMK_EXEC_PENDING, NULL);
|
|
|
533c21 |
return pcmk_ok;
|
|
|
533c21 |
}
|
|
|
533c21 |
|
|
|
533c21 |
--
|
|
|
533c21 |
2.27.0
|
|
|
533c21 |
|