diff options
author | Omar Sandoval <osandov@fb.com> | 2017-03-28 19:12:17 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-03-29 10:09:08 -0400 |
commit | 02ba8893ac9aa34fcb4ce2a9baef5615b190335a (patch) | |
tree | 772bf87a8074d74b8748e878249568627a2cce0b /block | |
parent | 0c9539a431bd4e4cbe475eb17e587f3ac06f2ae2 (diff) |
block: fix leak of q->rq_wb
CONFIG_DEBUG_TEST_DRIVER_REMOVE found a possible leak of q->rq_wb when a
request queue is reregistered. This has been a problem since wbt was
introduced, but the WARN_ON(!list_empty(&stats->callbacks)) in the
blk-stat rework exposed it. Fix it by cleaning up wbt when we unregister
the queue.
Fixes: 87760e5eef35 ("block: hook up writeback throttling")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-sysfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 833fb7f9ce9d..45854266e398 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -795,7 +795,6 @@ static void blk_release_queue(struct kobject *kobj) | |||
795 | struct request_queue *q = | 795 | struct request_queue *q = |
796 | container_of(kobj, struct request_queue, kobj); | 796 | container_of(kobj, struct request_queue, kobj); |
797 | 797 | ||
798 | wbt_exit(q); | ||
799 | if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags)) | 798 | if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags)) |
800 | blk_stat_remove_callback(q, q->poll_cb); | 799 | blk_stat_remove_callback(q, q->poll_cb); |
801 | blk_stat_free_callback(q->poll_cb); | 800 | blk_stat_free_callback(q->poll_cb); |
@@ -938,6 +937,9 @@ void blk_unregister_queue(struct gendisk *disk) | |||
938 | 937 | ||
939 | queue_flag_clear_unlocked(QUEUE_FLAG_REGISTERED, q); | 938 | queue_flag_clear_unlocked(QUEUE_FLAG_REGISTERED, q); |
940 | 939 | ||
940 | wbt_exit(q); | ||
941 | |||
942 | |||
941 | if (q->mq_ops) | 943 | if (q->mq_ops) |
942 | blk_mq_unregister_dev(disk_to_dev(disk), q); | 944 | blk_mq_unregister_dev(disk_to_dev(disk), q); |
943 | 945 | ||