]>
Commit | Line | Data |
---|---|---|
dd25e003 DM |
1 | From cluster-devel-bounces@redhat.com Wed Jul 11 11:47:38 2012 |
2 | Received: from rt.proxmox.com (192.168.2.18) by lisa.maurer-it.com | |
3 | (192.168.2.121) with Microsoft SMTP Server id 14.2.298.4; Wed, 11 Jul 2012 | |
4 | 11:47:38 +0200 | |
5 | Received: from proxmox.maurer-it.com (proxmox.maurer-it.com | |
6 | [192.168.2.110]) by rt.proxmox.com (Postfix) with ESMTP id 734B1206E296 for | |
7 | <dietmar@proxmox.com>; Wed, 11 Jul 2012 11:47:38 +0200 (CEST) | |
8 | Received: from proxmox.maurer-it.com (localhost [127.0.0.1]) by | |
9 | proxmox.maurer-it.com (Proxmox) with ESMTP id 6B619305C0EA for | |
10 | <dietmar@proxmox.com>; Wed, 11 Jul 2012 11:47:38 +0200 (CEST) | |
11 | Received-SPF: pass (redhat.com: Sender is authorized to use | |
12 | 'cluster-devel-bounces@redhat.com' in 'mfrom' identity (mechanism | |
13 | 'include:spf-1.redhat.com' matched)) receiver=proxmox.maurer-it.com; | |
14 | identity=mailfrom; envelope-from="cluster-devel-bounces@redhat.com"; | |
15 | helo=mx4-phx2.redhat.com; client-ip=209.132.183.25 | |
16 | Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) | |
17 | by proxmox.maurer-it.com (Proxmox) with ESMTP id DCE17305C0EC for | |
18 | <dietmar@proxmox.com>; Wed, 11 Jul 2012 11:47:34 +0200 (CEST) | |
19 | Received: from lists01.pubmisc.prod.ext.phx2.redhat.com | |
20 | (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by | |
21 | mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6B9kjaf026178; Wed, 11 | |
22 | Jul 2012 05:46:52 -0400 | |
23 | Received: from int-mx01.intmail.prod.int.phx2.redhat.com | |
24 | (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by | |
25 | lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id | |
26 | q6B9kiDN001712 for <cluster-devel@listman.util.phx.redhat.com>; Wed, 11 Jul | |
27 | 2012 05:46:44 -0400 | |
28 | Received: from daikengo.int.fabbione.net (ovpn-116-23.ams2.redhat.com | |
29 | [10.36.116.23]) by int-mx01.intmail.prod.int.phx2.redhat.com | |
30 | (8.13.8/8.13.8) with ESMTP id q6B9kbK0020461; Wed, 11 Jul 2012 05:46:38 | |
31 | -0400 | |
32 | From: "Fabio M. Di Nitto" <fdinitto@redhat.com> | |
33 | To: <cluster-devel@redhat.com> | |
34 | Date: Wed, 11 Jul 2012 11:46:36 +0200 | |
35 | Message-ID: <1341999996-12269-1-git-send-email-fdinitto@redhat.com> | |
36 | X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 | |
37 | X-loop: cluster-devel@redhat.com | |
38 | CC: "Fabio M. Di Nitto" <fdinitto@redhat.com> | |
39 | Subject: [Cluster-devel] [PATCH] cman: fix data copy and memory leak when | |
40 | reloading config | |
41 | X-BeenThere: cluster-devel@redhat.com | |
42 | X-Mailman-Version: 2.1.12 | |
43 | Precedence: junk | |
44 | List-Id: "\[Cluster devel\]" <cluster-devel.redhat.com> | |
45 | List-Unsubscribe: <https://www.redhat.com/mailman/options/cluster-devel>, | |
46 | <mailto:cluster-devel-request@redhat.com?subject=unsubscribe> | |
47 | List-Archive: <https://www.redhat.com/archives/cluster-devel> | |
48 | List-Post: <mailto:cluster-devel@redhat.com> | |
49 | List-Help: <mailto:cluster-devel-request@redhat.com?subject=help> | |
50 | List-Subscribe: <https://www.redhat.com/mailman/listinfo/cluster-devel>, | |
51 | <mailto:cluster-devel-request@redhat.com?subject=subscribe> | |
52 | Sender: <cluster-devel-bounces@redhat.com> | |
53 | Errors-To: cluster-devel-bounces@redhat.com | |
54 | X-Proxmox-CTCH-Refid: | |
55 | str=0001.0A0B0203.4FFD4BB9.00FC:SCFSTAT2484459,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 | |
56 | x-proxmoxspam-level: Spam detection results: 0 AWL | |
57 | -0.000 From: address is in the auto white-list RCVD_IN_DNSWL_HI | |
58 | -5 Sender listed at http://www.dnswl.org/, high trust SPF_HELO_PASS | |
59 | -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: | |
60 | sender matches SPF record T_RP_MATCHES_RCVD -0.01 Envelope sender | |
61 | domain matches handover relay domain CTASD_SPAM_UNKNOWN -1 Unknown | |
62 | Mail (Commtouch) | |
63 | Content-Type: text/plain | |
64 | Return-Path: cluster-devel-bounces@redhat.com | |
65 | X-MS-Exchange-Organization-AuthSource: lisa.maurer-it.com | |
66 | X-MS-Exchange-Organization-AuthAs: Anonymous | |
67 | MIME-Version: 1.0 | |
68 | Content-Transfer-Encoding: 8bit | |
69 | ||
70 | From: "Fabio M. Di Nitto" <fdinitto@redhat.com> | |
71 | ||
72 | cman.cluster_id,nodename,two_node information were not copied | |
73 | from the old to the new config at reload time. This triggers | |
74 | a problem when <cman is set in cluster.conf and we effectively | |
75 | drop information from objdb (suboptimal). | |
76 | ||
77 | Also fix a possible memory leak when we have reload issues. | |
78 | ||
79 | Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> | |
80 | --- | |
81 | cman/daemon/cman-preconfig.c | 31 +++++++++++++++++++++++++++++-- | |
82 | 1 files changed, 29 insertions(+), 2 deletions(-) | |
83 | ||
84 | diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c | |
85 | index 68fec22..22583fe 100644 | |
86 | --- a/cman/daemon/cman-preconfig.c | |
87 | +++ b/cman/daemon/cman-preconfig.c | |
88 | @@ -1478,6 +1478,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const | |
89 | hdb_handle_t cluster_parent_handle_new; | |
90 | unsigned int config_version = 0, config_version_new = 0; | |
91 | char *config_value = NULL; | |
92 | + char str[255]; | |
93 | ||
94 | /* don't reload if we've been told to run configless */ | |
95 | if (getenv("CMAN_NOCONFIG")) { | |
96 | @@ -1489,16 +1490,16 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const | |
97 | /* find both /cluster entries */ | |
98 | objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle); | |
99 | objdb->object_find_next(find_handle, &cluster_parent_handle); | |
100 | + objdb->object_find_next(find_handle, &cluster_parent_handle_new); | |
101 | + objdb->object_find_destroy(find_handle); | |
102 | if (!cluster_parent_handle) { | |
103 | snprintf (error_reason, sizeof(error_reason) - 1, "Cannot find old /cluster/ key in configuration\n"); | |
104 | goto err; | |
105 | } | |
106 | - objdb->object_find_next(find_handle, &cluster_parent_handle_new); | |
107 | if (!cluster_parent_handle_new) { | |
108 | snprintf (error_reason, sizeof(error_reason) - 1, "Cannot find new /cluster/ key in configuration\n"); | |
109 | goto err; | |
110 | } | |
111 | - objdb->object_find_destroy(find_handle); | |
112 | ||
113 | if (!objdb->object_key_get(cluster_parent_handle, "config_version", strlen("config_version"), (void *)&config_value, NULL)) { | |
114 | if (config_value) { | |
115 | @@ -1531,6 +1532,32 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, const | |
116 | /* destroy the old one */ | |
117 | objdb->object_destroy(cluster_parent_handle); | |
118 | ||
119 | + /* | |
120 | + * create cluster.cman in the new config if it doesn't exists | |
121 | + */ | |
122 | + objdb->object_find_create(cluster_parent_handle_new, "cman", strlen("cman"), &find_handle); | |
123 | + if (objdb->object_find_next(find_handle, &object_handle)) { | |
124 | + objdb->object_create(cluster_parent_handle_new, &object_handle, | |
125 | + "cman", strlen("cman")); | |
126 | + } | |
127 | + objdb->object_find_destroy(find_handle); | |
128 | + | |
129 | + /* | |
130 | + * readd cluster_id/two_node/nodename | |
131 | + */ | |
132 | + snprintf(str, sizeof(str) - 1, "%d", cluster_id); | |
133 | + objdb->object_key_create_typed(object_handle, "cluster_id", | |
134 | + str, strlen(str) + 1, OBJDB_VALUETYPE_STRING); | |
135 | + | |
136 | + if (two_node) { | |
137 | + snprintf(str, sizeof(str) - 1, "%d", 1); | |
138 | + objdb->object_key_create_typed(object_handle, "two_node", | |
139 | + str, strlen(str) + 1, OBJDB_VALUETYPE_STRING); | |
140 | + } | |
141 | + | |
142 | + objdb->object_key_create_typed(object_handle, "nodename", | |
143 | + nodename, strlen(nodename)+1, OBJDB_VALUETYPE_STRING); | |
144 | + | |
145 | /* update the reference to the new config */ | |
146 | cluster_parent_handle = cluster_parent_handle_new; | |
147 | ||
148 | -- | |
149 | 1.7.7.6 | |
150 | ||
151 | ||
152 |