lkml.org 
[lkml]   [2011]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] cfq-iosched: free cic_index if cfqd allocation fails
Date
When struct cfq_data allocation fails, cic_index need to be freed.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
block/cfq-iosched.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 4ceebd346710..7fe732a274b2 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3881,8 +3881,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
--
1.7.5.2


\
 
 \ /
  Last update: 2011-05-24 05:21    [W:0.061 / U:62.192 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site