Commit 3eb10e86 authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import corosync-3.0.3-4.el8

parents
dea662d9ae9a624196e3f116a29cece2eb979616 SOURCES/corosync-3.0.3.tar.gz
87cb5c01333298d106fc0022f5ac855205da0ae6 SOURCES/spausedd-20190807.tar.gz
SOURCES/corosync-3.0.3.tar.gz
SOURCES/spausedd-20190807.tar.gz
From cddd62f972bca276c934e58f08da84071cec1ddb Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Mon, 25 Nov 2019 18:21:52 +0100
Subject: [PATCH] votequorum: Ignore the icmap_get_* return value
Express intention to ignore icmap_get_* return
value and rely on default behavior of not changing the output
parameter on error.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
---
exec/votequorum.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/exec/votequorum.c b/exec/votequorum.c
index f78b3f9..e1d7e73 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -1271,10 +1271,10 @@ static char *votequorum_readconfig(int runtime)
/*
* gather basic data here
*/
- icmap_get_uint32("quorum.expected_votes", &expected_votes);
+ (void)icmap_get_uint32("quorum.expected_votes", &expected_votes);
have_nodelist = votequorum_read_nodelist_configuration(&node_votes, &node_count, &node_expected_votes);
have_qdevice = votequorum_qdevice_is_configured(&qdevice_votes);
- icmap_get_uint8("quorum.two_node", &two_node);
+ (void)icmap_get_uint8("quorum.two_node", &two_node);
/*
* do config verification and enablement
@@ -1319,13 +1319,13 @@ static char *votequorum_readconfig(int runtime)
wait_for_all = 1;
}
- icmap_get_uint8("quorum.allow_downscale", &allow_downscale);
- icmap_get_uint8("quorum.wait_for_all", &wait_for_all);
- icmap_get_uint8("quorum.last_man_standing", &last_man_standing);
- icmap_get_uint32("quorum.last_man_standing_window", &last_man_standing_window);
- icmap_get_uint8("quorum.expected_votes_tracking", &ev_tracking);
- icmap_get_uint8("quorum.auto_tie_breaker", &atb);
- icmap_get_string("quorum.auto_tie_breaker_node", &atb_string);
+ (void)icmap_get_uint8("quorum.allow_downscale", &allow_downscale);
+ (void)icmap_get_uint8("quorum.wait_for_all", &wait_for_all);
+ (void)icmap_get_uint8("quorum.last_man_standing", &last_man_standing);
+ (void)icmap_get_uint32("quorum.last_man_standing_window", &last_man_standing_window);
+ (void)icmap_get_uint8("quorum.expected_votes_tracking", &ev_tracking);
+ (void)icmap_get_uint8("quorum.auto_tie_breaker", &atb);
+ (void)icmap_get_string("quorum.auto_tie_breaker_node", &atb_string);
/* auto_tie_breaker defaults to LOWEST */
if (atb) {
@@ -1517,7 +1517,7 @@ static char *votequorum_readconfig(int runtime)
us->expected_votes = node_expected_votes;
} else {
us->votes = 1;
- icmap_get_uint32("quorum.votes", &us->votes);
+ (void)icmap_get_uint32("quorum.votes", &us->votes);
}
if (expected_votes) {
@@ -1568,7 +1568,7 @@ static void votequorum_refresh_config(
return ;
}
- icmap_get_uint8("quorum.cancel_wait_for_all", &cancel_wfa);
+ (void)icmap_get_uint8("quorum.cancel_wait_for_all", &cancel_wfa);
if (strcmp(key_name, "quorum.cancel_wait_for_all") == 0 &&
cancel_wfa >= 1) {
icmap_set_uint8("quorum.cancel_wait_for_all", 0);
--
1.8.3.1
From 8ce65bf951bc1e5b2d64b60ea027fbdc551d4fc8 Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Thu, 16 Jan 2020 15:43:59 +0100
Subject: [PATCH] votequorum: Reflect runtime change of 2Node to WFA
When 2Node mode is set, WFA is also set unless WFA is configured
explicitly. This behavior was not reflected on runtime change, so
restarted corosync behavior was different (WFA not set). Also when
cluster is reduced from 3 nodes to 2 nodes during runtime, WFA was not
set, what may result in two quorate partitions.
Solution is to set WFA depending on 2Node when WFA
is not explicitly configured.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
exec/votequorum.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/exec/votequorum.c b/exec/votequorum.c
index 0cde8f8..52424fa 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -80,6 +80,7 @@ static uint8_t two_node = 0;
static uint8_t wait_for_all = 0;
static uint8_t wait_for_all_status = 0;
+static uint8_t wait_for_all_autoset = 0; /* Wait for all is not set explicitly and follows two_node */
static enum {ATB_NONE, ATB_LOWEST, ATB_HIGHEST, ATB_LIST} auto_tie_breaker = ATB_NONE, initial_auto_tie_breaker = ATB_NONE;
static int lowest_node_id = -1;
@@ -1315,12 +1316,10 @@ static char *votequorum_readconfig(int runtime)
* Enable special features
*/
if (!runtime) {
- if (two_node) {
- wait_for_all = 1;
- }
-
(void)icmap_get_uint8("quorum.allow_downscale", &allow_downscale);
- (void)icmap_get_uint8("quorum.wait_for_all", &wait_for_all);
+ if (icmap_get_uint8("quorum.wait_for_all", &wait_for_all) != CS_OK) {
+ wait_for_all_autoset = 1;
+ }
(void)icmap_get_uint8("quorum.last_man_standing", &last_man_standing);
(void)icmap_get_uint32("quorum.last_man_standing_window", &last_man_standing_window);
(void)icmap_get_uint8("quorum.expected_votes_tracking", &ev_tracking);
@@ -1361,6 +1360,15 @@ static char *votequorum_readconfig(int runtime)
}
+ /*
+ * Changing of wait_for_all during runtime is not supported, but changing of two_node is
+ * and two_node may set wfa if not configured explicitly. It is safe to unset it
+ * (or set it back) when two_node changes.
+ */
+ if (wait_for_all_autoset) {
+ wait_for_all = two_node;
+ }
+
/* two_node and auto_tie_breaker are not compatible as two_node uses
* a fence race to decide quorum whereas ATB decides based on node id
*/
@@ -1540,6 +1548,12 @@ static char *votequorum_readconfig(int runtime)
update_two_node();
if (wait_for_all) {
update_wait_for_all_status(1);
+ } else if (wait_for_all_autoset && wait_for_all_status) {
+ /*
+ * Reset wait for all status for consistency when wfa is auto-unset by 2node.
+ * wait_for_all_status would be ignored by are_we_quorate anyway.
+ */
+ update_wait_for_all_status(0);
}
out:
--
1.8.3.1
From 48b6894ef41e9a06ccbb696d062d86ef60dc2c4b Mon Sep 17 00:00:00 2001
From: Christine Caulfield <ccaulfie@redhat.com>
Date: Fri, 17 Jan 2020 14:22:16 +0000
Subject: [PATCH] stats: Add stats for scheduler misses
This patch add a stats.schedmiss.* set of entries that
are a record of the last 10 times corosync was not scheduled
in time.
These entries are keypt in reverse order (so stats.schedmiss.0.* is
always the latest one kept) and the values, including the timestamp,
are in milliseconds.
It's also possible to use a cmap tracker to follow these events, which
might be useful.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
---
exec/main.c | 2 +
exec/stats.c | 113 +++++++++++++++++++++++++++++++++++++++++++----
exec/stats.h | 2 +
man/cmap_keys.7 | 26 ++++++++++-
tools/corosync-cmapctl.c | 5 ++-
5 files changed, 136 insertions(+), 12 deletions(-)
diff --git a/exec/main.c b/exec/main.c
index 7a471a1..fb0486e 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -835,6 +835,8 @@ static void timer_function_scheduler_timeout (void *data)
log_printf (LOGSYS_LEVEL_WARNING, "Corosync main process was not scheduled for %0.4f ms "
"(threshold is %0.4f ms). Consider token timeout increase.",
(float)tv_diff / QB_TIME_NS_IN_MSEC, (float)timeout_data->max_tv_diff / QB_TIME_NS_IN_MSEC);
+
+ stats_add_schedmiss_event(tv_current / 1000, (float)tv_diff / QB_TIME_NS_IN_MSEC);
}
/*
diff --git a/exec/stats.c b/exec/stats.c
index e89504e..d5c1cbc 100644
--- a/exec/stats.c
+++ b/exec/stats.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Red Hat, Inc.
+ * Copyright (c) 2017-2020 Red Hat, Inc.
*
* All rights reserved.
*
@@ -60,9 +60,20 @@ LOGSYS_DECLARE_SUBSYS ("STATS");
static qb_map_t *stats_map;
+/* Structure of an element in the schedmiss array */
+struct schedmiss_entry {
+ uint64_t timestamp;
+ float delay;
+};
+#define MAX_SCHEDMISS_EVENTS 10
+static struct schedmiss_entry schedmiss_event[MAX_SCHEDMISS_EVENTS];
+static unsigned int highest_schedmiss_event;
+
+#define SCHEDMISS_PREFIX "stats.schedmiss"
+
/* Convert iterator number to text and a stats pointer */
struct cs_stats_conv {
- enum {STAT_PG, STAT_SRP, STAT_KNET, STAT_KNET_HANDLE, STAT_IPCSC, STAT_IPCSG} type;
+ enum {STAT_PG, STAT_SRP, STAT_KNET, STAT_KNET_HANDLE, STAT_IPCSC, STAT_IPCSG, STAT_SCHEDMISS} type;
const char *name;
const size_t offset;
const icmap_value_types_t value_type;
@@ -190,6 +201,10 @@ struct cs_stats_conv cs_ipcs_global_stats[] = {
{ STAT_IPCSG, "global.active", offsetof(struct ipcs_global_stats, active), ICMAP_VALUETYPE_UINT64},
{ STAT_IPCSG, "global.closed", offsetof(struct ipcs_global_stats, closed), ICMAP_VALUETYPE_UINT64},
};
+struct cs_stats_conv cs_schedmiss_stats[] = {
+ { STAT_SCHEDMISS, "timestamp", offsetof(struct schedmiss_entry, timestamp), ICMAP_VALUETYPE_UINT64},
+ { STAT_SCHEDMISS, "delay", offsetof(struct schedmiss_entry, delay), ICMAP_VALUETYPE_FLOAT},
+};
#define NUM_PG_STATS (sizeof(cs_pg_stats) / sizeof(struct cs_stats_conv))
#define NUM_SRP_STATS (sizeof(cs_srp_stats) / sizeof(struct cs_stats_conv))
@@ -286,7 +301,7 @@ cs_error_t stats_map_init(const struct corosync_api_v1 *corosync_api)
stats_add_entry(param, &cs_ipcs_global_stats[i]);
}
- /* KNET and IPCS stats are added when appropriate */
+ /* KNET, IPCS & SCHEDMISS stats are added when appropriate */
return CS_OK;
}
@@ -307,6 +322,8 @@ cs_error_t stats_map_get(const char *key_name,
int link_no;
int service_id;
uint32_t pid;
+ unsigned int sm_event;
+ char *sm_type;
void *conn_ptr;
item = qb_map_get(stats_map, key_name);
@@ -363,17 +380,85 @@ cs_error_t stats_map_get(const char *key_name,
cs_ipcs_get_global_stats(&ipcs_global_stats);
stats_map_set_value(statinfo, &ipcs_global_stats, value, value_len, type);
break;
+ case STAT_SCHEDMISS:
+ if (sscanf(key_name, SCHEDMISS_PREFIX ".%d", &sm_event) != 1) {
+ return CS_ERR_NOT_EXIST;
+ }
+
+ sm_type = strrchr(key_name, '.');
+ if (sm_type == NULL) {
+ return CS_ERR_NOT_EXIST;
+ }
+ sm_type++;
+
+ if (strcmp(sm_type, "timestamp") == 0) {
+ memcpy(value, &schedmiss_event[sm_event].timestamp, sizeof(uint64_t));
+ *value_len = sizeof(uint64_t);
+ *type = ICMAP_VALUETYPE_UINT64;
+ }
+ if (strcmp(sm_type, "delay") == 0) {
+ memcpy(value, &schedmiss_event[sm_event].delay, sizeof(float));
+ *value_len = sizeof(float);
+ *type = ICMAP_VALUETYPE_FLOAT;
+ }
+ break;
default:
return CS_ERR_LIBRARY;
}
return CS_OK;
}
-#define STATS_CLEAR "stats.clear."
-#define STATS_CLEAR_KNET "stats.clear.knet"
-#define STATS_CLEAR_IPC "stats.clear.ipc"
-#define STATS_CLEAR_TOTEM "stats.clear.totem"
-#define STATS_CLEAR_ALL "stats.clear.all"
+static void schedmiss_clear_stats(void)
+{
+ int i;
+ char param[ICMAP_KEYNAME_MAXLEN];
+
+ for (i=0; i<MAX_SCHEDMISS_EVENTS; i++) {
+ if (i < highest_schedmiss_event) {
+ sprintf(param, SCHEDMISS_PREFIX ".%i.timestamp", i);
+ stats_rm_entry(param);
+ sprintf(param, SCHEDMISS_PREFIX ".%i.delay", i);
+ stats_rm_entry(param);
+ }
+ schedmiss_event[i].timestamp = (uint64_t)0LL;
+ schedmiss_event[i].delay = 0.0f;
+ }
+ highest_schedmiss_event = 0;
+}
+
+/* Called from main.c */
+void stats_add_schedmiss_event(uint64_t timestamp, float delay)
+{
+ char param[ICMAP_KEYNAME_MAXLEN];
+ int i;
+
+ /* Move 'em all up */
+ for (i=MAX_SCHEDMISS_EVENTS-2; i>=0; i--) {
+ schedmiss_event[i+1].timestamp = schedmiss_event[i].timestamp;
+ schedmiss_event[i+1].delay = schedmiss_event[i].delay;
+ }
+
+ /* New entries are always at the front */
+ schedmiss_event[0].timestamp = timestamp;
+ schedmiss_event[0].delay = delay;
+
+ /* If we've not run off the end then add an entry in the trie for the new 'end' one */
+ if (highest_schedmiss_event < MAX_SCHEDMISS_EVENTS) {
+ sprintf(param, SCHEDMISS_PREFIX ".%i.timestamp", highest_schedmiss_event);
+ stats_add_entry(param, &cs_schedmiss_stats[0]);
+ sprintf(param, SCHEDMISS_PREFIX ".%i.delay", highest_schedmiss_event);
+ stats_add_entry(param, &cs_schedmiss_stats[1]);
+ highest_schedmiss_event++;
+ }
+ /* Notifications get sent by the stats_updater */
+}
+
+#define STATS_CLEAR "stats.clear."
+#define STATS_CLEAR_KNET "stats.clear.knet"
+#define STATS_CLEAR_IPC "stats.clear.ipc"
+#define STATS_CLEAR_TOTEM "stats.clear.totem"
+#define STATS_CLEAR_ALL "stats.clear.all"
+#define STATS_CLEAR_SCHEDMISS "stats.clear.schedmiss"
cs_error_t stats_map_set(const char *key_name,
const void *value,
@@ -394,9 +479,14 @@ cs_error_t stats_map_set(const char *key_name,
totempg_stats_clear(TOTEMPG_STATS_CLEAR_TOTEM);
cleared = 1;
}
+ if (strncmp(key_name, STATS_CLEAR_SCHEDMISS, strlen(STATS_CLEAR_SCHEDMISS)) == 0) {
+ schedmiss_clear_stats();
+ cleared = 1;
+ }
if (strncmp(key_name, STATS_CLEAR_ALL, strlen(STATS_CLEAR_ALL)) == 0) {
totempg_stats_clear(TOTEMPG_STATS_CLEAR_TRANSPORT | TOTEMPG_STATS_CLEAR_TOTEM);
cs_ipcs_clear_stats();
+ schedmiss_clear_stats();
cleared = 1;
}
if (!cleared) {
@@ -500,6 +590,11 @@ static void stats_map_notify_fn(uint32_t event, char *key, void *old_value, void
return ;
}
+ /* Ignore schedmiss trackers as the values are read from the circular buffer */
+ if (strncmp(key, SCHEDMISS_PREFIX, strlen(SCHEDMISS_PREFIX)) == 0 ) {
+ return ;
+ }
+
new_val.data = new_value;
if (stats_map_get(key,
&new_value,
@@ -556,7 +651,7 @@ cs_error_t stats_map_track_add(const char *key_name,
}
/* Get initial value */
if (stats_map_get(tracker->key_name,
- &tracker->old_value, &value_len, &type) == CS_OK) {
+ &tracker->old_value, &value_len, &type) != CS_OK) {
tracker->old_value = 0ULL;
}
} else {
diff --git a/exec/stats.h b/exec/stats.h
index 45891ae..eac9e7c 100644
--- a/exec/stats.h
+++ b/exec/stats.h
@@ -69,3 +69,5 @@ void stats_trigger_trackers(void);
void stats_ipcs_add_connection(int service_id, uint32_t pid, void *ptr);
void stats_ipcs_del_connection(int service_id, uint32_t pid, void *ptr);
cs_error_t cs_ipcs_get_conn_stats(int service_id, uint32_t pid, void *conn_ptr, struct ipcs_conn_stats *ipcs_stats);
+
+void stats_add_schedmiss_event(uint64_t, float delay);
diff --git a/man/cmap_keys.7 b/man/cmap_keys.7
index 6bc04fe..da95c51 100644
--- a/man/cmap_keys.7
+++ b/man/cmap_keys.7
@@ -1,5 +1,5 @@
.\"/*
-.\" * Copyright (c) 2012-2018 Red Hat, Inc.
+.\" * Copyright (c) 2012-2020 Red Hat, Inc.
.\" *
.\" * All rights reserved.
.\" *
@@ -357,6 +357,27 @@ contains the total number of interrupted sends.
.B service_id
contains the ID of service which the IPC is connected to.
+
+.TP
+stats.schedmiss.<n>.*
+If corosync is not scheduled after the required period of time it will
+log this event and also write an entry to the stats cmap under this key.
+There can be up to 10 entries (0..9) in here, when an 11th event happens
+the earliest will be removed.
+
+These events will always be in reverse order, so stats.schedmiss.0.* will
+always be the latest event kept and 9 the oldest. If you want to listen
+for notifications then you are recommended to listen for changes
+to stats.schedmiss.0.timestamp or stats.schedmiss.0.delay.
+
+.B timestamp
+The time of the event in ms since the Epoch (ie time_t * 1000 but with
+valid milliseconds).
+
+.B delay
+The time that corosync was paused (in ms, float value).
+
+
.TP
stats.clear.*
These are write-only keys used to clear the stats for various subsystems
@@ -370,6 +391,9 @@ Clears the knet stats
.B ipc
Clears the ipc stats
+.B schedmiss
+Clears the schedmiss stats
+
.B all
Clears all of the above stats
diff --git a/tools/corosync-cmapctl.c b/tools/corosync-cmapctl.c
index a4b61bd..ffca7e1 100644
--- a/tools/corosync-cmapctl.c
+++ b/tools/corosync-cmapctl.c
@@ -115,7 +115,7 @@ static int print_help(void)
printf(" about the networking and IPC traffic in some detail.\n");
printf("\n");
printf("Clear stats:\n");
- printf(" corosync-cmapctl -C [knet|ipc|totem|all]\n");
+ printf(" corosync-cmapctl -C [knet|ipc|totem|schedmiss|all]\n");
printf(" The 'stats' map is implied\n");
printf("\n");
printf("Load settings from a file:\n");
@@ -849,6 +849,7 @@ int main(int argc, char *argv[])
if (strcmp(optarg, "knet") == 0 ||
strcmp(optarg, "totem") == 0 ||
strcmp(optarg, "ipc") == 0 ||
+ strcmp(optarg, "schedmiss") == 0 ||
strcmp(optarg, "all") == 0) {
action = ACTION_CLEARSTATS;
clear_opt = optarg;
@@ -857,7 +858,7 @@ int main(int argc, char *argv[])
map = CMAP_MAP_STATS;
}
else {
- fprintf(stderr, "argument to -C should be 'knet', 'totem', 'ipc' or 'all'\n");
+ fprintf(stderr, "argument to -C should be 'knet', 'totem', 'ipc', 'schedmiss' or 'all'\n");
return (EXIT_FAILURE);
}
break;
--
1.8.3.1
From ebd05fa00826c366922e619b012a0684c6856539 Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Thu, 23 Jan 2020 17:11:54 +0100
Subject: [PATCH] stats: Use nanoseconds from epoch for schedmiss
Using monotonic time is not working because it doesn't have to match
time from epoch.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
exec/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/exec/main.c b/exec/main.c
index fb0486e..821d97e 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -836,7 +836,8 @@ static void timer_function_scheduler_timeout (void *data)
"(threshold is %0.4f ms). Consider token timeout increase.",
(float)tv_diff / QB_TIME_NS_IN_MSEC, (float)timeout_data->max_tv_diff / QB_TIME_NS_IN_MSEC);
- stats_add_schedmiss_event(tv_current / 1000, (float)tv_diff / QB_TIME_NS_IN_MSEC);
+ stats_add_schedmiss_event(qb_util_nano_from_epoch_get() / QB_TIME_NS_IN_MSEC,
+ (float)tv_diff / QB_TIME_NS_IN_MSEC);
}
/*
--
1.8.3.1
From 35662dd0ec53f456445c30c0ef92892f47b25aa2 Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Mon, 24 Feb 2020 14:58:45 +0100
Subject: [PATCH] main: Add schedmiss timestamp into message
This is useful for matching schedmiss event in stats map with logged
event.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
exec/main.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/exec/main.c b/exec/main.c
index 821d97e..8c3df79 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -817,6 +817,7 @@ static void timer_function_scheduler_timeout (void *data)
struct scheduler_pause_timeout_data *timeout_data = (struct scheduler_pause_timeout_data *)data;
unsigned long long tv_current;
unsigned long long tv_diff;
+ uint64_t schedmiss_event_tstamp;
tv_current = qb_util_nano_current_get ();
@@ -832,12 +833,14 @@ static void timer_function_scheduler_timeout (void *data)
timeout_data->tv_prev = tv_current;
if (tv_diff > timeout_data->max_tv_diff) {
- log_printf (LOGSYS_LEVEL_WARNING, "Corosync main process was not scheduled for %0.4f ms "
+ schedmiss_event_tstamp = qb_util_nano_from_epoch_get() / QB_TIME_NS_IN_MSEC;
+
+ log_printf (LOGSYS_LEVEL_WARNING, "Corosync main process was not scheduled (@%" PRIu64 ") for %0.4f ms "
"(threshold is %0.4f ms). Consider token timeout increase.",
+ schedmiss_event_tstamp,
(float)tv_diff / QB_TIME_NS_IN_MSEC, (float)timeout_data->max_tv_diff / QB_TIME_NS_IN_MSEC);
- stats_add_schedmiss_event(qb_util_nano_from_epoch_get() / QB_TIME_NS_IN_MSEC,
- (float)tv_diff / QB_TIME_NS_IN_MSEC);
+ stats_add_schedmiss_event(schedmiss_event_tstamp, (float)tv_diff / QB_TIME_NS_IN_MSEC);
}
/*
--
1.8.3.1
From 0c16442f2d93f32a229b87d2672e2dc8025ec704 Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Wed, 4 Mar 2020 11:42:15 +0100
Subject: [PATCH] votequorum: Change check of expected_votes
Previously value of new expected_votes was checked so newly computed
quorum value was in the interval <total_votes / 2, total_votes>. The
upper range prevented the cluster to become unquorate, but bottom check
was almost useless because it allowed to change expected_votes so it is
smaller than total_votes.
Solution is to check if expected_votes is bigger or equal to total_votes
and for quorate cluster only check if cluster doesn't become unquorate
(for unquorate cluster one can set upper range freely - as it is
perfectly possible when using config file)
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
exec/votequorum.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/exec/votequorum.c b/exec/votequorum.c
index 52424fa..b152425 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2015 Red Hat, Inc.
+ * Copyright (c) 2009-2020 Red Hat, Inc.
*
* All rights reserved.
*
@@ -2688,8 +2688,12 @@ static void message_handler_req_lib_votequorum_setexpected (void *conn, const vo
*/
newquorum = calculate_quorum(1, req_lib_votequorum_setexpected->expected_votes, &total_votes);
allow_downscale = allow_downscale_status;
- if (newquorum < total_votes / 2 ||
- newquorum > total_votes) {
+ /*
+ * Setting expected_votes < total_votes doesn't make sense.
+ * For quorate cluster prevent cluster to become unquorate.
+ */