Blame SOURCES/bz1445001-1-Main-Call-mlockall-after-fork.patch

3062ca
From 238e2e62d8b960e7c10bfa0a8281d78ec99f3a26 Mon Sep 17 00:00:00 2001
3062ca
From: Andrew Price <anprice@redhat.com>
3062ca
Date: Tue, 25 Apr 2017 14:44:33 +0200
3062ca
Subject: [PATCH] Main: Call mlockall after fork
3062ca
3062ca
Man page of mlockall is clear:
3062ca
Memory locks are not inherited by a child created via fork(2) and are
3062ca
automatically removed (unlocked) during an execve(2) or when the
3062ca
process terminates.
3062ca
3062ca
So calling mlockall before corosync_tty_detach is noop when corosync is
3062ca
executed as a daemon (corosync -f was not affected).
3062ca
3062ca
This regression is caused by ed7d054e552b4cb2a0cb502b65f84310ce6da844
3062ca
(setprio for logsys/qblog was correct, mlockall was not).
3062ca
3062ca
Solution is to move corosync_mlockall call on correct place.
3062ca
3062ca
Signed-off-by: Andrew Price <anprice@redhat.com>
3062ca
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
3062ca
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
3062ca
(cherry picked from commit 86012ebb45c85df277eb8fe5dc5223e2fdebf25c)
3062ca
---
3062ca
 exec/main.c |    4 ++--
3062ca
 1 files changed, 2 insertions(+), 2 deletions(-)
3062ca
3062ca
diff --git a/exec/main.c b/exec/main.c
3062ca
index d43cac6..602c788 100644
3062ca
--- a/exec/main.c
3062ca
+++ b/exec/main.c
3062ca
@@ -1177,8 +1177,6 @@ int main (int argc, char **argv, char **envp)
3062ca
 		corosync_setscheduler ();
3062ca
 	}
3062ca
 
3062ca
-	corosync_mlockall ();
3062ca
-
3062ca
 	/*
3062ca
 	 * Other signals are registered later via qb_loop_signal_add
3062ca
 	 */
3062ca
@@ -1310,6 +1308,8 @@ int main (int argc, char **argv, char **envp)
3062ca
 		corosync_tty_detach ();
3062ca
 	}
3062ca
 
3062ca
+	corosync_mlockall ();
3062ca
+
3062ca
 	corosync_poll_handle = qb_loop_create ();
3062ca
 
3062ca
 	memset(&scheduler_pause_timeout_data, 0, sizeof(scheduler_pause_timeout_data));
3062ca
-- 
3062ca
1.7.1
3062ca