* Mon Dec 7 2020 Klaus Wenninger <kwenning@redhat.com> - 1.4.2-1

- Rebase to upstream v1.4.2
- Conflict with pacemaker that doesn't have pacemakerd-api
- Set default to not do startup/shutdown-syncing via pacemakerd-api
  but enable in template-config
This commit is contained in:
Klaus Wenninger 2020-12-07 23:34:59 +01:00
parent 3045a1b9b1
commit 8a938dfd09
5 changed files with 30 additions and 1709 deletions

View File

@ -1,82 +0,0 @@
From 1d2a7b8d059d4f090b351b8decca0ddf274c82a0 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Wed, 20 Nov 2019 15:20:19 +0100
Subject: [PATCH] Fix: regressions.sh: make parameter passing consistent
---
tests/regressions.sh | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tests/regressions.sh b/tests/regressions.sh
index 6cfb303..7ab80be 100755
--- a/tests/regressions.sh
+++ b/tests/regressions.sh
@@ -32,7 +32,7 @@
: ${SBD_USE_DM:="yes"}
sbd() {
- LD_PRELOAD=${SBD_PRELOAD} SBD_WATCHDOG_TIMEOUT=5 SBD_DEVICE="${SBD_DEVICE}" SBD_PRELOAD_LOG=${SBD_PRELOAD_LOG} SBD_WATCHDOG_DEV=/dev/watchdog setsid ${SBD_BINARY} -p ${SBD_PIDFILE} $*
+ LD_PRELOAD=${SBD_PRELOAD} SBD_WATCHDOG_TIMEOUT=5 SBD_DEVICE="${SBD_DEVICE}" SBD_PRELOAD_LOG=${SBD_PRELOAD_LOG} SBD_WATCHDOG_DEV=/dev/watchdog setsid ${SBD_BINARY} -p ${SBD_PIDFILE} "$@"
}
sbd_wipe_disk() {
@@ -98,26 +98,26 @@ sbd_daemon_cleanup() {
pkill -TERM --pidfile ${SBD_PIDFILE} 2>/dev/null
sleep 5
pkill -KILL --pidfile ${SBD_PIDFILE} 2>/dev/null
- pkill -KILL --parent $(cat ${SBD_PIDFILE} 2>/dev/null) 2>/dev/null
+ pkill -KILL --parent "$(cat ${SBD_PIDFILE} 2>/dev/null)" 2>/dev/null
echo > ${SBD_PIDFILE}
}
_ok() {
- echo -- $@
- $@
+ echo "-- $*"
+ "$@"
rc=$?
if [ $rc -ne 0 ]; then
- echo "$@ failed with $rc"
+ echo "$* failed with $rc"
exit $rc
fi
}
_no() {
- echo -- $@
- $@
+ echo "-- $*"
+ "$@"
rc=$?
if [ $rc -eq 0 ]; then
- echo "$@ did NOT fail ($rc)"
+ echo "$* did NOT fail ($rc)"
exit $rc
fi
return 0
@@ -126,7 +126,7 @@ _no() {
_in_log() {
grep "$@" ${SBD_PRELOAD_LOG} >/dev/null
if [ $? -ne 0 ]; then
- echo "didn't find '$@' in log:"
+ echo "didn't find '$*' in log:"
cat ${SBD_PRELOAD_LOG}
sbd_daemon_cleanup
exit 1
@@ -227,10 +227,10 @@ test_stall_inquisitor() {
sbd_daemon_cleanup
sbd -d ${D[1]} -d ${D[2]} -d ${D[3]} -n test-1 watch
sleep 10
- _ok kill -0 $(cat ${SBD_PIDFILE})
- kill -STOP $(cat ${SBD_PIDFILE})
+ _ok kill -0 "$(cat ${SBD_PIDFILE})"
+ kill -STOP "$(cat ${SBD_PIDFILE})"
sleep 10
- kill -CONT $(cat ${SBD_PIDFILE}) 2>/dev/null
+ kill -CONT "$(cat ${SBD_PIDFILE})" 2>/dev/null
_in_log "watchdog fired"
}
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -1,152 +0,0 @@
From 4bc08cf76fc01e98cbec76bf32bb333b77f69217 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Thu, 27 Feb 2020 19:02:57 +0100
Subject: [PATCH] Fix: scheduling: overhaul the whole thing
- prevent possible lockup when format in proc changes
- properly get and handle scheduler policy & prio
- on SCHED_RR failing push to the max with SCHED_OTHER
---
src/sbd-common.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 44 insertions(+), 12 deletions(-)
diff --git a/src/sbd-common.c b/src/sbd-common.c
index 9ec43b2..c2da758 100644
--- a/src/sbd-common.c
+++ b/src/sbd-common.c
@@ -26,6 +26,9 @@
#include <pwd.h>
#include <unistd.h>
#include <dirent.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <limits.h>
#ifdef _POSIX_MEMLOCK
# include <sys/mman.h>
@@ -298,7 +301,7 @@ watchdog_populate_list(void)
FILE *file;
snprintf(entry_name, sizeof(entry_name),
- SYS_CLASS_WATCHDOG "/%s/dev", entry->d_name);
+ SYS_CLASS_WATCHDOG "/%s/dev", entry->d_name);
file = fopen(entry_name, "r");
if (file) {
int major, minor;
@@ -667,7 +670,7 @@ static int get_realtime_budget(void)
{
FILE *f;
char fname[PATH_MAX];
- int res = -1, lnum = 0;
+ int res = -1, lnum = 0, num;
char *cgroup = NULL, *namespecs = NULL;
snprintf(fname, PATH_MAX, "/proc/%jd/cgroup", (intmax_t)getpid());
@@ -677,7 +680,8 @@ static int get_realtime_budget(void)
(intmax_t)getpid());
goto exit_res;
}
- while( fscanf(f, "%d:%m[^:]:%m[^\n]", &lnum, &namespecs, &cgroup) !=EOF ) {
+ while( (num = fscanf(f, "%d:%m[^:]:%m[^\n]\n", &lnum,
+ &namespecs, &cgroup)) !=EOF ) {
if (namespecs && strstr(namespecs, "cpuacct")) {
free(namespecs);
break;
@@ -690,6 +694,11 @@ static int get_realtime_budget(void)
free(namespecs);
namespecs = NULL;
}
+ /* not to get stuck if format changes */
+ if ((num < 3) && ((fscanf(f, "%*[^\n]") == EOF) ||
+ (fscanf(f, "\n") == EOF))) {
+ break;
+ }
}
fclose(f);
if (cgroup == NULL) {
@@ -776,15 +785,17 @@ sbd_make_realtime(int priority, int stackgrowK, int heapgrowK)
return;
}
+do {
#ifdef SCHED_RR
if (move_to_root_cgroup) {
sbd_move_to_root_cgroup(enforce_moving_to_root_cgroup);
}
{
- int pcurrent = 0;
int pmin = sched_get_priority_min(SCHED_RR);
int pmax = sched_get_priority_max(SCHED_RR);
+ struct sched_param sp;
+ int pcurrent;
if (priority == 0) {
priority = pmax;
@@ -794,26 +805,47 @@ sbd_make_realtime(int priority, int stackgrowK, int heapgrowK)
priority = pmax;
}
- pcurrent = sched_getscheduler(0);
- if (pcurrent < 0) {
+ if (sched_getparam(0, &sp) < 0) {
cl_perror("Unable to get scheduler priority");
- } else if(pcurrent < priority) {
- struct sched_param sp;
+ } else if ((pcurrent = sched_getscheduler(0)) < 0) {
+ cl_perror("Unable to get scheduler policy");
+ } else if ((pcurrent == SCHED_RR) &&
+ (sp.sched_priority >= priority)) {
+ cl_log(LOG_INFO,
+ "Stay with priority (%d) for policy SCHED_RR",
+ sp.sched_priority);
+ break;
+ } else {
memset(&sp, 0, sizeof(sp));
sp.sched_priority = priority;
if (sched_setscheduler(0, SCHED_RR, &sp) < 0) {
- cl_perror("Unable to set scheduler priority to %d", priority);
+ cl_perror(
+ "Unable to set scheduler policy to SCHED_RR priority %d",
+ priority);
} else {
- cl_log(LOG_INFO, "Scheduler priority is now %d", priority);
+ cl_log(LOG_INFO,
+ "Scheduler policy is now SCHED_RR priority %d",
+ priority);
+ break;
}
}
}
#else
- cl_log(LOG_ERR, "System does not support updating the scheduler priority");
+ cl_log(LOG_ERR, "System does not support updating the scheduler policy");
+#endif
+#ifdef PRIO_PGRP
+ if (setpriority(PRIO_PGRP, 0, INT_MIN) < 0) {
+ cl_perror("Unable to raise the scheduler priority");
+ } else {
+ cl_log(LOG_INFO, "Scheduler priority raised to the maximum");
+ }
+#else
+ cl_perror("System does not support setting the scheduler priority");
#endif
+} while (0);
sbd_memlock(heapgrowK, stackgrowK);
}
@@ -826,7 +858,7 @@ maximize_priority(void)
return;
}
- sbd_make_realtime(0, 256, 256);
+ sbd_make_realtime(0, 256, 256);
if (ioprio_set(IOPRIO_WHO_PROCESS, getpid(),
IOPRIO_PRIO_VALUE(IOPRIO_CLASS_RT, 1)) != 0) {
--
1.8.3.1

View File

@ -15,21 +15,28 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global commit 25fce8a7d5e8cd5abc2379077381b10bd6cec183
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global longcommit 044643922c3044c0bac2f91b1382ff3f2c64a4a2
%global shortcommit %(echo %{longcommit}|cut -c1-8)
%global github_owner Clusterlabs
%global buildnum 7
%global buildnum 1
%ifarch s390x s390
# minimum timeout on LPAR diag288 watchdog is 15s
%global watchdog_timeout_default 15
%else
%global watchdog_timeout_default 5
%endif
%global sync_resource_startup_default no
%global sync_resource_startup_sysconfig yes
Name: sbd
Summary: Storage-based death
License: GPLv2+
Version: 1.4.1
Release: %{buildnum}%{?dist}.1
Version: 1.4.2
Release: %{buildnum}%{?dist}
Url: https://github.com/%{github_owner}/%{name}
Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
Patch0: 0001-Fix-regressions.sh-make-parameter-passing-consistent.patch
Patch1: 0002-Doc-add-environment-section-to-man-page.patch
Patch2: 0003-Fix-scheduling-overhaul-the-whole-thing.patch
Source0: https://github.com/%{github_owner}/%{name}/archive/%{longcommit}/%{name}-%{longcommit}.tar.gz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libuuid-devel
@ -44,6 +51,7 @@ BuildRequires: pkgconfig
BuildRequires: make
BuildRequires: systemd
Conflicts: fence-agents-sbd < 4.5.0
Conflicts: pacemaker-libs < 2.0.5-10
%if 0%{?rhel}
ExclusiveArch: i686 x86_64 s390x aarch64 ppc64le
@ -68,18 +76,16 @@ regression-testing sbd.
###########################################################
%prep
%autosetup -n %{name}-%{commit} -p1
%ifarch s390x s390
sed -i src/sbd.sysconfig -e "s/Default: 5/Default: 15/"
sed -i src/sbd.sysconfig -e "s/SBD_WATCHDOG_TIMEOUT=5/SBD_WATCHDOG_TIMEOUT=15/"
%endif
%autosetup -n %{name}-%{longcommit} -p1
###########################################################
%build
./autogen.sh
export CFLAGS="$RPM_OPT_FLAGS -Wall -Werror"
%configure
%configure --with-watchdog-timeout-default=%{watchdog_timeout_default} \
--with-sync-resource-startup-default=%{sync_resource_startup_default} \
--with-sync-resource-startup-sysconfig=%{sync_resource_startup_sysconfig}
make %{?_smp_mflags}
###########################################################
@ -133,6 +139,8 @@ fi
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/sysconfig/sbd
%{_sbindir}/sbd
%{_datadir}/sbd
%{_datadir}/pkgconfig/sbd.pc
%exclude %{_datadir}/sbd/regressions.sh
%doc %{_mandir}/man8/sbd*
%if %{defined _unitdir}
@ -149,6 +157,12 @@ fi
%{_libdir}/libsbdtestbed*
%changelog
* Mon Dec 7 2020 Klaus Wenninger <kwenning@redhat.com> - 1.4.2-1
- Rebase to upstream v1.4.2
- Conflict with pacemaker that doesn't have pacemakerd-api
- Set default to not do startup/shutdown-syncing via pacemakerd-api
but enable in template-config
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.1-7.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (sbd-25fce8a7d5e8cd5abc2379077381b10bd6cec183.tar.gz) = 3b89ee0aa88282f17c8daf725a1e7a8c2f2affdcf6ff6f4ca4faf250760d778a65c5693e5df3fcc7554d60dd9b0cb1a0350e266fadb7668320f3c676d8799a29
SHA512 (sbd-044643922c3044c0bac2f91b1382ff3f2c64a4a2.tar.gz) = de8b4c06b6382a56102af85b7b9f295ccf2ee5118213c4e95c4d314b681d2dcfa58702cd1ad7de667283508d69a36499bb767f4594745883c6fca0c54e365216