Compare commits

...

2 Commits

Author SHA1 Message Date
Michal Koutný 78fb091995
Merge 1c551abc85 into 3a41a21666 2024-09-15 17:34:52 +00:00
Michal Koutný 1c551abc85 core/cgroup: Apply IODevice*= directives in configured order
Different device paths may resolve to same device node
(lookup_block_device()), e.g.
        IOReadBandwidthMax=/dev/sda1 18879
        IOReadBandwidthMax=/dev/sda2 18878
where both partitions resolve to /dev/sda and when these values are
applied (they are associated with original paths, i.e. as if applied for
different device) in the order from io_device_limits.

The parsing code prepends, so they end up in reverse order wrt config
file. Switch the direction so that the order of application matches the
order of configuration -- i.e. semantics in all other unit file
directives.

Apply same change to all directives that use per-device lists. (The
question whether partitions should be resolved to base device is
independent.)

Fixes #34126
2024-09-13 19:36:03 +02:00
1 changed files with 5 additions and 5 deletions

View File

@ -4263,7 +4263,7 @@ int config_parse_io_device_weight(
w->path = TAKE_PTR(resolved);
w->weight = u;
LIST_PREPEND(device_weights, c->io_device_weights, w);
LIST_APPEND(device_weights, c->io_device_weights, w);
return 0;
}
@ -4334,7 +4334,7 @@ int config_parse_io_device_latency(
l->path = TAKE_PTR(resolved);
l->target_usec = usec;
LIST_PREPEND(device_latencies, c->io_device_latencies, l);
LIST_APPEND(device_latencies, c->io_device_latencies, l);
return 0;
}
@ -4420,7 +4420,7 @@ int config_parse_io_limit(
for (CGroupIOLimitType i = 0; i < _CGROUP_IO_LIMIT_TYPE_MAX; i++)
l->limits[i] = cgroup_io_limit_defaults[i];
LIST_PREPEND(device_limits, c->io_device_limits, l);
LIST_APPEND(device_limits, c->io_device_limits, l);
}
l->limits[type] = num;
@ -4501,7 +4501,7 @@ int config_parse_blockio_device_weight(
w->path = TAKE_PTR(resolved);
w->weight = u;
LIST_PREPEND(device_weights, c->blockio_device_weights, w);
LIST_APPEND(device_weights, c->blockio_device_weights, w);
return 0;
}
@ -4588,7 +4588,7 @@ int config_parse_blockio_bandwidth(
b->rbps = CGROUP_LIMIT_MAX;
b->wbps = CGROUP_LIMIT_MAX;
LIST_PREPEND(device_bandwidths, c->blockio_device_bandwidths, b);
LIST_APPEND(device_bandwidths, c->blockio_device_bandwidths, b);
}
if (read)