On Sun, May 3, 2020 at 2:35 AM Nir Soffer <nirsof(a)gmail.com> wrote:
sched_setscheduler() requires root, but we called it after dropping
privileges, so it always failed:
2020-02-13 12:34:19 1480 [8866]: sanlock daemon started 3.8.0 host
a08359de-225c-4c21-a7d6-3623bb3bd6fb.host4
2020-02-13 12:34:19 1480 [8866]: set scheduler RR|RESET_ON_FORK priority 99 failed:
Operation not permitted
Move setup_priority up before we drop privileges.
With this change sanlock runs now with RR scheduler and expected
priority:
$ ps -o cmd,cls,rtprio -p 2275
CMD CLS RTPRIO
/usr/sbin/sanlock daemon RR 99
There is one issue, this works on Fedora but not on RHEL. On RHEL the
call always fail,
and on Fedora, setting priority works even without this change, so
this change does not
solve the problem.
Looks like the way to use real time scheduler in RHEL 8 is using systemd:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_fo...
I'll send another patch.
Not running with real time scheduler may be the reason we see random
failures to write lockspace in oVirt system tests:
https://bugzilla.redhat.com/1247135
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
src/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 8c6eef8..ebc0b11 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1750,14 +1750,14 @@ static int do_daemon(void)
setup_host_name();
+ setup_priority();
+
setup_uid_gid();
uname(&nodename);
log_warn("sanlock daemon started %s host %s (%s)", VERSION,
our_host_name_global, nodename.nodename);
- setup_priority();
-
rv = thread_pool_create(DEFAULT_MIN_WORKER_THREADS, com.max_worker_threads);
if (rv < 0)
goto out;
--
2.25.4