blk-mq: blk_mq_freeze_queue() should allow nesting
authorTejun Heo <tj@kernel.org>
Sat, 16 Aug 2014 12:02:24 +0000 (08:02 -0400)
committerJens Axboe <axboe@fb.com>
Fri, 22 Aug 2014 01:37:51 +0000 (20:37 -0500)
commitcddd5d17642cc6881352732693c2ae6930e9ce65
tree5fad9444dbe5b3d2347d43c2bfe77383573b9031
parenta68aafa5b297d99c2d0c38689089a752126e9e79
blk-mq: blk_mq_freeze_queue() should allow nesting

While converting to percpu_ref for freezing, add703fda981 ("blk-mq:
use percpu_ref for mq usage count") incorrectly made
blk_mq_freeze_queue() misbehave when freezing is nested due to
percpu_ref_kill() being invoked on an already killed ref.

Fix it by making blk_mq_freeze_queue() kill and kick the queue only
for the outermost freeze attempt.  All the nested ones can simply wait
for the ref to reach zero.

While at it, remove unnecessary @wake initialization from
blk_mq_unfreeze_queue().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq.c