History

sched_ext: Fix stale errno in scx_sub_enable_workfn()

The nesting depth check and the cgroup online check in scx_sub_enable_workfn() reach err_disable without setting ret, so the fallback error added by commit db4e9defd2e8 ("sched_ext: Record an error on errno-only sub-enable failure") reports "scx_sub_enable() failed (0)". This is currently harmless because both paths record their own scx_error() first and the first error wins, but it leaves the fallback broken for these paths. Set -EINVAL and -ENODEV there so the fallback always reports a real errno. v2: The validate_ops() path from v1 is already fixed in for-7.3 (sub.c already has ret = scx_validate_ops()), so only the two remaining paths are addressed.

Cui Jian committed 3 months ago

Commit 00a08dd1 parent 2abee441 file · +2 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/ext/sub.c+2−0
@@ -1331,6 +1331,7 @@ void scx_sub_enable_workfn(struct kthread_work *work) · 1330 unmodified lines
13311331 if (sch->level >= SCX_SUB_MAX_DEPTH) {
13321332 scx_error(sch, "max nesting depth %d violated",
13331333 SCX_SUB_MAX_DEPTH);
1334+ ret = -EINVAL;
13341335 goto err_disable;
13351336 }
13361337
@@ -1378,6 +1379,7 @@ void scx_sub_enable_workfn(struct kthread_work *work) · 41 unmodified lines
13781379 set_cgroup_sched(sch_cgroup(sch), sch);
13791380 if (!(cgrp->self.flags & CSS_ONLINE)) {
13801381 scx_error(sch, "cgroup is not online");
1382+ ret = -ENODEV;
13811383 goto err_unlock_and_disable;
13821384 }
13831385