@@ -2946,7 +2946,7 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
struct blk_mq_tag_set *set = q->tag_set;
mutex_lock(&set->tag_list_lock);
- list_del(&q->tag_set_list);
+ list_del_rcu(&q->tag_set_list);
if (list_is_singular(&set->tag_list)) {
/* just transitioned to unshared */
set->flags &= ~BLK_MQ_F_TAG_QUEUE_SHARED;
@@ -2954,7 +2954,11 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
blk_mq_update_tag_set_shared(set, false);
}
mutex_unlock(&set->tag_list_lock);
- INIT_LIST_HEAD(&q->tag_set_list);
+ /*
+ * Calling synchronize_rcu() and INIT_LIST_HEAD(&q->tag_set_list) is
+ * not necessary since blk_mq_del_queue_tag_set() is only called from
+ * blk_cleanup_queue().
+ */
}
static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
Since the next patch in this series will use RCU to iterate over tag_list, make this safe. Note: call_rcu() is already used to free the request queue. From blk-sysfs.c: call_rcu(&q->rcu_head, blk_free_queue_rcu); See also: * Commit 705cda97ee3a ("blk-mq: Make it safe to use RCU to iterate over blk_mq_tag_set.tag_list"; v4.12). * Commit 08c875cbf481 ("block: Use non _rcu version of list functions for tag_set_list"; v5.9). Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Cc: Ming Lei <ming.lei@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com> Cc: John Garry <john.garry@huawei.com> Cc: Daniel Wagner <dwagner@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-mq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)