summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-10-31 11:53:41 +0100
committerJens Axboe <axboe@kernel.dk>2019-10-31 18:40:57 +0100
commit41591a51f00d2dc7bb9dc6e9bedf56c5cf6f2392 (patch)
treeab2f925a8b59d0ac98b77a1c763e5649afa37241
parentio_uring: ensure we clear io_kiocb->result before each issue (diff)
downloadlinux-41591a51f00d2dc7bb9dc6e9bedf56c5cf6f2392.tar.xz
linux-41591a51f00d2dc7bb9dc6e9bedf56c5cf6f2392.zip
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: 7caa47151ab2 ("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>
-rw-r--r--block/blk-iocost.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 2a3db80c1dce..a7ed434eae03 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2110,10 +2110,10 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,
goto einval;
}
- spin_lock_irq(&iocg->ioc->lock);
+ spin_lock(&iocg->ioc->lock);
iocg->cfg_weight = v;
weight_updated(iocg);
- spin_unlock_irq(&iocg->ioc->lock);
+ spin_unlock(&iocg->ioc->lock);
blkg_conf_finish(&ctx);
return nbytes;