diff options
author | Ming Lei <tom.leiming@gmail.com> | 2017-02-22 18:14:00 +0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-03-08 09:56:12 -0700 |
commit | 7ea5fe31c12dd8bcf4a9c5a4a7e8e23826a9a3b8 (patch) | |
tree | 6a9e862fb8ceccf5c64663630d5c2df1f5535656 /block/blk-mq.c | |
parent | 737f98cfe7de8df7433a4d846850aa8efa44bd48 (diff) | |
download | linux-7ea5fe31c12dd8bcf4a9c5a4a7e8e23826a9a3b8.tar.bz2 |
blk-mq: make lifetime consitent between q/ctx and its kobject
Currently from kobject view, both q->mq_kobj and ctx->kobj can
be released during one cycle of blk_mq_register_dev() and
blk_mq_unregister_dev(). Actually, sw queue's lifetime is
same with its request queue's, which is covered by request_queue->kobj.
So we don't need to call kobject_put() for the two kinds of
kobject in __blk_mq_unregister_dev(), instead we do that
in release handler of request queue.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r-- | block/blk-mq.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index ed4b55176cdd..b985c236f50f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2264,7 +2264,12 @@ void blk_mq_release(struct request_queue *q) kfree(q->queue_hw_ctx); - /* ctx kobj stays in queue_ctx */ + /* + * release .mq_kobj and sw queue's kobject now because + * both share lifetime with request queue. + */ + blk_mq_sysfs_deinit(q); + free_percpu(q->queue_ctx); } |