Skip to content

work around linux 5.15 ioprio API breakage - #21503

Merged
yuwata merged 7 commits into
systemd:mainfrom
poettering:ioprio-fix
Nov 25, 2021
Merged

yuwata merged 7 commits into
systemd:mainfrom
poettering:ioprio-fix

Conversation

@poettering

Copy link
Copy Markdown
Member

No description provided.

No actual code changes, just some splitting out.
IOPRIO_CLASS_NONE with any priority value actually is an alias for
IOPRIO_CLASS_BE with priority value 4 – which is the default ioprio for
all processes.

We got this right at one place, but wrong at three others (where we
assumed the default value was 0, not 4). Let's add a
macro that encodes this properly, and use it everywhere.
Let's always say IOPRIO_CLASS_BE when IOPRIO_CALSS_NONE is set.
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.
Let's not mention a redundant setting of "none". Let's instead only
mention "best-effort", which is the same. Also mention the default
settings properly.

(Also, while we are at it, don#t document the numeric alias, that's
totally redundant and harder to use, so no need to push people towards
it.)
Linux 5.15 broke kernel API:

torvalds/linux@e70344c

Previously setting IOPRIO_CLASS_NONE for a process would then report
IOPRIO_CLASS_NONE back. But since 5.15 it reports IOPRIO_CLASS_BE
instead. Since IOPRIO_CLASS_NONE is an alias for a special setting of
IOPRIO_CLASS_BE this makes some sense, but it's also a kernel API
breakage that our testsuite trips up on.

(I made some minimal effort to inform the kernel people about this API
breakage during the 5.15 rc phase, but noone was interested.)

Either way let's hadle this gracefully in our test suite and accept
"best-effort" too when "none" was set.

(This is only triggable if the tests are run on 5.15 with full privs)

@yuwata yuwata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@yuwata yuwata added the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Nov 25, 2021
@yuwata
yuwata merged commit c8e1633 into systemd:main Nov 25, 2021
mrc0mmand added a commit to mrc0mmand/systemd-centos-ci that referenced this pull request Nov 25, 2021
mrc0mmand added a commit to systemd/systemd-centos-ci that referenced this pull request Nov 25, 2021
@keszybz keszybz removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

tests: test_exec_ioschedulingclass: exec-ioschedulingclass-none.service: exit status 1, expected 0

3 participants