cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: David Windsor <dwindsor@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/1] dlm_controld: bind to all interfaces for failover
Date: Tue,  7 May 2019 09:56:53 -0400	[thread overview]
Message-ID: <20190507135653.9224-1-dwindsor@redhat.com> (raw)

Support for automatic failover in the face of network interruptions
is being added to the DLM kernel component. [1] This patch aids in that
effort by adding a mechanism whereby userspace can convey to the
kernel its intention to use all network addresses for automatic
failover.  DLM's current default behavior is to bind to only a single
interface.

When --bind_all is set, dlm_controld will write to a configfs
node that alerts the kernel of its intention to use all local network
addresses for automatic failover. When selecting the next address to
bind to, DLM will iterate through its list of local network addresses
in a round-robin fashion.  Support for other address selection
heuritics may be added in the future.

It is important to understand that, per the DLM spec, while DLM
can use a set of addresses for automatic failover, only one address
is considered the active address between two DLM nodes at a time.
This patch does not violate that constraint.

[1] https://www.redhat.com/archives/cluster-devel/2019-January/msg00009.html

Signed-off-by: David Windsor <dwindsor@redhat.com>
---
 dlm_controld/action.c     | 19 +++++++++++++++++++
 dlm_controld/dlm.conf.5   |  2 ++
 dlm_controld/dlm_daemon.h |  1 +
 dlm_controld/main.c       |  5 +++++
 4 files changed, 27 insertions(+)

diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index 84637f15..ecd0d022 100644
--- a/dlm_controld/action.c
+++ b/dlm_controld/action.c
@@ -662,6 +662,25 @@ int add_configfs_node(int nodeid, char *addr, int addrlen, int local)
 		return -1;
 	}
 	close(fd);
+
+	if (opt(bind_all_ind)) {
+		memset(path, 0, PATH_MAX);
+		snprintf(path, PATH_MAX, "%s/%d/bind_all", COMMS_DIR, nodeid);
+
+		fd = open(path, O_WRONLY);
+		if (fd < 0) {
+			log_error("%s: open failed: %d", path, errno);
+			return -1;
+		}
+
+		rv = do_write(fd, (void *)"1", strlen("1"));
+		if (rv < 0) {
+			log_error("%s: write failed: %d", path, errno);
+			close(fd);
+			return -1;
+		}
+		close(fd);
+	}
  out:
 	return 0;
 }
diff --git a/dlm_controld/dlm.conf.5 b/dlm_controld/dlm.conf.5
index 616b60da..09492176 100644
--- a/dlm_controld/dlm.conf.5
+++ b/dlm_controld/dlm.conf.5
@@ -38,6 +38,8 @@ log_debug
 .br
 protocol
 .br
+bind_all
+.br
 debug_logfile
 .br
 enable_plock
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 1182c971..3221e19c 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -95,6 +95,7 @@ enum {
         timewarn_ind,
         protocol_ind,
         debug_logfile_ind,
+	bind_all_ind,
         enable_fscontrol_ind,
         enable_plock_ind,
         plock_debug_ind,
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index 1b60ccda..8be6a4bc 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -1727,6 +1727,11 @@ static void set_opt_defaults(void)
 			-1, "detect",
 			"dlm kernel lowcomms protocol: tcp, sctp, detect");
 
+	set_opt_default(bind_all_ind,
+			"bind_all", '\0', req_arg_int,
+			0, NULL,
+			""); /* do not advertise */
+
 	set_opt_default(debug_logfile_ind,
 			"debug_logfile", 'L', no_arg,
 			0, NULL,
-- 
2.20.1



                 reply	other threads:[~2019-05-07 13:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190507135653.9224-1-dwindsor@redhat.com \
    --to=dwindsor@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).