From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH cluster 4/4] pmxcfs: dfsm: make sure error results are processed correctly
Date: Mon, 16 Nov 2026 17:01:31 +0100 [thread overview]
Message-ID: <20261116160131.344857-5-s.sterz@proxmox.com> (raw)
In-Reply-To: <20261116160131.344857-1-s.sterz@proxmox.com>
the comment in dfsm.h states that `res <= 0` is a serious error and
the group should be left. it is passed directly to
`dfsm_record_local_result()` as a `gboolean`. for the status dfsm's
deliver callback `dfsm_deliver()` this works as it only ever returns
`1` once `dfsm`, `msg` and `res_ptr` are set.
however, `dcdb_deliver()` will return `-1` on error. since there is no
validation when assigning a `gboolean` it could contain any `gint`
value, this includes `-1` [1].
`dfsm_record_local_result()` then sets the `processed` field of the
related `dfsm_result_t` struct. `-1` is truthy, so in
`dfsm_send_message_sync()` messages whose delivery callback failed
still returned `CS_OK`, because the check there is simply:
```c
return rp->processed ? CS_OK : CS_ERR_FAILED_OPERATION;
```
note that dfsm would still leave the group correctly no matter what,
since the check in `dfsm_cpg_deliver_callback()` already was `res <
0`. so `-1` was handled correctly. this is technically also a
correctness issue, though, since currently the case `res == 0` does
not leave the group as intended. luckily, neither `dfsm_deliver()` nor
`dcdb_deliver()` ever returned 0. this patch still fixes this error to
avoid issues if either callback's behavior should change in the
future.
[1]: https://docs.gtk.org/glib/types.html#gboolean
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/pmxcfs/dfsm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pmxcfs/dfsm.c b/src/pmxcfs/dfsm.c
index a5f241c..9c5f5d5 100644
--- a/src/pmxcfs/dfsm.c
+++ b/src/pmxcfs/dfsm.c
@@ -666,10 +666,10 @@ static void dfsm_cpg_deliver_callback(
);
if (nodeid == dfsm->nodeid && pid == dfsm->pid) {
- dfsm_record_local_result(dfsm, header->count, msg_res, res);
+ dfsm_record_local_result(dfsm, header->count, msg_res, res > 0);
}
- if (res < 0) {
+ if (res <= 0) {
goto leave;
}
}
--
2.47.3
next prev parent reply other threads:[~2026-11-16 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:01 [PATCH cluster 0/4] Fix 8325 and minor pmxcfs Clean-Up Shannon Sterz
2026-11-16 16:01 ` [PATCH cluster 1/4] tree wide: update copyright notice to current year Shannon Sterz
2026-11-16 16:01 ` [PATCH cluster 2/4] fix #8325: pmxcfs: dfsm: abort send if dfsm is not joined via a handle Shannon Sterz
2026-11-16 16:01 ` [PATCH cluster 3/4] pmxcfs: dfsm: wake waiters in dfsm_send_message_sync() on error mode Shannon Sterz
2026-11-16 16:01 ` Shannon Sterz [this message]
2026-11-17 1:32 ` applied: [PATCH cluster 0/4] Fix 8325 and minor pmxcfs Clean-Up Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116160131.344857-5-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.