On Wed, Feb 26, 2025 at 06:09:57PM +0530, Nilay Shroff wrote: > A queue's elevator can be updated either when modifying nr_hw_queues > or through the sysfs scheduler attribute. Currently, elevator switching/ > updating is protected using q->sysfs_lock, but this has led to lockdep > splats[1] due to inconsistent lock ordering between q->sysfs_lock and > the freeze-lock in multiple block layer call sites. > > As the scope of q->sysfs_lock is not well-defined, its (mis)use has > resulted in numerous lockdep warnings. To address this, introduce a new > q->elevator_lock, dedicated specifically for protecting elevator > switches/updates. And we'd now use this new q->elevator_lock instead of > q->sysfs_lock for protecting elevator switches/updates. > > While at it, make elv_iosched_load_module() a static function, as it is > only called from elv_iosched_store(). Also, remove redundant parameters > from elv_iosched_load_module() function signature. > > [1] https://lore.kernel.org/all/67637e70.050a0220.3157ee.000c.GAE@xxxxxxxxxx/ > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> > Signed-off-by: Nilay Shroff <nilay@xxxxxxxxxxxxx> Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx> Thanks, Ming