On 12/22/20 3:15 AM, John Garry wrote:
So then we could have something like this:
---8<---
-435,9 +444,13 @@ void blk_mq_queue_tag_busy_iter(struct request_queue
*q, busy_iter_fn *fn,
if (!blk_mq_hw_queue_mapped(hctx))
continue;
+ while (!atomic_inc_not_zero(&tags->iter_usage_counter));
+
if (tags->nr_reserved_tags)
bt_for_each(hctx, tags->breserved_tags, fn, priv, true);
bt_for_each(hctx, tags->bitmap_tags, fn, priv, false);
+ atomic_dec(&tags->iter_usage_counter);
}
blk_queue_exit(q);
--->8---
And similar for blk_mq_tagset_busy_iter(). How about it?
Are there any blk_mq_tagset_busy_iter() calls that happen from a context
where the tag set can disappear while that function is in progress?
Some blk_mq_tagset_busy_iter() calls happen from a context where it is
not allowed to sleep but also where it is guaranteed that the tag set
won't disappear, e.g. the call from inside sdk_mq_queue_rq().
How about using a mutex inside blk_mq_queue_tag_busy_iter() instead? As
far as I can see all blk_mq_queue_tag_busy_iter() happen from a context
where it is allowed to sleep.
Thanks,
Bart.