diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index c81b40e..c290de0 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -322,6 +322,22 @@ int blk_mq_tagset_iter(struct blk_mq_tag_set *set, void *data,
          }
      }
+    for (i = 0; i < set->nr_hw_queues; i++) {
+        struct blk_mq_tags *sched_tags = set->sched_tags[i];
+
+        if (!sched_tags)
+            continue;
+
+        for (j = 0; j < sched_tags->nr_tags; j++) {
+            if (!sched_tags->static_rqs[j])
+                continue;
+
+            ret = fn(data, sched_tags->static_rqs[j]);
+            if (ret)
+                goto out;
+        }
+    }

If both a scheduler tag and a driver tag have been assigned to a request, can this cause
blk_mq_tagset_iter() to call fn() twice for the same request?

It will, its not a big issue for reinit functionality, but it might if
used for something else. I don't think its a good idea to go down this
route.

Don't you think sched_tags should be part of the tagset (as driver tags) ?
if so, blk_mq_tagset_iter should call fn() on both scheduler and driver tags. Otherwise, let's call it blk_mq_tags_iter instead and pass struct blk_mq_tags *.

The private case of fn() == reinit() for NVMEoF RDMA can be solved by mr pool but maybe we should look on the general case too. In either way, currently we can't use a scheduler for NVMEoF RDMA because of that issue.

Reply via email to