mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
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.) And apply the changes equally to DBus properties write handlers. Fixes #34126 (cherry picked from commit 0fa0dfa04465651a18107d503f9967f84bd761d1) (cherry picked from commit 00dfa7964b5e48a37596207ad8b2862b157cffaf)
This commit is contained in:
parent
964e68bf27
commit
f45acd05be
@ -1417,7 +1417,7 @@ int bus_cgroup_set_property(
|
||||
for (type = 0; type < _CGROUP_IO_LIMIT_TYPE_MAX; type++)
|
||||
a->limits[type] = cgroup_io_limit_defaults[type];
|
||||
|
||||
LIST_PREPEND(device_limits, c->io_device_limits, a);
|
||||
LIST_APPEND(device_limits, c->io_device_limits, a);
|
||||
}
|
||||
|
||||
a->limits[iol_type] = u64;
|
||||
@ -1497,7 +1497,7 @@ int bus_cgroup_set_property(
|
||||
free(a);
|
||||
return -ENOMEM;
|
||||
}
|
||||
LIST_PREPEND(device_weights, c->io_device_weights, a);
|
||||
LIST_APPEND(device_weights, c->io_device_weights, a);
|
||||
}
|
||||
|
||||
a->weight = weight;
|
||||
@ -1571,7 +1571,7 @@ int bus_cgroup_set_property(
|
||||
free(a);
|
||||
return -ENOMEM;
|
||||
}
|
||||
LIST_PREPEND(device_latencies, c->io_device_latencies, a);
|
||||
LIST_APPEND(device_latencies, c->io_device_latencies, a);
|
||||
}
|
||||
|
||||
a->target_usec = target;
|
||||
@ -1652,7 +1652,7 @@ int bus_cgroup_set_property(
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
LIST_PREPEND(device_bandwidths, c->blockio_device_bandwidths, a);
|
||||
LIST_APPEND(device_bandwidths, c->blockio_device_bandwidths, a);
|
||||
}
|
||||
|
||||
if (read)
|
||||
@ -1746,7 +1746,7 @@ int bus_cgroup_set_property(
|
||||
free(a);
|
||||
return -ENOMEM;
|
||||
}
|
||||
LIST_PREPEND(device_weights, c->blockio_device_weights, a);
|
||||
LIST_APPEND(device_weights, c->blockio_device_weights, a);
|
||||
}
|
||||
|
||||
a->weight = weight;
|
||||
|
@ -4319,7 +4319,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;
|
||||
}
|
||||
|
||||
@ -4390,7 +4390,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;
|
||||
}
|
||||
|
||||
@ -4476,7 +4476,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;
|
||||
@ -4557,7 +4557,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;
|
||||
}
|
||||
|
||||
@ -4644,7 +4644,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user