Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: lib by andrew from 
      ([email protected])
   2. Linux-HA CVS: include by andrew from 
      ([email protected])
   3. Linux-HA CVS: lib by andrew from 
      ([email protected])
   4. Linux-HA CVS: lib by andrew from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Mon, 16 Jan 2006 02:19:54 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/crm/common


Modified Files:
        utils.c 


Log Message:


Logging

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/utils.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- utils.c     9 Jan 2006 21:18:32 -0000       1.30
+++ utils.c     16 Jan 2006 09:19:54 -0000      1.31
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.30 2006/01/09 21:18:32 andrew Exp $ */
+/* $Id: utils.c,v 1.31 2006/01/16 09:19:54 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -750,12 +750,12 @@
        
        param_name = ENV_PREFIX "" KEY_DEBUGLEVEL;
        param_val = getenv(param_name);
-       crm_debug("%s = %s", param_name, param_val);
        if(param_val != NULL) {
                int debug_level = crm_parse_int(param_val, NULL);
                if(debug_level > 0 && (debug_level+LOG_INFO) > 
(int)crm_log_level) {
                        set_crm_log_level(LOG_INFO + debug_level);
                }
+               crm_debug("%s = %s", param_name, param_val);
                param_val = NULL;
        }
 
@@ -817,8 +817,6 @@
        }
        
        inherit_compress();
-       
-       
 }
 
 gboolean




------------------------------

Message: 2
Date: Mon, 16 Jan 2006 02:19:54 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include/crm/common


Modified Files:
        util.h 


Log Message:


Logging

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/crm/common/util.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- util.h      25 Oct 2005 13:52:40 -0000      1.26
+++ util.h      16 Jan 2006 09:19:54 -0000      1.27
@@ -1,4 +1,4 @@
-/* $Id: util.h,v 1.26 2005/10/25 13:52:40 andrew Exp $ */
+/* $Id: util.h,v 1.27 2006/01/16 09:19:54 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -44,20 +44,14 @@
 
 extern char *crm_strdup(const char *a);
 
-extern char *generate_hash_key(const char *crm_msg_reference,
-                              const char *sys);
+extern char *generate_hash_key(const char *crm_msg_reference, const char *sys);
 
-extern char *generate_hash_value(const char *src_node,
-                                const char *src_subsys);
+extern char *generate_hash_value(const char *src_node, const char *src_subsys);
 
-extern gboolean decode_hash_value(gpointer value,
-                                 char **node,
-                                 char **subsys);
+extern gboolean decode_hash_value(gpointer value, char **node, char **subsys);
 
 extern gboolean decodeNVpair(const char *srcstring,
-                     char separator,
-                     char **name,
-                     char **value);
+                            char separator, char **name, char **value);
 
 extern int compare_version(const char *version1, const char *version2);
 




------------------------------

Message: 3
Date: Mon, 16 Jan 2006 02:21:45 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/crm/common


Modified Files:
        ipc.c 


Log Message:
Improvements to IPC usage by CIB clients - might prevent the CPU usage bugs
  that have been popping up.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/ipc.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ipc.c       11 Jan 2006 19:54:04 -0000      1.14
+++ ipc.c       16 Jan 2006 09:21:44 -0000      1.15
@@ -1,4 +1,4 @@
-/* $Id: ipc.c,v 1.14 2006/01/11 19:54:04 andrew Exp $ */
+/* $Id: ipc.c,v 1.15 2006/01/16 09:21:44 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -313,20 +313,18 @@
        const char *sys_to;
        const char *task;
 
-       while(sender->ops->is_message_pending(sender)) {
+       while(sender->ch_status == IPC_CONNECT
+             && sender->ops->is_message_pending(sender)) {
+
                gboolean process = FALSE;
-               if (sender->ch_status == IPC_DISCONNECT) {
-                       /* The message which was pending for us is that
-                        * the IPC status is now IPC_DISCONNECT */
-                       crm_debug("Channel is disconnected");
-                       break;
-               }
                if (sender->ops->recv(sender, &msg) != IPC_OK) {
-                       perror("Receive failure:");
+                       cl_perror("Receive failure from %d:",
+                                 sender->farside_pid);
                        return !all_is_well;
                }
                if (msg == NULL) {
-                       crm_err("No message this time");
+                       crm_err("No message from %d this time",
+                               sender->farside_pid);
                        continue;
                }
 
