Re: [PATCH] blk-mq: take quiesce_lock when removing a queue from the tag set

From: Nilay Shroff

Date: Wed Nov 04 2026 - 08:31:47 EST


On 11/4/26 12:49 PM, Christoph Hellwig wrote:
Looks good, but the note from Mohamed should be taken into account.

Or even better add a guarded_by so that clang catches this (requires
actualy compile testing with clang, though).

Yeah agreed! I also recommend adding __guarded_by() annotation around
set->tag_list and set->quiesce_depth.

With this change, I have sorted following locking pattern:

1. Every set->tag_list mutation holds both set->tag_list_lock and set->quiesce_lock.
2. Every set->tag_list traversal holds at least one of set->tag_list_lock or set->quiesce_lock.
3. The set->tag_list_lock and set->quiesce_lock order is preserved.

So the above scheme fits really well in the context annotations.

We can define context annotation as follows:

struct blk_mq_tag_set {
...
struct list_head tag_list __guarded_by(&tag_list_lock, &quiesce_lock);
unsigned int quiesce_depth __guarded_by(&quiesce_lock);
...
}

Thanks,
--Nilay