Treat a 'current' value of 0 as unlimited as a failsfe.

When limiting I/O, a value of 0 makes no sense as a limit. No progress
can be made. Trade the possibility that someone might be doing
something clever to achieve ultra-low I/O limits vs the damage of not
ever making progress on an I/O in favor of making progress. Now the
machine won't be useless if this accidentally gets requested.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-10-24 02:25:42 +00:00
parent 913b932900
commit 6ca2fb6623

View File

@ -457,9 +457,10 @@ cam_iosched_iops_caniop(struct iop_stats *ios, struct bio *bp)
/*
* So if we have any more IOPs left, allow it,
* otherwise wait.
* otherwise wait. If current iops is 0, treat that
* as unlimited as a failsafe.
*/
if (ios->l_value1 <= 0)
if (ios->current > 0 && ios->l_value1 <= 0)
return EAGAIN;
return 0;
}
@ -525,8 +526,11 @@ cam_iosched_bw_caniop(struct iop_stats *ios, struct bio *bp)
* what we let through this quantum (to prevent the
* starvation), at the cost of getting a little less
* next quantum.
*
* Also note that if the current limit is <= 0,
* we treat it as unlimited as a failsafe.
*/
if (ios->l_value1 <= 0)
if (ios->current > 0 && ios->l_value1 <= 0)
return EAGAIN;