@@ -397,7 +395,8 @@
        
        crm_debug_2("Processed %d messages", lpc);
        if (sender->ch_status != IPC_CONNECT) {
-               crm_err("The server has left us: Shutting down...NOW");
+               crm_err("The server %d has left us: Shutting down...NOW",
+                       sender->farside_pid);
 
                exit(1); /* shutdown properly later */
                




------------------------------

Message: 4
Date: Mon, 16 Jan 2006 02:21:45 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/crm/cib


Modified Files:
        cib_native.c 


Log Message:
Improvements to IPC usage by CIB clients - might prevent the CPU usage bugs
  that have been popping up.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/cib/cib_native.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- cib_native.c        13 Jan 2006 12:46:53 -0000      1.50
+++ cib_native.c        16 Jan 2006 09:21:44 -0000      1.51
@@ -526,7 +526,6 @@
 gboolean
 cib_native_msgready(cib_t* cib)
 {
-       IPC_Channel *ch = NULL;
        cib_native_opaque_t *native = NULL;
        
        if (cib == NULL) {
@@ -536,21 +535,42 @@
 
        native = cib->variant_opaque;
 
-       ch = cib_native_channel(cib);
-       if (ch == NULL) {
-               crm_err("No channel");
+       if(native->command_channel != NULL) {
+               /* drain the channel */
+               IPC_Channel *cmd_ch = native->command_channel;
+               HA_Message *cmd_msg = NULL;
+               while(cmd_ch->ch_status != IPC_DISCONNECT
+                     && cmd_ch->ops->is_message_pending(cmd_ch)) {
+                       /* we're not supposed to receive anything on
+                        *   this channel
+                        */
+                       crm_err("Message pending on command channel [%d]",
+                               cmd_ch->farside_pid);
+                       cmd_msg = msgfromIPC_noauth(cmd_ch);
+                       crm_log_message_adv(LOG_ERR, "cib:cmd", cmd_msg);
+                       crm_msg_del(cmd_msg);
+               }
+
+       } else {
+               crm_err("No command channel");
+       }       
+
+       if(native->callback_channel == NULL) {
+               crm_err("No callback channel");
                return FALSE;
-       }
 
-       if(native->command_channel->ops->is_message_pending(
-                  native->command_channel)) {
-               crm_debug_3("Message pending on command channel");
-       }
-       if(native->callback_channel->ops->is_message_pending(
-                  native->callback_channel)) {
-               crm_debug_4("Message pending on callback channel");
+       } else if(native->callback_channel->ch_status == IPC_DISCONNECT) {
+               crm_info("Lost connection to the CIB service [%d].",
+                        native->callback_channel->farside_pid);
+               return FALSE;
+
+       } else if(native->callback_channel->ops->is_message_pending(
+                         native->callback_channel)) {
+               crm_debug_4("Message pending on command channel [%d]",
+                           native->callback_channel->farside_pid);
                return TRUE;
-       } 
+       }
+
        crm_debug_3("No message pending");
        return FALSE;
 }
@@ -560,20 +580,35 @@
 {
        const char *type = NULL;
        struct ha_msg* msg = NULL;
-       IPC_Channel *ch = cib_native_channel(cib);
+       cib_native_opaque_t *native = NULL;
+       
+       if (cib == NULL) {
+               crm_err("No CIB!");
+               return FALSE;
+       }
 
+       native = cib->variant_opaque;
+       
        /* if it is not blocking mode and no message in the channel, return */
        if (blocking == 0 && cib_native_msgready(cib) == FALSE) {
                crm_debug_3("No message ready and non-blocking...");
                return 0;
 
        } else if (cib_native_msgready(cib) == FALSE) {
-               crm_debug_3("Waiting for message from CIB service...");
-               ch->ops->waitin(ch);
+               crm_debug("Waiting for message from CIB service...");
+               if(native->callback_channel
+                  && native->callback_channel->ch_status != IPC_CONNECT) {
+                       return 0;
+                       
+               } else if(native->command_channel
+                         && native->command_channel->ch_status != IPC_CONNECT){
+                       return 0;
+               }
+               native->callback_channel->ops->waitin(native->callback_channel);
        }
 
        /* IPC_INTR is not a factor here */
-       msg = msgfromIPC_noauth(ch);
+       msg = msgfromIPC_noauth(native->callback_channel);
        if (msg == NULL) {
                crm_warn("Received a NULL msg from CIB service.");
                return 0;
@@ -698,6 +733,7 @@
 {
        int lpc = 0;
        cib_t *cib = user_data;
+       cib_native_opaque_t *native = NULL;
 
        crm_debug_3("Received callback");
 
@@ -705,6 +741,8 @@
                crm_err("user_data field must contain the CIB struct");
                return FALSE;
        }
+
+       native = cib->variant_opaque;
        
        while(cib_native_msgready(cib)) {
                lpc++; 
@@ -716,8 +754,18 @@
 
        crm_debug_3("%d CIB messages dispatched", lpc);
 
-       if (channel && (channel->ch_status != IPC_CONNECT)) {
-               crm_crit("Lost connection to the CIB service.");
+       if(native->callback_channel
+          && native->callback_channel->ch_status != IPC_CONNECT) {
+               crm_crit("Lost connection to the CIB service [%d/callback].",
+                       channel->farside_pid);
+               G_main_del_IPC_Channel(native->callback_source);
+               return FALSE;
+
+       } else if(native->command_channel
+                 && native->command_channel->ch_status != IPC_CONNECT) {
+               crm_crit("Lost connection to the CIB service [%d/command].",
+                       channel->farside_pid);
+
                return FALSE;
        }
 




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 26, Issue 37
********************************************

Reply via email to