From 5077c207fdf0b6696adb878f23882256a2f328023a60195479721514fd46f112 Mon Sep 17 00:00:00 2001 From: Bin Liu Date: Tue, 9 May 2017 04:25:45 +0000 Subject: [PATCH] Accepting request 493622 from home:BinLiu:branches:network:ha-clustering:Factory - calling mlockall before corosync_tty_detach is noop when corosync is executed as a daemon(bsc#1038147) Added: 0002-Main-call-mlock-after-fork.patch OBS-URL: https://build.opensuse.org/request/show/493622 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=86 --- 0002-Main-call-mlock-after-fork.patch | 46 +++++++++++++++++++++++++++ corosync.changes | 6 ++++ corosync.spec | 2 ++ 3 files changed, 54 insertions(+) create mode 100644 0002-Main-call-mlock-after-fork.patch diff --git a/0002-Main-call-mlock-after-fork.patch b/0002-Main-call-mlock-after-fork.patch new file mode 100644 index 0000000..d5e6c9e --- /dev/null +++ b/0002-Main-call-mlock-after-fork.patch @@ -0,0 +1,46 @@ +From 3b89acd59f5113edb23ba41e2ce67f9c3b2880fb Mon Sep 17 00:00:00 2001 +From: Bin Liu +Date: Tue, 9 May 2017 11:17:51 +0800 +Subject: [PATCH] Main: call mlock after fork + +Man page of mlockall is clear: +Memory locks are not inherited by a child created via fork(2) and are +automatically removed (unlocked) during an execve(2) or when the +process terminates. + +So calling mlockall before corosync_tty_detach is noop when corosync is +executed as a daemon (corosync -f was not affected). + +This regression is caused by ed7d054 +(setprio for logsys/qblog was correct, mlockall was not). + +Solution is to move corosync_mlockall call on correct place. +--- + exec/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/exec/main.c b/exec/main.c +index 7d2dcf7c..b3fce95b 100644 +--- a/exec/main.c ++++ b/exec/main.c +@@ -1201,8 +1201,6 @@ int main (int argc, char **argv, char **envp) + corosync_setscheduler (); + } + +- corosync_mlockall (); +- + /* + * Other signals are registered later via qb_loop_signal_add + */ +@@ -1329,6 +1327,8 @@ int main (int argc, char **argv, char **envp) + corosync_tty_detach (); + } + ++ corosync_mlockall(); ++ + corosync_poll_handle = qb_loop_create (); + + memset(&scheduler_pause_timeout_data, 0, sizeof(scheduler_pause_timeout_data)); +-- +2.12.0 + diff --git a/corosync.changes b/corosync.changes index a3d6cf2..97ab87d 100644 --- a/corosync.changes +++ b/corosync.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 9 04:17:35 UTC 2017 - bliu@suse.com + +- calling mlockall before corosync_tty_detach is noop when corosync is executed as a daemon(bsc#1038147) + Added: 0002-Main-call-mlock-after-fork.patch + ------------------------------------------------------------------- Mon Apr 10 06:42:51 UTC 2017 - bliu@suse.com diff --git a/corosync.spec b/corosync.spec index 1ed87da..5997f4d 100644 --- a/corosync.spec +++ b/corosync.spec @@ -63,6 +63,7 @@ Patch8: disable-build-html-docs.patch Patch9: 0001-Logsys-Change-logsys-syslog_priority-priority.patch Patch10: 0001-logconfig.c-make-logging.syslog_priority-and-logging.patch Patch11: 0001-totemconfig.c-Fixed-Evicted-from-CPG-membership.patch +Patch12: 0002-Main-call-mlock-after-fork.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # openais is indeed gone and should be uninstalled. Yes, we do not @@ -133,6 +134,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 %build %if %{with_runautogen}