Skip to content

Commit 41591a5

Browse files
Dan Carpenteraxboe
authored andcommitted
iocost: don't nest spin_lock_irq in ioc_weight_write()
This code causes a static analysis warning: block/blk-iocost.c:2113 ioc_weight_write() error: double lock 'irq' We disable IRQs in blkg_conf_prep() and re-enable them in blkg_conf_finish(). IRQ disable/enable should not be nested because that means the IRQs will be enabled at the first unlock instead of the second one. Fixes: 7caa471 ("blkcg: implement blk-iocost") Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6873e0b commit 41591a5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎block/blk-iocost.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,10 +2110,10 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
21102110
goto einval;
21112111
}
21122112

2113-
spin_lock_irq(&iocg->ioc->lock);
2113+
spin_lock(&iocg->ioc->lock);
21142114
iocg->cfg_weight = v;
21152115
weight_updated(iocg);
2116-
spin_unlock_irq(&iocg->ioc->lock);
2116+
spin_unlock(&iocg->ioc->lock);
21172117

21182118
blkg_conf_finish(&ctx);
21192119
return nbytes;

0 commit comments

Comments
 (0)