[PATCH 1/4] block: Move the percpu_ref_exit(&q->q_usage_counter) call into __blk_release_queue()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch makes it safe to access the queue usage counter from inside
blk_mq_run_hw_queues(). Other than deferring q_usage_counter freeing,
this patch does not change any functionality.

Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Cc: Hannes Reinecke <hare@xxxxxxxx>
Cc: James Smart <james.smart@xxxxxxxxxxxx>
Cc: Ming Lei <ming.lei@xxxxxxxxxx>
Cc: Jianchao Wang <jianchao.w.wang@xxxxxxxxxx>
Cc: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 block/blk-core.c  | 2 --
 block/blk-sysfs.c | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 4673ebe42255..fdcf6de2243f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -377,8 +377,6 @@ void blk_cleanup_queue(struct request_queue *q)
 	if (queue_is_mq(q))
 		blk_mq_free_queue(q);
 
-	percpu_ref_exit(&q->q_usage_counter);
-
 	/* @q is and will stay empty, shutdown and put */
 	blk_put_queue(q);
 }
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 422327089e0f..b8b3d69cd0a5 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -870,6 +870,7 @@ static void __blk_release_queue(struct work_struct *work)
 
 	bioset_exit(&q->bio_split);
 
+	percpu_ref_exit(&q->q_usage_counter);
 	ida_simple_remove(&blk_queue_ida, q->id);
 	call_rcu(&q->rcu_head, blk_free_queue_rcu);
 }
-- 
2.21.0.196.g041f5ea1cf98




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux