Gitweb:
http://git.fedorahosted.org/git/?p=dlm.git;a=commitdiff;h=f367c91ac4f4f80...
Commit: f367c91ac4f4f8012456f4916c0c99b00d8569c4
Parent: 5bdbe083ed23abc955309ea23fd6f008852b05b8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 25 11:02:22 2013 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 25 11:08:24 2013 -0500
dlm_controld: exclude fencing work during set_protocol
During set_protocol we only want to process protocol
messages, and only process fencing status later during
main daemon processing.
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm_controld/daemon_cpg.c | 26 ++++++++++++++++++++++++--
dlm_controld/dlm_daemon.h | 1 +
dlm_controld/main.c | 4 ++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c
index 0758560..0db48f5 100644
--- a/dlm_controld/daemon_cpg.c
+++ b/dlm_controld/daemon_cpg.c
@@ -766,6 +766,9 @@ static void daemon_fence_work(void)
int retry = 0;
uint32_t flags;
+ if (!daemon_fence_allow)
+ return;
+
if (daemon_ringid_wait) {
/* We've seen a nodedown confchg callback, but not the
corresponding ringid callback. */
@@ -1811,6 +1814,7 @@ int set_protocol(void)
{
struct protocol proto;
struct pollfd pollfd;
+ cs_error_t error;
int sent_proposal = 0;
int rv;
@@ -1860,8 +1864,17 @@ int set_protocol(void)
return -1;
}
- if (pollfd.revents & POLLIN)
- process_cpg_daemon(0);
+ if (pollfd.revents & POLLIN) {
+ /*
+ * don't use process_cpg_daemon() because we only want to
+ * dispatch one thing at a time because we only want to
+ * handling protocol related things here.
+ */
+
+ error = cpg_dispatch(cpg_handle_daemon, CS_DISPATCH_ONE);
+ if (error != CS_OK)
+ log_error("daemon cpg_dispatch one error %d", error);
+ }
if (pollfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
log_error("set_protocol poll revents %u",
pollfd.revents);
@@ -1927,6 +1940,15 @@ static void deliver_cb_daemon(cpg_handle_t handle,
hd = (struct dlm_header *)data;
dlm_header_in(hd);
+ if (!daemon_fence_allow && hd->type != DLM_MSG_PROTOCOL) {
+ /* don't think this will happen; if it does we may
+ need to verify that it's correct to ignore these
+ messages instead of saving them to process after
+ allow is set */
+ log_debug("deliver_cb_daemon ignore non proto msg %d", hd->type);
+ return;
+ }
+
switch (hd->type) {
case DLM_MSG_PROTOCOL:
receive_protocol(hd, len);
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 11a4777..dbe22ba 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -162,6 +162,7 @@ EXTERN int daemon_quit;
EXTERN int cluster_down;
EXTERN int poll_lockspaces;
EXTERN unsigned int retry_fencing;
+EXTERN int daemon_fence_allow;
EXTERN int poll_fs;
EXTERN int poll_ignore_plock;
EXTERN int poll_drop_plock;
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index 8fb16ef..287b82d 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -1021,6 +1021,10 @@ static void loop(void)
sd_notify(0, "READY=1");
#endif
+ /* We want to wait for our protocol to be set before
+ we start to process fencing. */
+ daemon_fence_allow = 1;
+
for (;;) {
rv = poll(pollfd, client_maxi + 1, poll_timeout);
if (rv == -1 && errno == EINTR) {