Re: [PATCH 2/2] votequorum: Do not process events during reload

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK

Chrissie

On 25/06/14 16:50, Jan Friesse wrote:
During reload, local_node_pos is deleted and reinstation is handled in
totemconfig after reload is finished. votequorum handles this events and
tries to reload it's configuration. This led to logging a little scary
messages (even nothing bad is happening, because after local_node_pos
reinstation everything back to normal).

Solution is to stop processing events during reload. Sadly, simple
tracking of config.reload_in_progress doesn't work because LibQB events
triggering order is undefined so votequorum reload handler can be called
before totemconfig (and before local_node_pos is reinstatied).

So new config.totemconfig_reload_in_progress key is defined with very
similar semanthic as config.reload_in_progress but set inside
totem_reload_notify function. Votequorum then use this new key.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
  exec/main.c        |  1 +
  exec/totemconfig.c |  6 ++++++
  exec/votequorum.c  | 16 ++++++++++++++++
  man/cmap_keys.8    |  9 +++++++++
  4 files changed, 32 insertions(+)

diff --git a/exec/main.c b/exec/main.c
index 8d18db8..9391db4 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1052,6 +1052,7 @@ static void set_icmap_ro_keys_flag (void)
  	icmap_set_ro_access("totem.netmtu", CS_FALSE, CS_TRUE);
  	icmap_set_ro_access("qb.ipc_type", CS_FALSE, CS_TRUE);
  	icmap_set_ro_access("config.reload_in_progress", CS_FALSE, CS_TRUE);
+	icmap_set_ro_access("config.totemconfig_reload_in_progress", CS_FALSE, CS_TRUE);
  }

  static void main_service_ready (void)
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index a64a304..e03f3ee 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -912,6 +912,8 @@ extern int totem_config_read (
  	 */
  	totem_volatile_config_read(totem_config, NULL);

+	icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
+
  	add_totem_config_notification(totem_config);

  	return 0;
@@ -1264,6 +1266,10 @@ static void totem_reload_notify(
  		if (local_node_pos != -1) {
  			icmap_set_uint32("nodelist.local_node_pos", local_node_pos);
  		}
+
+		icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
+	} else {
+		icmap_set_uint8("config.totemconfig_reload_in_progress", 1);
  	}
  }

diff --git a/exec/votequorum.c b/exec/votequorum.c
index 650e38e..d365147 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -1477,9 +1477,18 @@ static void votequorum_refresh_config(
  	void *user_data)
  {
  	int old_votes, old_expected_votes;
+	uint8_t reloading;

  	ENTER();

+	/*
+	 * If a full reload is in progress then don't do anything until it's done and
+	 * can reconfigure it all atomically
+	 */
+	if (icmap_get_uint8("config.totemconfig_reload_in_progress", &reloading) == CS_OK && reloading) {
+		return ;
+	}
+
  	old_votes = us->votes;
  	old_expected_votes = us->expected_votes;

@@ -1509,6 +1518,7 @@ static void votequorum_exec_add_config_notification(void)
  {
  	icmap_track_t icmap_track_nodelist = NULL;
  	icmap_track_t icmap_track_quorum = NULL;
+	icmap_track_t icmap_track_reload = NULL;

  	ENTER();

@@ -1524,6 +1534,12 @@ static void votequorum_exec_add_config_notification(void)
  		NULL,
  		&icmap_track_quorum);

+	icmap_track_add("config.totemconfig_reload_in_progress",
+		ICMAP_TRACK_ADD | ICMAP_TRACK_MODIFY,
+		votequorum_refresh_config,
+		NULL,
+		&icmap_track_reload);
+
  	LEAVE();
  }

diff --git a/man/cmap_keys.8 b/man/cmap_keys.8
index 3b7120d..aa40787 100644
--- a/man/cmap_keys.8
+++ b/man/cmap_keys.8
@@ -276,6 +276,15 @@ and set to 0 when the reload is completed. This allows interested subsystems
  to do atomic reconfiguration rather than changing each key. Note that
  individual add/change/delete notifications will still be sent during a reload.

+.TP
+config.totemconfig_reload_in_progress
+This key is similar to
+.B config.totemconfig_reload_in_progress
+but changed after totem config trigger is processed. It is useful (mainly)
+for situations when
+.B nodelist.local_node_pos
+must be first correctly reinstated.
+
  .SH DYNAMIC CHANGE USER/GROUP PERMISSION TO USE COROSYNC IPC
  Is very same as in configuration file. To add UID 500 use



_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux