aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-06-14 13:11:57 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-14 13:22:16 -0400
commit553698f944ed715dfe023b4cef07601f0ce735f0 (patch)
tree2c9019e43218a3afc92fbb32a44de794123295f4 /block
parent9cedc194a7735e5d74ad26d3825247dc65a4d98e (diff)
[PATCH] cfq-iosched: fix crash in do_div()
We don't clear the seek stat values in cfq_alloc_io_context(), and if ->seek_mean is unlucky enough to be set to -36 by chance, the first invocation of cfq_update_io_seektime() will oops with a divide by zero in do_div(). Just memset the entire cic instead of filling invididual values independently. Signed-off-by: Jens Axboe <axboe@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'block')
-rw-r--r--block/cfq-iosched.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index a46d030e092a..052b17487625 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1323,17 +1323,12 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask); 1323 struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask);
1324 1324
1325 if (cic) { 1325 if (cic) {
1326 RB_CLEAR(&cic->rb_node); 1326 memset(cic, 0, sizeof(*cic));
1327 cic->key = NULL; 1327 RB_CLEAR_COLOR(&cic->rb_node);
1328 cic->cfqq[ASYNC] = NULL;
1329 cic->cfqq[SYNC] = NULL;
1330 cic->last_end_request = jiffies; 1328 cic->last_end_request = jiffies;
1331 cic->ttime_total = 0; 1329 INIT_LIST_HEAD(&cic->queue_list);
1332 cic->ttime_samples = 0;
1333 cic->ttime_mean = 0;
1334 cic->dtor = cfq_free_io_context; 1330 cic->dtor = cfq_free_io_context;
1335 cic->exit = cfq_exit_io_context; 1331 cic->exit = cfq_exit_io_context;
1336 INIT_LIST_HEAD(&cic->queue_list);
1337 atomic_inc(&ioc_count); 1332 atomic_inc(&ioc_count);
1338 } 1333 }
1339 1334