aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Kuai <[email protected]>2021-08-05 12:46:45 +0000
committerJens Axboe <[email protected]>2021-08-05 17:18:13 +0000
commit8d75d0eff6887bcac7225e12b9c75595e523d92d (patch)
tree99e3d91a3d183cd62f22ad87b036e9f3d02dc631
parentMerge branch 'md-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/so... (diff)
downloadkernel-8d75d0eff6887bcac7225e12b9c75595e523d92d.tar.gz
kernel-8d75d0eff6887bcac7225e12b9c75595e523d92d.zip
blk-iolatency: error out if blk_get_queue() failed in iolatency_set_limit()
If queue is dying while iolatency_set_limit() is in progress, blk_get_queue() won't increment the refcount of the queue. However, blk_put_queue() will still decrement the refcount later, which will cause the refcout to be unbalanced. Thus error out in such case to fix the problem. Fixes: 8c772a9bfc7c ("blk-iolatency: fix IO hang due to negative inflight counter") Signed-off-by: Yu Kuai <[email protected]> Acked-by: Tejun Heo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
-rw-r--r--block/blk-iolatency.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 81be0096411d..d8b0d8bd132b 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -833,7 +833,11 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf,
enable = iolatency_set_min_lat_nsec(blkg, lat_val);
if (enable) {
- WARN_ON_ONCE(!blk_get_queue(blkg->q));
+ if (!blk_get_queue(blkg->q)) {
+ ret = -ENODEV;
+ goto out;
+ }
+
blkg_get(blkg);
}