On Wed, Oct 30, 2024 at 03:46:14PM +0100, Christoph Hellwig wrote: > On Wed, Oct 30, 2024 at 08:42:36PM +0800, Ming Lei wrote: > > commit f1be1788a32e ("block: model freeze & enter queue as lock for > > supporting lockdep") tries to apply lockdep for verifying freeze & > > unfreeze. However, the verification is only done the outmost freeze and > > unfreeze. This way is actually not correct because q->mq_freeze_depth > > still may drop to zero on other task instead of the freeze owner task. > > Well, that's how non-owner functions work in general. > > > Fix this issue by always verifying the last unfreeze lock on the owner > > task context, and freeze lock is still verified on the outmost one. > > > > Fixes: f1be1788a32e ("block: model freeze & enter queue as lock for supporting lockdep") > > What does this actually fix vs just improving coverage? Because the > hacks in here look pretty horrible and I'd be much happier if we didn't > have them. task A task B blk_mq_freeze_queue() blk_mq_freeze_queue() blk_mq_unfreeze_queue() blk_mq_unfreeze_queue() freeze_queue is verified on task A, but unfreeze_queue is verified on task B, this way is definitely wrong. This patch moves unfreeze_queue verification on task A. Thanks, Ming