From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Windsor Date: Tue, 7 May 2019 09:56:53 -0400 Subject: [Cluster-devel] [PATCH 1/1] dlm_controld: bind to all interfaces for failover Message-ID: <20190507135653.9224-1-dwindsor@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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