summaryrefslogtreecommitdiffstats
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
parent20359f27e8ff115f7cddf3da5b3a6cdcca2e650d (diff)
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>
-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 6dd2179cf1a..7c52d688892 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