]> git.proxmox.com Git - redhat-cluster-pve.git/blobdiff - cman-fix-reloading-config.patch
include patch from Fabio to fix config reload problems
[redhat-cluster-pve.git] / cman-fix-reloading-config.patch
diff --git a/cman-fix-reloading-config.patch b/cman-fix-reloading-config.patch
new file mode 100644 (file)
index 0000000..daa50ab
--- /dev/null
@@ -0,0 +1,152 @@
+From cluster-devel-bounces@redhat.com Wed Jul 11 11:47:38 2012
+Received: from rt.proxmox.com (192.168.2.18) by lisa.maurer-it.com
+ (192.168.2.121) with Microsoft SMTP Server id 14.2.298.4; Wed, 11 Jul 2012
+ 11:47:38 +0200
+Received: from proxmox.maurer-it.com (proxmox.maurer-it.com
+ [192.168.2.110]) by rt.proxmox.com (Postfix) with ESMTP id 734B1206E296       for
+ <dietmar@proxmox.com>; Wed, 11 Jul 2012 11:47:38 +0200 (CEST)
+Received: from proxmox.maurer-it.com (localhost [127.0.0.1])   by
+ proxmox.maurer-it.com (Proxmox) with ESMTP id 6B619305C0EA    for
+ <dietmar@proxmox.com>; Wed, 11 Jul 2012 11:47:38 +0200 (CEST)
+Received-SPF: pass (redhat.com: Sender is authorized to use
+ 'cluster-devel-bounces@redhat.com' in 'mfrom' identity (mechanism
+ 'include:spf-1.redhat.com' matched)) receiver=proxmox.maurer-it.com;
+ identity=mailfrom; envelope-from="cluster-devel-bounces@redhat.com";
+ helo=mx4-phx2.redhat.com; client-ip=209.132.183.25
+Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25])
+       by proxmox.maurer-it.com (Proxmox) with ESMTP id DCE17305C0EC   for
+ <dietmar@proxmox.com>; Wed, 11 Jul 2012 11:47:34 +0200 (CEST)
+Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
+ (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])       by
+ mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6B9kjaf026178;     Wed, 11
+ Jul 2012 05:46:52 -0400
+Received: from int-mx01.intmail.prod.int.phx2.redhat.com
+ (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])      by
+ lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP   id
+ q6B9kiDN001712 for <cluster-devel@listman.util.phx.redhat.com>;       Wed, 11 Jul
+ 2012 05:46:44 -0400
+Received: from daikengo.int.fabbione.net (ovpn-116-23.ams2.redhat.com
+ [10.36.116.23])       by int-mx01.intmail.prod.int.phx2.redhat.com
+ (8.13.8/8.13.8) with ESMTP    id q6B9kbK0020461; Wed, 11 Jul 2012 05:46:38
+ -0400
+From: "Fabio M. Di Nitto" <fdinitto@redhat.com>
+To: <cluster-devel@redhat.com>
+Date: Wed, 11 Jul 2012 11:46:36 +0200
+Message-ID: <1341999996-12269-1-git-send-email-fdinitto@redhat.com>
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
+X-loop: cluster-devel@redhat.com
+CC: "Fabio M. Di Nitto" <fdinitto@redhat.com>
+Subject: [Cluster-devel] [PATCH] cman: fix data copy and memory leak when
+ reloading config
+X-BeenThere: cluster-devel@redhat.com
+X-Mailman-Version: 2.1.12
+Precedence: junk
+List-Id: "\[Cluster devel\]" <cluster-devel.redhat.com>
+List-Unsubscribe: <https://www.redhat.com/mailman/options/cluster-devel>,
+ <mailto:cluster-devel-request@redhat.com?subject=unsubscribe>
+List-Archive: <https://www.redhat.com/archives/cluster-devel>
+List-Post: <mailto:cluster-devel@redhat.com>
+List-Help: <mailto:cluster-devel-request@redhat.com?subject=help>
+List-Subscribe: <https://www.redhat.com/mailman/listinfo/cluster-devel>,
+ <mailto:cluster-devel-request@redhat.com?subject=subscribe>
+Sender: <cluster-devel-bounces@redhat.com>
+Errors-To: cluster-devel-bounces@redhat.com
+X-Proxmox-CTCH-Refid:
+ str=0001.0A0B0203.4FFD4BB9.00FC:SCFSTAT2484459,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0
+x-proxmoxspam-level: Spam detection results:  0 AWL                   
+ -0.000 From: address is in the auto white-list RCVD_IN_DNSWL_HI          
+ -5 Sender listed at http://www.dnswl.org/, high trust SPF_HELO_PASS        
+  -0.001 SPF: HELO matches SPF record SPF_PASS               -0.001 SPF:
+ sender matches SPF record T_RP_MATCHES_RCVD       -0.01 Envelope sender
+ domain matches handover relay domain CTASD_SPAM_UNKNOWN         -1 Unknown
+ Mail (Commtouch)
+Content-Type: text/plain
+Return-Path: cluster-devel-bounces@redhat.com
+X-MS-Exchange-Organization-AuthSource: lisa.maurer-it.com
+X-MS-Exchange-Organization-AuthAs: Anonymous
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+
+From: "Fabio M. Di Nitto" <fdinitto@redhat.com>
+
+cman.cluster_id,nodename,two_node information were not copied
+from the old to the new config at reload time. This triggers
+a problem when <cman is set in cluster.conf and we effectively
+drop information from objdb (suboptimal).
+
+Also fix a possible memory leak when we have reload issues.
+
+Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
+---
+ cman/daemon/cman-preconfig.c |   31 +++++++++++++++++++++++++++++--
+ 1 files changed, 29 insertions(+), 2 deletions(-)
+
+diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
+index 68fec22..22583fe 100644
+--- a/cman/daemon/cman-preconfig.c
++++ b/cman/daemon/cman-preconfig.c
+@@ -1478,6 +1478,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
+       hdb_handle_t cluster_parent_handle_new;
+       unsigned int config_version = 0, config_version_new = 0;
+       char *config_value = NULL;
++      char str[255];
+       /* don't reload if we've been told to run configless */
+       if (getenv("CMAN_NOCONFIG")) {
+@@ -1489,16 +1490,16 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
+       /* find both /cluster entries */
+       objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
+       objdb->object_find_next(find_handle, &cluster_parent_handle);
++      objdb->object_find_next(find_handle, &cluster_parent_handle_new);
++      objdb->object_find_destroy(find_handle);
+       if (!cluster_parent_handle) {
+               snprintf (error_reason, sizeof(error_reason) - 1, "Cannot find old /cluster/ key in configuration\n");
+               goto err;
+       }
+-      objdb->object_find_next(find_handle, &cluster_parent_handle_new);
+       if (!cluster_parent_handle_new) {
+               snprintf (error_reason, sizeof(error_reason) - 1, "Cannot find new /cluster/ key in configuration\n");
+               goto err;
+       }
+-      objdb->object_find_destroy(find_handle);
+       if (!objdb->object_key_get(cluster_parent_handle, "config_version", strlen("config_version"), (void *)&config_value, NULL)) {
+               if (config_value) {
+@@ -1531,6 +1532,32 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const
+       /* destroy the old one */
+       objdb->object_destroy(cluster_parent_handle);
++      /*
++       * create cluster.cman in the new config if it doesn't exists
++       */
++      objdb->object_find_create(cluster_parent_handle_new, "cman", strlen("cman"), &find_handle);
++      if (objdb->object_find_next(find_handle, &object_handle)) {
++              objdb->object_create(cluster_parent_handle_new, &object_handle,
++                                   "cman", strlen("cman"));
++      }
++      objdb->object_find_destroy(find_handle);
++
++      /*
++       * readd cluster_id/two_node/nodename
++       */
++      snprintf(str, sizeof(str) - 1, "%d", cluster_id);
++      objdb->object_key_create_typed(object_handle, "cluster_id",
++                                     str, strlen(str) + 1, OBJDB_VALUETYPE_STRING);
++
++      if (two_node) {
++              snprintf(str, sizeof(str) - 1, "%d", 1);
++              objdb->object_key_create_typed(object_handle, "two_node",
++                                             str, strlen(str) + 1, OBJDB_VALUETYPE_STRING);
++      }
++
++      objdb->object_key_create_typed(object_handle, "nodename",
++                                     nodename, strlen(nodename)+1, OBJDB_VALUETYPE_STRING);
++
+       /* update the reference to the new config */
+       cluster_parent_handle = cluster_parent_handle_new;
+-- 
+1.7.7.6
+
+
+