On Tue, Jan 07, 2025 at 01:21:14PM +0530, Nilay Shroff wrote: > > > On 1/7/25 12:55 PM, Ming Lei wrote: > > On Tue, Jan 07, 2025 at 07:30:36AM +0100, Christoph Hellwig wrote: > >> De-duplicate the code for updating queue limits by adding a store_limit > >> method that allows having common code handle the actual queue limits > >> update. > >> > >> Note that this is a pure refactoring patch and does not address the > >> existing freeze vs limits lock order problem in the refactored code, > >> which will be addressed next. > >> > >> Signed-off-by: Christoph Hellwig <hch@xxxxxx> ... > > Order between freeze and ->sysfs_lock is changed, and it may cause new > > lockdep warning because we may freeze queue first before acquiring > > ->sysfs_lock in del_gendisk(). > > > On contrary, in elevator_disable() and elevator_switch() we acquire > ->sysfs_lock first before freezing the queue. I think this is a mess and > we need to fix ordering. We need to decide ordering rules. IMO, the > correct order should be to acquire ->sysfs_lock before freezing queue. > Likewise with this patch now we acquire ->limits_lock before freezing the > queue. __blk_mq_update_nr_hw_queues() freezes queue before acquiring ->syfs_lock too. So yes, it is a mess wrt. order between ->sysfs_lock and freezing queue. Thanks, Ming