The branch, 1.2.40 has been updated via f7a21af8adc65c72326c0f955e5e1712467951ad (commit) via 1d7db16870c3e166f00669eb46c57fac765d0e1e (commit) via 34da547bd3534386e83056bc82b1ee7d9b2148f8 (commit) via b9541b26ed16a141b6cf608feabb29409ebb7ef2 (commit) via 17e11263cae9602da04d9af69cad0083bc29476d (commit) via 184318ce3ec607af53c86ddf8e0e8f6d77313ea4 (commit) via 09f82b58b2ab367a1c4f5b2bc79ceb63ff66a3c4 (commit) via 12090590085c5a3e3b895896ea2668cb592a7e28 (commit) via 2ac73c1e00734aef5da8bc03704c0fa4b0956011 (commit) via e1ba96d63b103bde841b634dc9c4c0eedabe72a9 (commit) from 0372e73b27b0193240aa0a020c8ab9f79abd262f (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40 - Log ----------------------------------------------------------------- commit f7a21af8adc65c72326c0f955e5e1712467951ad Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Apr 5 16:26:24 2013 +1100 New version 1.2.61 Signed-off-by: Amitay Isaacs <ami...@gmail.com> commit 1d7db16870c3e166f00669eb46c57fac765d0e1e Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Apr 5 15:31:26 2013 +1100 lockwait: Pass CTDB daemon PID on command line In lockwait helper process we cannot rely on getppid() to find the pid of CTDB daemon as CTDB daemon can go away before the helper executes. In which case, ctdb helper process will hang around forever. Signed-off-by: Amitay Isaacs <ami...@gmail.com> commit 34da547bd3534386e83056bc82b1ee7d9b2148f8 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Apr 5 13:34:06 2013 +1100 recoverd/takeover: Use IP->node mapping info from nodes hosting that IP When collating IP information for IP layout, only trust the nodes that are hosting an IP, to have correct information about that IP. Ignore what all the other nodes think. Signed-off-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit 1c7adbccc69ac276d2b957ad16c3802fdb8868ca) commit b9541b26ed16a141b6cf608feabb29409ebb7ef2 Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Apr 3 14:44:08 2013 +1100 statd-callout: Make sure statd callout script always runs as root In RHEL 6+, rpc.statd runs as "rpcuser" instead of root as on RHEL 5. This prevents CTDB tool commands talking to daemon since "rpcuser" cannot access CTDB socket. Signed-off-by: Amitay Isaacs <ami...@gmail.com> Pair-Programmed-With: Martin Schwenke <mar...@meltin.net> (cherry picked from commit fe8c4880b371492a38554868d4ca10918c54e412) Conflicts: packaging/RPM/ctdb.spec.in commit 17e11263cae9602da04d9af69cad0083bc29476d Author: Amitay Isaacs <ami...@gmail.com> Date: Mon Mar 18 13:45:08 2013 +1100 client: Set the socket non-blocking only after connect succeeds If the socket is set non-blocking before connect, then we should catch EAGAIN errors and retry. Instead of adding a random number of retries, better to wait for connect to succeed and then set the socket to non-blocking. Signed-off-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit 524ec206e6a5e8b11723f4d8d1251ed5d84063b0) commit 184318ce3ec607af53c86ddf8e0e8f6d77313ea4 Author: Volker Lendecke <v...@samba.org> Date: Wed Apr 3 14:59:21 2013 +0200 common/messaging: Use the jenkins hash in ctdb_message This give a better hash distribution (cherry picked from commit f7f8bde2376f8180a0dca6d7b8d7d2a4a12f4bd8) commit 09f82b58b2ab367a1c4f5b2bc79ceb63ff66a3c4 Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 5 13:11:31 2013 +1100 common/messaging: use tdb_parse_record in message_list_db_fetch This avoids malloc/free in a hot code path. (cherry picked from commit c137531fae8f7f6392746ce1b9ac6f219775fc29) commit 12090590085c5a3e3b895896ea2668cb592a7e28 Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Apr 3 15:08:14 2013 +1100 common/messaging: Abstract db related operations inside db functions This simplifies the use of message indexdb API and abstracts tdb related code inside the API. Signed-off-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit bf7296ce9b98563bcb8426cd035dbeab6d884f59) commit 2ac73c1e00734aef5da8bc03704c0fa4b0956011 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Apr 2 16:57:51 2013 +1100 common/messaging: Don't forget to free the result returned by tdb_fetch() This fixes a memory leak in the messaging code. Signed-off-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit 20be1f991dd75c2333c9ec9db226432a819f57ba) commit e1ba96d63b103bde841b634dc9c4c0eedabe72a9 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Apr 2 12:08:39 2013 +1100 common/messaging: Free message list header if all message handlers are freed This makes sure that even if the srvids are not deregistered, the header structure is freed when the last message handler has been freed as a result of client going away. Signed-off-by: Amitay Isaacs <ami...@gmail.com> (cherry picked from commit 4e1ec7412866f2d31c41de1bec0fbf788c03051b) ----------------------------------------------------------------------- Summary of changes: Makefile.in | 1 + client/ctdb_client.c | 6 +- common/ctdb_message.c | 110 ++++++++++++++++++++--------------------- config/ctdb.sudoers | 3 + config/statd-callout | 3 + libctdb/ctdb.c | 6 +- packaging/RPM/ctdb.spec.in | 19 ++++++- server/ctdb_lockwait.c | 16 +++--- server/ctdb_lockwait_helper.c | 12 ++-- server/ctdb_takeover.c | 8 +++- 10 files changed, 104 insertions(+), 80 deletions(-) create mode 100644 config/ctdb.sudoers Changeset truncated at 500 lines: diff --git a/Makefile.in b/Makefile.in index 1032349..127d72e 100755 --- a/Makefile.in +++ b/Makefile.in @@ -266,6 +266,7 @@ install: all ${INSTALLCMD} -m 644 include/ctdb_protocol.h $(DESTDIR)$(includedir) ${INSTALLCMD} -m 644 include/ctdb_private.h $(DESTDIR)$(includedir) # for samba3 ${INSTALLCMD} -m 644 include/ctdb_typesafe_cb.h $(DESTDIR)$(includedir) + ${INSTALLCMD} -m 440 config/ctdb.sudoers $(DESTDIR)$(etcdir)/sudoers.d/ctdb ${INSTALLCMD} -m 644 config/functions $(DESTDIR)$(etcdir)/ctdb ${INSTALLCMD} -m 755 config/statd-callout $(DESTDIR)$(etcdir)/ctdb ${INSTALLCMD} -m 755 config/interface_modify.sh $(DESTDIR)$(etcdir)/ctdb diff --git a/client/ctdb_client.c b/client/ctdb_client.c index 4a02ae5..0f0f175 100644 --- a/client/ctdb_client.c +++ b/client/ctdb_client.c @@ -263,9 +263,6 @@ int ctdb_socket_connect(struct ctdb_context *ctdb) return -1; } - set_nonblocking(ctdb->daemon.sd); - set_close_on_exec(ctdb->daemon.sd); - if (connect(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { close(ctdb->daemon.sd); ctdb->daemon.sd = -1; @@ -273,6 +270,9 @@ int ctdb_socket_connect(struct ctdb_context *ctdb) return -1; } + set_nonblocking(ctdb->daemon.sd); + set_close_on_exec(ctdb->daemon.sd); + ctdb->daemon.queue = ctdb_queue_setup(ctdb, ctdb, ctdb->daemon.sd, CTDB_DS_ALIGNMENT, ctdb_client_read_cb, ctdb, "to-ctdbd"); diff --git a/common/ctdb_message.c b/common/ctdb_message.c index c6506f4..27f1f39 100644 --- a/common/ctdb_message.c +++ b/common/ctdb_message.c @@ -32,7 +32,9 @@ static int message_list_db_init(struct ctdb_context *ctdb) { ctdb->message_list_indexdb = tdb_open("messagedb", 8192, - TDB_INTERNAL|TDB_DISALLOW_NESTING, + TDB_INTERNAL| + TDB_INCOMPATIBLE_HASH| + TDB_DISALLOW_NESTING, O_RDWR|O_CREAT, 0); if (ctdb->message_list_indexdb == NULL) { DEBUG(DEBUG_ERR, ("Failed to create message list indexdb\n")); @@ -42,9 +44,11 @@ static int message_list_db_init(struct ctdb_context *ctdb) return 0; } -static int message_list_db_add(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA data) +static int message_list_db_add(struct ctdb_context *ctdb, uint64_t srvid, + struct ctdb_message_list_header *h) { int ret; + TDB_DATA key, data; if (ctdb->message_list_indexdb == NULL) { ret = message_list_db_init(ctdb); @@ -53,6 +57,12 @@ static int message_list_db_add(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA } } + key.dptr = (uint8_t *)&srvid; + key.dsize = sizeof(uint64_t); + + data.dptr = (uint8_t *)&h; + data.dsize = sizeof(struct ctdb_message_list_header *); + ret = tdb_store(ctdb->message_list_indexdb, key, data, TDB_INSERT); if (ret < 0) { DEBUG(DEBUG_ERR, ("Failed to add message list handler (%s)\n", @@ -63,14 +73,18 @@ static int message_list_db_add(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA return 0; } -static int message_list_db_delete(struct ctdb_context *ctdb, TDB_DATA key) +static int message_list_db_delete(struct ctdb_context *ctdb, uint64_t srvid) { int ret; + TDB_DATA key; if (ctdb->message_list_indexdb == NULL) { return -1; } + key.dptr = (uint8_t *)&srvid; + key.dsize = sizeof(uint64_t); + ret = tdb_delete(ctdb->message_list_indexdb, key); if (ret < 0) { DEBUG(DEBUG_ERR, ("Failed to delete message list handler (%s)\n", @@ -81,17 +95,34 @@ static int message_list_db_delete(struct ctdb_context *ctdb, TDB_DATA key) return 0; } -static int message_list_db_fetch(struct ctdb_context *ctdb, TDB_DATA key, TDB_DATA *data) +static int message_list_db_fetch_parser(TDB_DATA key, TDB_DATA data, + void *private_data) { - if (ctdb->message_list_indexdb == NULL) { + struct ctdb_message_list_header **h = + (struct ctdb_message_list_header **)private_data; + + if (data.dsize != sizeof(struct ctdb_message_list_header *)) { return -1; } - *data = tdb_fetch(ctdb->message_list_indexdb, key); - if (data->dsize == 0) { + *h = *(struct ctdb_message_list_header **)data.dptr; + return 0; +} + +static int message_list_db_fetch(struct ctdb_context *ctdb, uint64_t srvid, + struct ctdb_message_list_header **h) +{ + TDB_DATA key; + + if (ctdb->message_list_indexdb == NULL) { return -1; } - return 0; + + key.dptr = (uint8_t *)&srvid; + key.dsize = sizeof(uint64_t); + + return tdb_parse_record(ctdb->message_list_indexdb, key, + message_list_db_fetch_parser, h); } /* @@ -101,29 +132,18 @@ int ctdb_dispatch_message(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA da { struct ctdb_message_list_header *h; struct ctdb_message_list *m; - TDB_DATA key, hdata; uint64_t srvid_all = CTDB_SRVID_ALL; int ret; - key.dptr = (uint8_t *)&srvid; - key.dsize = sizeof(uint64_t); - - ret = message_list_db_fetch(ctdb, key, &hdata); + ret = message_list_db_fetch(ctdb, srvid, &h); if (ret == 0) { - h = *(struct ctdb_message_list_header **)hdata.dptr; - for (m=h->m; m; m=m->next) { m->message_handler(ctdb, srvid, data, m->message_private); } } - key.dptr = (uint8_t *)&srvid_all; - key.dsize = sizeof(uint64_t); - - ret = message_list_db_fetch(ctdb, key, &hdata); + ret = message_list_db_fetch(ctdb, srvid_all, &h); if (ret == 0) { - h = *(struct ctdb_message_list_header **)hdata.dptr; - for(m=h->m; m; m=m->next) { m->message_handler(ctdb, srvid, data, m->message_private); } @@ -152,7 +172,6 @@ void ctdb_request_message(struct ctdb_context *ctdb, struct ctdb_req_header *hdr static int message_header_destructor(struct ctdb_message_list_header *h) { struct ctdb_message_list *m; - TDB_DATA key; while (h->m != NULL) { m = h->m; @@ -160,10 +179,7 @@ static int message_header_destructor(struct ctdb_message_list_header *h) TALLOC_FREE(m); } - key.dptr = (uint8_t *)&h->srvid; - key.dsize = sizeof(uint64_t); - - message_list_db_delete(h->ctdb, key); + message_list_db_delete(h->ctdb, h->srvid); DLIST_REMOVE(h->ctdb->message_list_header, h); return 0; @@ -177,6 +193,9 @@ static int message_handler_destructor(struct ctdb_message_list *m) struct ctdb_message_list_header *h = m->h; DLIST_REMOVE(h->m, m); + if (h->m == NULL) { + talloc_free(h); + } return 0; } @@ -191,7 +210,6 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb, { struct ctdb_message_list_header *h; struct ctdb_message_list *m; - TDB_DATA key, data; int ret; m = talloc_zero(mem_ctx, struct ctdb_message_list); @@ -200,11 +218,8 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb, m->message_handler = handler; m->message_private = private_data; - key.dptr = (uint8_t *)&srvid; - key.dsize = sizeof(uint64_t); - - ret = message_list_db_fetch(ctdb, key, &data); - if (ret < 0) { + ret = message_list_db_fetch(ctdb, srvid, &h); + if (ret != 0) { /* srvid not registered yet */ h = talloc_zero(ctdb, struct ctdb_message_list_header); CTDB_NO_MEMORY(ctdb, h); @@ -212,9 +227,7 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb, h->ctdb = ctdb; h->srvid = srvid; - data.dptr = (uint8_t *)&h; - data.dsize = sizeof(struct ctdb_message_list_header *); - ret = message_list_db_add(ctdb, key, data); + ret = message_list_db_add(ctdb, srvid, h); if (ret < 0) { talloc_free(m); talloc_free(h); @@ -223,8 +236,6 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb, DLIST_ADD(ctdb->message_list_header, h); talloc_set_destructor(h, message_header_destructor); - } else { - h = *(struct ctdb_message_list_header **)data.dptr; } m->h = h; @@ -241,24 +252,16 @@ int ctdb_deregister_message_handler(struct ctdb_context *ctdb, uint64_t srvid, v { struct ctdb_message_list_header *h; struct ctdb_message_list *m; - TDB_DATA key, data; int ret; - key.dptr = (uint8_t *)&srvid; - key.dsize = sizeof(uint64_t); - - ret = message_list_db_fetch(ctdb, key, &data); - if (ret < 0) { + ret = message_list_db_fetch(ctdb, srvid, &h); + if (ret != 0) { return -1; } - h = *(struct ctdb_message_list_header **)data.dptr; for (m=h->m; m; m=m->next) { if (m->message_private == private_data) { talloc_free(m); - if (h->m == NULL) { - talloc_free(h); - } return 0; } } @@ -273,17 +276,10 @@ int ctdb_deregister_message_handler(struct ctdb_context *ctdb, uint64_t srvid, v bool ctdb_check_message_handler(struct ctdb_context *ctdb, uint64_t srvid) { struct ctdb_message_list_header *h; - TDB_DATA key, data; - - key.dptr = (uint8_t *)&srvid; - key.dsize = sizeof(uint64_t); - - if (message_list_db_fetch(ctdb, key, &data) < 0) { - return false; - } + int ret; - h = *(struct ctdb_message_list_header **)data.dptr; - if (h->m == NULL) { + ret = message_list_db_fetch(ctdb, srvid, &h); + if (ret != 0 || h->m == NULL) { return false; } diff --git a/config/ctdb.sudoers b/config/ctdb.sudoers new file mode 100644 index 0000000..1c6619b --- /dev/null +++ b/config/ctdb.sudoers @@ -0,0 +1,3 @@ +Defaults!/etc/ctdb/statd-callout !requiretty + +rpcuser ALL=(ALL) NOPASSWD: /etc/ctdb/statd-callout diff --git a/config/statd-callout b/config/statd-callout index 39be9d3..d20fd50 100755 --- a/config/statd-callout +++ b/config/statd-callout @@ -1,5 +1,8 @@ #!/bin/sh +# This must run as root as CTDB tool commands need to access CTDB socket +[ $(id -u) -eq 0 ] || exec sudo "$0" "$@" + # this script needs to be installed so that statd points to it with the -H # command line argument. The easiest way to do that is to put something like this in # /etc/sysconfig/nfs: diff --git a/libctdb/ctdb.c b/libctdb/ctdb.c index 46f4953..8746546 100644 --- a/libctdb/ctdb.c +++ b/libctdb/ctdb.c @@ -176,12 +176,12 @@ struct ctdb_connection *ctdb_connect(const char *addr, if (ctdb->fd < 0) goto free_fail; - set_nonblocking(ctdb->fd); - set_close_on_exec(ctdb->fd); - if (connect(ctdb->fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) goto close_fail; + set_nonblocking(ctdb->fd); + set_close_on_exec(ctdb->fd); + /* Immediately queue a request to get our pnn. */ if (!ctdb_getpnn_send(ctdb, CTDB_CURRENT_NODE, set_pnn, NULL)) goto close_fail; diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in index edcc458..9394987 100644 --- a/packaging/RPM/ctdb.spec.in +++ b/packaging/RPM/ctdb.spec.in @@ -3,7 +3,7 @@ Name: ctdb Summary: Clustered TDB Vendor: Samba Team Packager: Samba Team <sa...@samba.org> -Version: 1.2.60 +Version: 1.2.61 Release: 1GITHASH Epoch: 0 License: GNU GPL version 3 @@ -12,8 +12,12 @@ URL: http://ctdb.samba.org/ Source: ctdb-%{version}.tar.gz -Prereq: /bin/mktemp /usr/bin/killall -Prereq: fileutils sed /etc/init.d +# Packages +Requires: coreutils, sed, gawk, iptables, iproute, procps, ethtool, sudo +# Commands - package name might vary +Requires: /usr/bin/killall, /bin/kill, /bin/netstat +# Directories +Requires: /etc/init.d Provides: ctdb = %{version} @@ -63,6 +67,7 @@ rm -rf $RPM_BUILD_ROOT # Create the target build directory hierarchy mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sudoers.d make DESTDIR=$RPM_BUILD_ROOT docdir=%{_docdir} install @@ -96,6 +101,7 @@ rm -rf $RPM_BUILD_ROOT %{_docdir}/ctdb/README.eventscripts %{_docdir}/ctdb/recovery-process.txt +%{_sysconfdir}/sudoers.d/ctdb %{_sysconfdir}/ctdb/events.d/00.ctdb %{_sysconfdir}/ctdb/events.d/01.reclock %{_sysconfdir}/ctdb/events.d/10.interface @@ -149,6 +155,13 @@ development libraries for ctdb %changelog +* Fri Apr 05 2013 : Version 1.2.61 + - Free message list header if all message handlers are freed + - Use tdb_parse_record instead of tdb_fetch to avoid memory leaks + - Set client socket to non-blocking only after connect succeeds + - Make sure statd-callout script is always run as root + - Use IP->node mapping info from nodes hosting that IP + - Pass CTDB daemon pid on command line to lockwait helper * Mon Mar 25 2013 : Version 1.2.60 - Do not set close_on_exec for stdio/stderr of child - Check result from lockwait child diff --git a/server/ctdb_lockwait.c b/server/ctdb_lockwait.c index cb5bc1c..c23e3a0 100644 --- a/server/ctdb_lockwait.c +++ b/server/ctdb_lockwait.c @@ -158,7 +158,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, struct lockwait_handle *result, *i; int ret; const char *prog = BINDIR "/ctdb_lockwait_helper"; - char *arg0, *arg1, *arg2, *arg3; + char *arg0, *arg1, *arg2, *arg3, *arg4; CTDB_INCREMENT_STAT(ctdb_db->ctdb, lockwait_calls); CTDB_INCREMENT_STAT(ctdb_db->ctdb, pending_lockwait_calls); @@ -204,15 +204,16 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, /* Create data for the child process */ arg0 = talloc_asprintf(result, "ctdb_lock-%s", ctdb_db->db_name); - arg1 = talloc_asprintf(result, "%d", result->fd[1]); - arg2 = talloc_strdup(result, ctdb_db->db_path); + arg1 = talloc_asprintf(result, "%d", ctdb_db->ctdb->ctdbd_pid); + arg2 = talloc_asprintf(result, "%d", result->fd[1]); + arg3 = talloc_strdup(result, ctdb_db->db_path); if (key.dsize == 0) { - arg3 = talloc_strdup(result, "NULL"); + arg4 = talloc_strdup(result, "NULL"); } else { - arg3 = hex_encode_talloc(result, key.dptr, key.dsize); + arg4 = hex_encode_talloc(result, key.dptr, key.dsize); } - if (!arg0 || !arg1 || !arg2 || !arg3) { + if (!arg0 || !arg1 || !arg2 || !arg3 || !arg4) { close(result->fd[0]); close(result->fd[1]); talloc_free(result); @@ -236,7 +237,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, if (result->child == 0) { close(result->fd[0]); - execl(prog, arg0, arg1, arg2, arg3, NULL); + execl(prog, arg0, arg1, arg2, arg3, arg4, NULL); _exit(1); } @@ -244,6 +245,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db, talloc_free(arg1); talloc_free(arg2); talloc_free(arg3); + talloc_free(arg4); close(result->fd[1]); diff --git a/server/ctdb_lockwait_helper.c b/server/ctdb_lockwait_helper.c index 2350e73..07fdfb4 100644 --- a/server/ctdb_lockwait_helper.c +++ b/server/ctdb_lockwait_helper.c @@ -40,14 +40,15 @@ int main(int argc, char *argv[]) char result = 1; int ppid; - if (argc != 4) { - fprintf(stderr, "Usage: %s <output-fd> <db-path> <db-key>\n", argv[0]); + if (argc != 5) { + fprintf(stderr, "Usage: %s <ctdbd-pid> <output-fd> <db-path> <db-key>\n", argv[0]); exit(1); } - write_fd = atoi(argv[1]); - dbpath = argv[2]; - dbkey = argv[3]; + ppid = atoi(argv[1]); + write_fd = atoi(argv[2]); + dbpath = argv[3]; + dbkey = argv[4]; /* Convert hex key to key */ if (strcmp(dbkey, "NULL") == 0) { @@ -71,7 +72,6 @@ int main(int argc, char *argv[]) result = 0; send_result(write_fd, result); - ppid = getppid(); while (kill(ppid, 0) == 0 || errno != ESRCH) { sleep(5); } diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c index 5704b09..481b4db 100644 --- a/server/ctdb_takeover.c +++ b/server/ctdb_takeover.c @@ -1243,7 +1243,13 @@ create_merged_ip_list(struct ctdb_context *ctdb) tmp_ip = talloc_zero(ctdb->ip_tree, struct ctdb_public_ip_list); CTDB_NO_MEMORY_NULL(ctdb, tmp_ip); - tmp_ip->pnn = public_ips->ips[j].pnn; + /* Do not use information about IP addresses hosted + * on other nodes, it may not be accurate */ + if (public_ips->ips[j].pnn == ctdb->nodes[i]->pnn) { + tmp_ip->pnn = public_ips->ips[j].pnn; + } else { + tmp_ip->pnn = -1; + } tmp_ip->addr = public_ips->ips[j].addr; tmp_ip->next = NULL; -- CTDB repository