Skip to content

Commit 8d75d0e

Browse files
YuKuai-huaweiaxboe
authored andcommitted
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: 8c772a9 ("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]>
1 parent cc396d2 commit 8d75d0e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

block/blk-iolatency.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,11 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf,
833833

834834
enable = iolatency_set_min_lat_nsec(blkg, lat_val);
835835
if (enable) {
836-
WARN_ON_ONCE(!blk_get_queue(blkg->q));
836+
if (!blk_get_queue(blkg->q)) {
837+
ret = -ENODEV;
838+
goto out;
839+
}
840+
837841
blkg_get(blkg);
838842
}
839843

0 commit comments

Comments
 (0)