]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: normalize ioprio values we acquire from kernel
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Nov 2021 14:39:43 +0000 (15:39 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Nov 2021 15:12:15 +0000 (16:12 +0100)
Linux 5.15 broke API in ioprio_get(): instead of returning
IOPRIO_CLASS_NONE when that's set it now returns IOPRIO_CLASS_BE, which
is what this actually is (the former is just an alias for the latter
with a priority value of 4).

Let's hide the differences between old and new kernels here, and always
normalize to what the new kernels do.

src/core/execute.c

index c30e15f614111b1365c1a0c92087e8a1c4c40370..aa1193e0676fceb60bb9b82ed3044faaae71d33d 100644 (file)
@@ -6023,7 +6023,7 @@ int exec_context_get_effective_ioprio(const ExecContext *c) {
         if (p < 0)
                 return IOPRIO_DEFAULT_CLASS_AND_PRIO;
 
-        return p;
+        return ioprio_normalize(p);
 }
 
 bool exec_context_get_effective_mount_apivfs(const ExecContext *c) {