Message ID | 20250319105518.468941-2-nilay@linux.ibm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | fix locking issues with blk-wbt parameters update | expand |
On Wed, Mar 19, 2025 at 04:23:45PM +0530, Nilay Shroff wrote: > The ioc_qos_write method acquires q->elevator_lock to protect > updates to blk-wbt parameters. Once these updates are complete, > the lock should be released before returning from ioc_qos_write. > > However, in one code path, the release of q->elevator_lock was > mistakenly omitted, potentially leading to a lock leak. This commit > fixes the issue by ensuring that q->elevator_lock is properly > released in all return paths of ioc_qos_write. > > Fixes: 245618f8e45f ("block: protect wbt_lat_usec using q->elevator_lock") > Reported-by: kernel test robot <oliver.sang@intel.com> > Closes: https://lore.kernel.org/oe-lkp/202503171650.cc082b66-lkp@intel.com > Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> > --- > block/blk-iocost.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/blk-iocost.c b/block/blk-iocost.c > index 38e7bf3c3b4f..56e6fb51316d 100644 > --- a/block/blk-iocost.c > +++ b/block/blk-iocost.c > @@ -3348,6 +3348,7 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input, > wbt_enable_default(disk); > > blk_mq_unquiesce_queue(disk->queue); > + mutex_unlock(&disk->queue->elevator_lock); > blk_mq_unfreeze_queue(disk->queue, memflags); Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming
diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 38e7bf3c3b4f..56e6fb51316d 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3348,6 +3348,7 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input, wbt_enable_default(disk); blk_mq_unquiesce_queue(disk->queue); + mutex_unlock(&disk->queue->elevator_lock); blk_mq_unfreeze_queue(disk->queue, memflags); blkg_conf_exit(&ctx);
The ioc_qos_write method acquires q->elevator_lock to protect updates to blk-wbt parameters. Once these updates are complete, the lock should be released before returning from ioc_qos_write. However, in one code path, the release of q->elevator_lock was mistakenly omitted, potentially leading to a lock leak. This commit fixes the issue by ensuring that q->elevator_lock is properly released in all return paths of ioc_qos_write. Fixes: 245618f8e45f ("block: protect wbt_lat_usec using q->elevator_lock") Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202503171650.cc082b66-lkp@intel.com Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> --- block/blk-iocost.c | 1 + 1 file changed, 1 insertion(+)