Re: [PATCH] blk-mq: blk_mq_freeze_queue() should allow nesting

From: Jens Axboe
Date: Sun Aug 17 2014 - 13:47:31 EST


On 2014-08-16 06:02, Tejun Heo wrote:
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@xxxxxxxxxx>
Reported-by: Ming Lei <ming.lei@xxxxxxxxxxxxx>
---
Hello, Ming, Jens.

I think something like this is the correct solution. Freezing should
be nestable after all. Ming, can you please verify whether this fixes
the issue you're seeing?

I had completely missed that nesting no longer works, which it of course should. Mings patch is still fine, however, as we don't need the freeze at that point. But I'll apply yours as well so that nesting is restored, it might be important for other cases. And it's one of those things that we should not have to worry about.

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/