Blame SOURCES/bz1809864-1-votequorum-Change-check-of-expected_votes.patch

354091
From 0c16442f2d93f32a229b87d2672e2dc8025ec704 Mon Sep 17 00:00:00 2001
354091
From: Jan Friesse <jfriesse@redhat.com>
354091
Date: Wed, 4 Mar 2020 11:42:15 +0100
354091
Subject: [PATCH] votequorum: Change check of expected_votes
354091
354091
Previously value of new expected_votes was checked so newly computed
354091
quorum value was in the interval <total_votes / 2, total_votes>. The
354091
upper range prevented the cluster to become unquorate, but bottom check
354091
was almost useless because it allowed to change expected_votes so it is
354091
smaller than total_votes.
354091
354091
Solution is to check if expected_votes is bigger or equal to total_votes
354091
and for quorate cluster only check if cluster doesn't become unquorate
354091
(for unquorate cluster one can set upper range freely - as it is
354091
perfectly possible when using config file)
354091
354091
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
354091
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
354091
---
354091
 exec/votequorum.c | 10 +++++++---
354091
 1 file changed, 7 insertions(+), 3 deletions(-)
354091
354091
diff --git a/exec/votequorum.c b/exec/votequorum.c
354091
index 52424fa..b152425 100644
354091
--- a/exec/votequorum.c
354091
+++ b/exec/votequorum.c
354091
@@ -1,5 +1,5 @@
354091
 /*
354091
- * Copyright (c) 2009-2015 Red Hat, Inc.
354091
+ * Copyright (c) 2009-2020 Red Hat, Inc.
354091
  *
354091
  * All rights reserved.
354091
  *
354091
@@ -2688,8 +2688,12 @@ static void message_handler_req_lib_votequorum_setexpected (void *conn, const vo
354091
 	 */
354091
 	newquorum = calculate_quorum(1, req_lib_votequorum_setexpected->expected_votes, &total_votes);
354091
 	allow_downscale = allow_downscale_status;
354091
-	if (newquorum < total_votes / 2 ||
354091
-	    newquorum > total_votes) {
354091
+	/*
354091
+	 * Setting expected_votes < total_votes doesn't make sense.
354091
+	 * For quorate cluster prevent cluster to become unquorate.
354091
+	 */
354091
+	if (req_lib_votequorum_setexpected->expected_votes < total_votes ||
354091
+	    (cluster_is_quorate && (newquorum > total_votes))) {
354091
 		error = CS_ERR_INVALID_PARAM;
354091
 		goto error_exit;
354091
 	}
354091
-- 
354091
1.8.3.1
354091