File 0002-Main-call-mlock-after-fork.patch of Package corosync.6022

From 3b89acd59f5113edb23ba41e2ce67f9c3b2880fb Mon Sep 17 00:00:00 2001
From: Bin Liu <bliu@suse.com>
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

openSUSE Build Service is sponsored by