Thread (10 messages) 10 messages, 2 authors, 2018-09-26
STALE2849d REVIEWED: 5 (4M)
Revisions (7)
  1. v7 [diff vs current]
  2. v7 [diff vs current]
  3. v7 [diff vs current]
  4. v8 [diff vs current]
  5. v9 [diff vs current]
  6. v10 [diff vs current]
  7. v11 current

[PATCH v11 6/8] block: Allow unfreezing of a queue while requests are in progress

From: Bart Van Assche <bvanassche@acm.org>
Date: 2018-09-26 21:01:08
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

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 <bvanassche@acm.org>
Reviewed-by: Ming Lei <redacted>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Jianchao Wang <redacted>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <redacted>
---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 85a1c1a59c72..96d501e8663c 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);
 	}
 }
-- 
2.19.0.605.g01d371f741-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help