summaryrefslogtreecommitdiffstats
path: root/block/blk-stat.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2017-03-21 19:20:01 -0400
committerJens Axboe <axboe@fb.com>2017-03-21 19:20:01 -0400
commita83b576c9c25cf771fb0b15ec5eb2e7510ec2f5a (patch)
treebaf705377f5e7a1d330eb0ece93f68e1aafe2161 /block/blk-stat.c
parent34dbad5d26e2f4b88e60f0e9ad03f99480802812 (diff)
block: fix stacked driver stats init and free
If a driver allocates a queue for stacked usage, then it does not currently get stats allocated. This causes the later init of, eg, writeback throttling to blow up. Move the init to the queue allocation instead. Additionally, allow a NULL callback unregistration. This avoids having the caller check for that, fixing another oops on removal of a block device that doesn't have poll stats allocated. Fixes: 34dbad5d26e2 ("blk-stat: convert to callback-based statistics reporting") Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-stat.c')
-rw-r--r--block/blk-stat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/blk-stat.c b/block/blk-stat.c
index 0d8721a60db9..188b535cf4d6 100644
--- a/block/blk-stat.c
+++ b/block/blk-stat.c
@@ -210,7 +210,8 @@ static void blk_stat_free_callback_rcu(struct rcu_head *head)
210 210
211void blk_stat_free_callback(struct blk_stat_callback *cb) 211void blk_stat_free_callback(struct blk_stat_callback *cb)
212{ 212{
213 call_rcu(&cb->rcu, blk_stat_free_callback_rcu); 213 if (cb)
214 call_rcu(&cb->rcu, blk_stat_free_callback_rcu);
214} 215}
215EXPORT_SYMBOL_GPL(blk_stat_free_callback); 216EXPORT_SYMBOL_GPL(blk_stat_free_callback);
216 217