Skip to content

Commit

Permalink
block: fix leak of q->rq_wb
Browse files Browse the repository at this point in the history
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: 87760e5 ("block: hook up writeback throttling")
Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
osandov authored and axboe committed Mar 29, 2017
1 parent 0c9539a commit 02ba889
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,6 @@ static void blk_release_queue(struct kobject *kobj)
struct request_queue *q =
container_of(kobj, struct request_queue, kobj);

wbt_exit(q);
if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags))
blk_stat_remove_callback(q, q->poll_cb);
blk_stat_free_callback(q->poll_cb);
Expand Down Expand Up @@ -938,6 +937,9 @@ void blk_unregister_queue(struct gendisk *disk)

queue_flag_clear_unlocked(QUEUE_FLAG_REGISTERED, q);

wbt_exit(q);


if (q->mq_ops)
blk_mq_unregister_dev(disk_to_dev(disk), q);

Expand Down

0 comments on commit 02ba889

Please sign in to comment.