New upstream release

- Resolves: rhbz#1948974
This commit is contained in:
Jan Friesse 2021-05-21 10:02:11 +02:00
parent f69ec13d5e
commit 84a9f6714f
5 changed files with 179 additions and 2 deletions

1
.gitignore vendored
View File

@ -44,3 +44,4 @@ corosync-1.2.7.tar.gz
/corosync-3.1.0.tar.gz
/corosync-3.1.1.tar.gz
/corosync-3.1.2.tar.gz
/corosync-3.1.3.tar.gz

View File

@ -0,0 +1,122 @@
From 57e6b86b53010dd2612b0a6a4e04917673062ecf Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Mon, 3 May 2021 15:29:04 +0200
Subject: [PATCH 3/7] main: Add support for cgroup v2
Support for cgroup v2 is very similar to cgroup v1 just checking (and
writing) different file.
Testing this feature is a bit harder than with cgroup v1 so it's
probably worh noting in this commit message.
1. Copy some service file (I've used httpd service) and set
CPUQuota=30% in the [service] section.
2. Check /sys/fs/cgroup/cgroup.subtree_control - there should be no
"cpu"
3. Start modified service
4. Check /sys/fs/cgroup/cgroup.subtree_control - there should be "cpu"
5. Start corosync - It should be able to get rt priority
When move_to_root_cgroup is disabled, behavior differs:
- If corosync is started before modified service, so
there is no "cpu" in /sys/fs/cgroup/cgroup.subtree_control
corosync starts without problem and gets rt priority.
Starting modified service later will never add "cpu" into
/sys/fs/cgroup/cgroup.subtree_control (because corosync is holding
rt priority and it is placed in the non-root cgroup by systemd).
- When corosync is started after modified service, so "cpu"
is in /sys/fs/cgroup/cgroup.subtree_control, corosync is not
able to get RT priority.
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
exec/main.c | 21 ++++++++++++++++-----
man/corosync.conf.5 | 14 ++++++++++----
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/exec/main.c b/exec/main.c
index aa6d9fbf..65ae5e4f 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1173,6 +1173,7 @@ error_close:
static int corosync_move_to_root_cgroup(void) {
FILE *f;
int res = -1;
+ const char *cgroup_task_fname = NULL;
/*
* /sys/fs/cgroup is hardcoded, because most of Linux distributions are now
@@ -1183,15 +1184,25 @@ static int corosync_move_to_root_cgroup(void) {
*/
f = fopen("/sys/fs/cgroup/cpu/cpu.rt_runtime_us", "rt");
if (f == NULL) {
- log_printf(LOGSYS_LEVEL_DEBUG, "cpu.rt_runtime_us doesn't exists -> "
- "system without cgroup or with disabled CONFIG_RT_GROUP_SCHED");
+ /*
+ * Try cgroup v2
+ */
+ f = fopen("/sys/fs/cgroup/cgroup.procs", "rt");
+ if (f == NULL) {
+ log_printf(LOG_DEBUG, "cpu.rt_runtime_us or cgroup.procs doesn't exist -> "
+ "system without cgroup or with disabled CONFIG_RT_GROUP_SCHED");
- res = 0;
- goto exit_res;
+ res = 0;
+ goto exit_res;
+ } else {
+ cgroup_task_fname = "/sys/fs/cgroup/cgroup.procs";
+ }
+ } else {
+ cgroup_task_fname = "/sys/fs/cgroup/cpu/tasks";
}
(void)fclose(f);
- f = fopen("/sys/fs/cgroup/cpu/tasks", "w");
+ f = fopen(cgroup_task_fname, "w");
if (f == NULL) {
log_printf(LOGSYS_LEVEL_WARNING, "Can't open cgroups tasks file for writing");
diff --git a/man/corosync.conf.5 b/man/corosync.conf.5
index 25289ba4..1c9d2ad7 100644
--- a/man/corosync.conf.5
+++ b/man/corosync.conf.5
@@ -1,6 +1,6 @@
.\"/*
.\" * Copyright (c) 2005 MontaVista Software, Inc.
-.\" * Copyright (c) 2006-2020 Red Hat, Inc.
+.\" * Copyright (c) 2006-2021 Red Hat, Inc.
.\" *
.\" * All rights reserved.
.\" *
@@ -32,7 +32,7 @@
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" * THE POSSIBILITY OF SUCH DAMAGE.
.\" */
-.TH COROSYNC_CONF 5 2021-04-09 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
+.TH COROSYNC_CONF 5 2021-05-03 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
corosync.conf - corosync executive configuration file
@@ -800,8 +800,14 @@ meaning maximal / minimal priority (so minimal / maximal nice value).
.TP
move_to_root_cgroup
Should be set to yes (default) if corosync should try to move itself to root
-cgroup. This feature is available only for systems with cgroups with RT
-sched enabled (Linux with CONFIG_RT_GROUP_SCHED kernel option).
+cgroup. This feature is available only for systems with cgroups v1 with RT
+sched enabled (Linux with CONFIG_RT_GROUP_SCHED kernel option) and cgroups v2.
+
+It's worth noting that currently (May 3 2021) cgroup2 doesnt yet
+support control of realtime processes and the cpu controller can only be
+enabled when all RT processes are in the root cgroup. So when move_to_root_cgroup
+is disabled and systemd is used, it may be impossible to make systemd options
+like CPUQuota working correctly until corosync is stopped.
.TP
allow_knet_handle_fallback
--
2.27.0

View File

@ -0,0 +1,44 @@
From 9d3df5696ed6b04b379a2fe643eec1fcd5a4b10d Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Tue, 18 May 2021 10:43:37 +0200
Subject: [PATCH 5/7] man: Add info about cgroup v2 behavior
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
---
man/corosync.conf.5 | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/man/corosync.conf.5 b/man/corosync.conf.5
index 1c9d2ad7..90a2babc 100644
--- a/man/corosync.conf.5
+++ b/man/corosync.conf.5
@@ -32,7 +32,7 @@
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
.\" * THE POSSIBILITY OF SUCH DAMAGE.
.\" */
-.TH COROSYNC_CONF 5 2021-05-03 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
+.TH COROSYNC_CONF 5 2021-05-18 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
corosync.conf - corosync executive configuration file
@@ -809,6 +809,16 @@ enabled when all RT processes are in the root cgroup. So when move_to_root_cgrou
is disabled and systemd is used, it may be impossible to make systemd options
like CPUQuota working correctly until corosync is stopped.
+Also when this option is used together with cgroup2 and systemd
+it makes impossible (most of the time) for journald to add systemd specific
+metadata (most importantly _SYSTEMD_UNIT) properly, because corosync is
+moved out of cgroup created by systemd. This means
+it is not possible to filter corosync logged messages based on these metadata
+(for example using -u or _SYSTEMD_UNIT=UNIT pattern) and also running
+systemctl status doesn't display (all) corosync log messages.
+The problem is even worse because journald caches pid for some time
+(approx. 5 sec) so initial corosync messages have correct metadata.
+
.TP
allow_knet_handle_fallback
If knet handle creation fails using privileged operations, allow fallback to
--
2.27.0

View File

@ -17,12 +17,15 @@
Name: corosync
Summary: The Corosync Cluster Engine and Application Programming Interfaces
Version: 3.1.2
Version: 3.1.3
Release: 1%{?gitver}%{?dist}
License: BSD
URL: http://corosync.github.io/corosync/
Source0: http://build.clusterlabs.org/corosync/releases/%{name}-%{version}%{?gittarver}.tar.gz
Patch0: bz1948974-1-main-Add-support-for-cgroup-v2.patch
Patch1: bz1948974-2-man-Add-info-about-cgroup-v2-behavior.patch
# Runtime bits
# The automatic dependency overridden in favor of explicit version lock
Requires: corosynclib%{?_isa} = %{version}-%{release}
@ -71,6 +74,8 @@ BuildRequires: make
%prep
%setup -q -n %{name}-%{version}%{?gittarver}
%patch0 -p1 -b .bz1948974-1
%patch1 -p1 -b .bz1948974-2
%build
%if %{with runautogen}
@ -289,6 +294,11 @@ network splits)
%endif
%changelog
* Fri May 21 2021 Jan Friesse <jfriesse@redhat.com> - 3.1.3-1
- Resolves: rhbz#1948974
- New upstream release
* Wed Apr 21 2021 Jan Friesse <jfriesse@redhat.com> - 3.1.2-1
- Related: rhbz#1948974

View File

@ -1 +1 @@
SHA512 (corosync-3.1.2.tar.gz) = 8ac35c3d8d3a869dfabc4383ae7b5bc31d4cfe344082451594b571a06c0412536b04301e32e30fda09c0d0aa975124cbb7018686d93b4a94e46041990b179098
SHA512 (corosync-3.1.3.tar.gz) = 5985b6a6163cfbc2ccdad9bfb3fa1c5f56c6d1f866a783a2ddc6a04f036850e119d0a31aea9c5e73cb289c4cfb7d05a81c90389d97bd0c62f39fbcfbfdc1d9b5