From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D33B21FF0BC for ; Mon, 16 Nov 2026 17:01:53 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3EB2421643; Mon, 16 Nov 2026 17:01:40 +0100 (CET) From: Shannon Sterz 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 Message-ID: <20261116160131.344857-5-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261116160131.344857-1-s.sterz@proxmox.com> References: <20261116160131.344857-1-s.sterz@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794844894344 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.603 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_SHORT 0.001 Use of a URL Shortener for very short URL RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 6TQLYAA34WTIA6WM2IZPNRG3ZIRNBYOD X-Message-ID-Hash: 6TQLYAA34WTIA6WM2IZPNRG3ZIRNBYOD X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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