]> git.proxmox.com Git - mirror_corosync.git/commitdiff
votequorum: Do not process events during reload
authorJan Friesse <jfriesse@redhat.com>
Wed, 25 Jun 2014 15:29:11 +0000 (17:29 +0200)
committerJan Friesse <jfriesse@redhat.com>
Fri, 27 Jun 2014 09:40:21 +0000 (11:40 +0200)
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@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
exec/main.c
exec/totemconfig.c
exec/votequorum.c
man/cmap_keys.8

index 8d18db8cde72858bc0ece12de9067c70d80b116f..9391db4ca4731a4a99d17bf44eb507b4b87533fa 100644 (file)
@@ -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)
index a64a304edd57a86523cdca0417efea101c53d2ab..e03f3ee083063b5838d883c9365be6e897f5f837 100644 (file)
@@ -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);
        }
 }
 
index 650e38ee5921e0405e7b2afaf99a4ad55ae92302..d365147ac38af5a876ca2d5169ff082ce4987a17 100644 (file)
@@ -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();
 }
 
index 3b7120dc9d767c264e94df80b3548ae9eb8170a1..aa407871a80b09bf5f75266a302212d463921657 100644 (file)
@@ -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