diff options
author | Tejun Heo <tj@kernel.org> | 2012-06-04 02:21:00 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-06-04 04:03:21 -0400 |
commit | 9b2ea86bc9e940950a088e9795ab28f006e73276 (patch) | |
tree | 8bb42b9a25bd723fe838cc6a4fa3b077a02e50b4 /block/blk-cgroup.c | |
parent | ffea73fc723a12fdde4c9fb3fcce5d154d1104a1 (diff) |
blkcg: fix blkg_alloc() failure path
When policy data allocation fails in the middle, blkg_alloc() invokes
blkg_free() to destroy the half constructed blkg. This ends up
calling pd_exit_fn() on policy datas which didn't go through
pd_init_fn(). Fix it by making blkg_alloc() call pd_init_fn()
immediately after each policy data allocation.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r-- | block/blk-cgroup.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 02cf6335e9bd..4ab7420ba465 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -125,12 +125,8 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q) | |||
125 | 125 | ||
126 | blkg->pd[i] = pd; | 126 | blkg->pd[i] = pd; |
127 | pd->blkg = blkg; | 127 | pd->blkg = blkg; |
128 | } | ||
129 | |||
130 | /* invoke per-policy init */ | ||
131 | for (i = 0; i < BLKCG_MAX_POLS; i++) { | ||
132 | struct blkcg_policy *pol = blkcg_policy[i]; | ||
133 | 128 | ||
129 | /* invoke per-policy init */ | ||
134 | if (blkcg_policy_enabled(blkg->q, pol)) | 130 | if (blkcg_policy_enabled(blkg->q, pol)) |
135 | pol->pd_init_fn(blkg); | 131 | pol->pd_init_fn(blkg); |
136 | } | 132 | } |