summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-08-30 10:56:00 +0800
committerLennart Poettering <lennart@poettering.net>2013-09-10 17:12:13 +0200
commit47c0980d37a6255e411747572a00638bca35be5a (patch)
treeee786153fa5c0caba4e42e7a778f4c081804a58c
parent27722f964361a7da2532cf0a2d57a2f0dd0a09f2 (diff)
blkio bandwidth: don't clean up all of entries in blockio_device_bandwidths list
if we get BlockIOReadBandwidth="", we should only remove the read-bandwidth-entries in blockio_device_bandwidths list.
-rw-r--r--src/core/load-fragment.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 4714687955..f4a268c1ef 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2205,6 +2205,7 @@ int config_parse_blockio_bandwidth(
CGroupContext *c = data;
const char *bandwidth;
off_t bytes;
+ bool read;
size_t n;
int r;
@@ -2212,9 +2213,14 @@ int config_parse_blockio_bandwidth(
assert(lvalue);
assert(rvalue);
+ read = streq("BlockIOReadBandwidth", lvalue);
+
if (isempty(rvalue)) {
- while (c->blockio_device_bandwidths)
- cgroup_context_free_blockio_device_bandwidth(c, c->blockio_device_bandwidths);
+ CGroupBlockIODeviceBandwidth *next;
+
+ LIST_FOREACH_SAFE (device_bandwidths, b, next, c->blockio_device_bandwidths)
+ if (b->read == read)
+ cgroup_context_free_blockio_device_bandwidth(c, b);
return 0;
}
@@ -2253,7 +2259,7 @@ int config_parse_blockio_bandwidth(
b->path = path;
path = NULL;
b->bandwidth = (uint64_t) bytes;
- b->read = streq("BlockIOReadBandwidth", lvalue);
+ b->read = read;
LIST_PREPEND(CGroupBlockIODeviceBandwidth, device_bandwidths, c->blockio_device_bandwidths, b);