Skip to content

Commit

Permalink
blk-throttle: Fix IO hang for a corner case
Browse files Browse the repository at this point in the history
It can not scale up in throtl_adjusted_limit() if we set bps or iops is
1, which will cause IO hang when enable low limit. Thus we should treat
1 as a illegal value to avoid this issue.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Baolin Wang authored and axboe committed Oct 8, 2020
1 parent b185efa commit 5b7048b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,13 +1687,13 @@ static ssize_t tg_set_limit(struct kernfs_open_file *of,
goto out_finish;

ret = -EINVAL;
if (!strcmp(tok, "rbps"))
if (!strcmp(tok, "rbps") && val > 1)
v[0] = val;
else if (!strcmp(tok, "wbps"))
else if (!strcmp(tok, "wbps") && val > 1)
v[1] = val;
else if (!strcmp(tok, "riops"))
else if (!strcmp(tok, "riops") && val > 1)
v[2] = min_t(u64, val, UINT_MAX);
else if (!strcmp(tok, "wiops"))
else if (!strcmp(tok, "wiops") && val > 1)
v[3] = min_t(u64, val, UINT_MAX);
else if (off == LIMIT_LOW && !strcmp(tok, "idle"))
idle_time = val;
Expand Down

0 comments on commit 5b7048b

Please sign in to comment.