summaryrefslogtreecommitdiffstats
path: root/block/blk-wbt.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-04-11 05:29:01 -0400
committerJens Axboe <axboe@fb.com>2017-04-11 10:09:14 -0400
commit3f19cd23f3a9420fe7bd98ad41d05e45fa6d4d47 (patch)
tree1070c884072bcc98912373ca6953c2010451b1a5 /block/blk-wbt.c
parentf5c0b0910ac4c1bc93474d7593cc73622fdfc822 (diff)
block: Fix list corruption of blk stats callback list
When CFQ calls wbt_disable_default(), it will call blk_stat_remove_callback() to stop gathering IO statistics for the purposes of writeback throttling. Later, when request_queue is unregistered, wbt_exit() will call blk_stat_remove_callback() again which will try to delete callback from the list again and possibly cause list corruption. Fix the problem by making wbt_disable_default() called wbt_exit() which is properly guarded against being called multiple times. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-wbt.c')
-rw-r--r--block/blk-wbt.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index ffa80e11cf14..b3b79149d3a0 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -653,19 +653,15 @@ void wbt_set_write_cache(struct rq_wb *rwb, bool write_cache_on)
653 rwb->wc = write_cache_on; 653 rwb->wc = write_cache_on;
654} 654}
655 655
656 /* 656/*
657 * Disable wbt, if enabled by default. Only called from CFQ, if we have 657 * Disable wbt, if enabled by default. Only called from CFQ.
658 * cgroups enabled
659 */ 658 */
660void wbt_disable_default(struct request_queue *q) 659void wbt_disable_default(struct request_queue *q)
661{ 660{
662 struct rq_wb *rwb = q->rq_wb; 661 struct rq_wb *rwb = q->rq_wb;
663 662
664 if (rwb && rwb->enable_state == WBT_STATE_ON_DEFAULT) { 663 if (rwb && rwb->enable_state == WBT_STATE_ON_DEFAULT)
665 blk_stat_remove_callback(q, rwb->cb); 664 wbt_exit(q);
666 rwb->win_nsec = rwb->min_lat_nsec = 0;
667 wbt_update_limits(rwb);
668 }
669} 665}
670EXPORT_SYMBOL_GPL(wbt_disable_default); 666EXPORT_SYMBOL_GPL(wbt_disable_default);
671 667