From: Bart Van Assche Date: Wed, 26 Sep 2018 21:01:08 +0000 (-0700) Subject: block: Allow unfreezing of a queue while requests are in progress X-Git-Tag: v4.20-rc1~191^2~134 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bdd6316094e0370cd183bc979dd7e322b68dc993;p=thirdparty%2Fkernel%2Flinux.git block: Allow unfreezing of a queue while requests are in progress A later patch will call blk_freeze_queue_start() followed by blk_mq_unfreeze_queue() without waiting for q_usage_counter to drop to zero. Make sure that this doesn't cause a kernel warning to appear by switching from percpu_ref_reinit() to percpu_ref_resurrect(). The former namely requires that the refcount it operates on is zero. Signed-off-by: Bart Van Assche Reviewed-by: Ming Lei Reviewed-by: Christoph Hellwig Cc: Jianchao Wang Cc: Hannes Reinecke Cc: Johannes Thumshirn Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq.c b/block/blk-mq.c index 85a1c1a59c727..96d501e8663ca 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -198,7 +198,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q) freeze_depth = atomic_dec_return(&q->mq_freeze_depth); WARN_ON_ONCE(freeze_depth < 0); if (!freeze_depth) { - percpu_ref_reinit(&q->q_usage_counter); + percpu_ref_resurrect(&q->q_usage_counter); wake_up_all(&q->mq_freeze_wq); } }