Skip to contentSkip to conversation

block: Use non _rcu version of list functions for tag_set_list

PATCH Applied Daniel Wagner 3 participants 3 messages Jul 28, 2020 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Use non _rcu version of list functions for tag_set_list

tag_set_list is only accessed under the tag_set_lock lock. There is no need for using the _rcu list functions.

The _rcu list function were introduced to allow read access to the tag_set_list protected under RCU, see 705cda97ee3a ("blk-mq: Make it safe to use RCU to iterate over blk_mq_tag_set.tag_list") and 05b79413946d ("Revert "blk-mq: don't handle TAG_SHARED in restart""). Those changes got reverted later but the cleanup commit missed a couple of places to undo the changes.

Fixes 97889f9ac24f ("blk-mq: remove synchronize_rcu() from blk_mq_del_queue_tag_set()"
Cc Ming Lei <[email protected]>
---
 block/blk-mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-mq.c +2 -2
index e32cb0217135..14ee7506f32f 100644
@@ -2792,7 +2792,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_rcu(&q->tag_set_list);
+	list_del(&q->tag_set_list);
 	if (list_is_singular(&set->tag_list)) {
 		/* just transitioned to unshared */
 		set->flags &= ~BLK_MQ_F_TAG_SHARED;
@@ -2819,7 +2819,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
 	}
 	if (set->flags & BLK_MQ_F_TAG_SHARED)
 		queue_set_hctx_shared(q, true);
-	list_add_tail_rcu(&q->tag_set_list, &set->tag_list);
+	list_add_tail(&q->tag_set_list, &set->tag_list);
 
 	mutex_unlock(&set->tag_list_lock);
 }
Signature · 1 line
2.16.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Daniel Wagner

tag_set_list is only accessed under the tag_set_lock lock. There is no need for using the _rcu list functions.

The _rcu list function were introduced to allow read access to the tag_set_list protected under RCU, see 705cda97ee3a ("blk-mq: Make it safe to use RCU to iterate over blk_mq_tag_set.tag_list") and 05b79413946d ("Revert "blk-mq: don't handle TAG_SHARED in restart""). Those changes got reverted later but the cleanup commit missed a couple of places to undo the changes.

Fixes 97889f9ac24f ("blk-mq: remove synchronize_rcu() from blk_mq_del_queue_tag_set()"
Cc Ming Lei <[email protected]>
---
  block/blk-mq.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-mq.c +1 -1
index e32cb0217135..14ee7506f32f 100644
@@ -2792,7 +2792,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_rcu(&q->tag_set_list);
+	list_del(&q->tag_set_list);
  	if (list_is_singular(&set->tag_list)) {
  		/* just transitioned to unshared */
  		set->flags &= ~BLK_MQ_F_TAG_SHARED;

block/blk-mq.c static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set, · line 2825

Quoted 8 lines
block/blk-mq.c +1 -1
@@ -2819,7 +2819,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
  	}
  	if (set->flags & BLK_MQ_F_TAG_SHARED)
  		queue_set_hctx_shared(q, true);
-	list_add_tail_rcu(&q->tag_set_list, &set->tag_list);
+	list_add_tail(&q->tag_set_list, &set->tag_list);
 
  	mutex_unlock(&set->tag_list_lock);
  }

Indeed.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke            Teamlead Storage & Networking
[email protected]                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
maintainer Applied
#2 lore raw
In reply to Daniel Wagner
Quoted 9 lines · Daniel Wagner

tag_set_list is only accessed under the tag_set_lock lock. There is no need for using the _rcu list functions.

The _rcu list function were introduced to allow read access to the tag_set_list protected under RCU, see 705cda97ee3a ("blk-mq: Make it safe to use RCU to iterate over blk_mq_tag_set.tag_list") and 05b79413946d ("Revert "blk-mq: don't handle TAG_SHARED in restart""). Those changes got reverted later but the cleanup commit missed a couple of places to undo the changes.

Applied, thanks.

Signature · 1 line
Jens Axboe