]> git.baikalelectronics.ru Git - kernel.git/commit
blk-mq: fix q->mq_usage_counter access race
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 26 Sep 2015 17:09:22 +0000 (02:09 +0900)
committerJens Axboe <axboe@fb.com>
Tue, 29 Sep 2015 17:32:48 +0000 (11:32 -0600)
commitdf708b63d6596ba82dcf9dab6e337d2f07d49786
tree6ebd842a4a9ef717cfc4a05c99fddede9fb4328e
parent16820ef9495de5f0aac9921f0146a65493e5e7c3
blk-mq: fix q->mq_usage_counter access race

CPU hotplug handling for blk-mq (blk_mq_queue_reinit) accesses
q->mq_usage_counter while freezing all request queues in all_q_list.
On the other hand, q->mq_usage_counter is deinitialized in
blk_mq_free_queue() before deleting the queue from all_q_list.

So if CPU hotplug event occurs in the window, percpu_ref_kill() is
called with q->mq_usage_counter which has already been marked dead,
and it triggers warning.  Fix it by deleting the queue from all_q_list
earlier than destroying q->mq_usage_counter.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Cc: Ming Lei <tom.leiming@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c