summaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-05-24 10:23:22 +0200
committerJens Axboe <jaxboe@fusionio.com>2011-05-24 10:23:22 +0200
commit1547010e6e15a3f44f49381246421a1e19de526e (patch)
tree560796824e489a5d5c0b6de7a143d9a48a558d83 /block/cfq-iosched.c
parentcfq-iosched: remove unused 'group_changed' in cfq_service_tree_add() (diff)
downloadlinux-1547010e6e15a3f44f49381246421a1e19de526e.tar.xz
linux-1547010e6e15a3f44f49381246421a1e19de526e.zip
cfq-iosched: free cic_index if cfqd allocation fails
When struct cfq_data allocation fails, cic_index need to be freed. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 6dd2179cf1a4..7c52d6888924 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3973,8 +3973,12 @@ static void *cfq_init_queue(struct request_queue *q)
return NULL;
cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
- if (!cfqd)
+ if (!cfqd) {
+ spin_lock(&cic_index_lock);
+ ida_remove(&cic_index_ida, i);
+ spin_unlock(&cic_index_lock);
return NULL;
+ }
/*
* Don't need take queue_lock in the routine, since we are