Merge pull request #21503 from poettering/ioprio-fix
work around linux 5.15 ioprio API breakage
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "fileio.h"
|
||||
#include "hexdecoct.h"
|
||||
#include "io-util.h"
|
||||
#include "ioprio-util.h"
|
||||
#include "journal-file.h"
|
||||
#include "missing_ioprio.h"
|
||||
#include "mountpoint-util.h"
|
||||
@@ -2810,7 +2811,7 @@ int bus_exec_context_set_transient_property(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
c->ioprio = ioprio_prio_value(q, ioprio_prio_data(c->ioprio));
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(q, ioprio_prio_data(c->ioprio)));
|
||||
c->ioprio_set = true;
|
||||
|
||||
unit_write_settingf(u, flags, name, "IOSchedulingClass=%s", s);
|
||||
@@ -2829,7 +2830,7 @@ int bus_exec_context_set_transient_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid IO scheduling priority: %i", p);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
c->ioprio = ioprio_prio_value(ioprio_prio_class(c->ioprio), p);
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(ioprio_prio_class(c->ioprio), p));
|
||||
c->ioprio_set = true;
|
||||
|
||||
unit_write_settingf(u, flags, name, "IOSchedulingPriority=%i", p);
|
||||
|
||||
+4
-3
@@ -63,6 +63,7 @@
|
||||
#include "glob-util.h"
|
||||
#include "hexdecoct.h"
|
||||
#include "io-util.h"
|
||||
#include "ioprio-util.h"
|
||||
#include "label.h"
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
@@ -5068,7 +5069,7 @@ void exec_context_init(ExecContext *c) {
|
||||
assert(c);
|
||||
|
||||
c->umask = 0022;
|
||||
c->ioprio = ioprio_prio_value(IOPRIO_CLASS_BE, 0);
|
||||
c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO;
|
||||
c->cpu_sched_policy = SCHED_OTHER;
|
||||
c->syslog_priority = LOG_DAEMON|LOG_INFO;
|
||||
c->syslog_level_prefix = true;
|
||||
@@ -6020,9 +6021,9 @@ int exec_context_get_effective_ioprio(const ExecContext *c) {
|
||||
|
||||
p = ioprio_get(IOPRIO_WHO_PROCESS, 0);
|
||||
if (p < 0)
|
||||
return ioprio_prio_value(IOPRIO_CLASS_BE, 4);
|
||||
return IOPRIO_DEFAULT_CLASS_AND_PRIO;
|
||||
|
||||
return p;
|
||||
return ioprio_normalize(p);
|
||||
}
|
||||
|
||||
bool exec_context_get_effective_mount_apivfs(const ExecContext *c) {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "fs-util.h"
|
||||
#include "hexdecoct.h"
|
||||
#include "io-util.h"
|
||||
#include "ioprio-util.h"
|
||||
#include "ip-protocol-list.h"
|
||||
#include "journal-file.h"
|
||||
#include "limits-util.h"
|
||||
@@ -1416,7 +1417,7 @@ int config_parse_exec_io_class(const char *unit,
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
c->ioprio_set = false;
|
||||
c->ioprio = ioprio_prio_value(IOPRIO_CLASS_BE, 0);
|
||||
c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1426,7 +1427,7 @@ int config_parse_exec_io_class(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
c->ioprio = ioprio_prio_value(x, ioprio_prio_data(c->ioprio));
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(x, ioprio_prio_data(c->ioprio)));
|
||||
c->ioprio_set = true;
|
||||
|
||||
return 0;
|
||||
@@ -1453,7 +1454,7 @@ int config_parse_exec_io_priority(const char *unit,
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
c->ioprio_set = false;
|
||||
c->ioprio = ioprio_prio_value(IOPRIO_CLASS_BE, 0);
|
||||
c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1463,7 +1464,7 @@ int config_parse_exec_io_priority(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
c->ioprio = ioprio_prio_value(ioprio_prio_class(c->ioprio), i);
|
||||
c->ioprio = ioprio_normalize(ioprio_prio_value(ioprio_prio_class(c->ioprio), i));
|
||||
c->ioprio_set = true;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user