[pve-devel] [PATCH common] fix #5529: cgroup: correctly handle change_cpu_quota without a quota
Wolfgang Bumiller
w.bumiller at proxmox.com
Tue Jul 9 11:09:52 CEST 2024
The function can be called with
- neither quota nor period
- only a period (quota will be 'max')
- both
$quota was therefore defaulted to 'max' and the check for whether
values were provided should use $period instead of $quota.
Also move the defaulting-assignment into the condition for clarity.
Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
src/PVE/CGroup.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/CGroup.pm b/src/PVE/CGroup.pm
index e2839cf..4d523e2 100644
--- a/src/PVE/CGroup.pm
+++ b/src/PVE/CGroup.pm
@@ -469,8 +469,8 @@ sub change_cpu_quota {
} elsif ($ver == 2) {
# cgroupv2 environment, an undefined (unlimited) quota is defined as "max"
# in this interface:
- $quota //= 'max'; # unlimited
- if (defined($quota)) {
+ if (defined($period)) {
+ $quota //= 'max'; # unlimited
PVE::ProcFSTools::write_proc_entry("$path/cpu.max", "$quota $period");
} else {
# we're allowed to only write the quota:
--
2.39.2
More information about the pve-devel
mailing list