If the user sets the quota limits >= ULLONG_MAX using lfs setquota,
we will set the limits to ULLONG_MAX and stuck in the infinite loop
when trying to increase qunit.
Break the loop when that happens and set qunit to
limit / (2 * slv_cnt) instead.
Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Change-Id: I6fb842c62ad46d8765f6c4c41187cf0dcd543c53
Reviewed-on: http://review.whamcloud.com/14187
Tested-by: Jenkins
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
/* current qunit value still fits, let's see if we can afford to
* increase qunit now ...
* To increase qunit again, we have to be under 25% */
- while (limit >= lqe->lqe_granted + 6 * qunit * slv_cnt)
+ while (qunit && limit >= lqe->lqe_granted + 6 * qunit * slv_cnt)
qunit <<= 2;
+
+ if (!qunit) {
+ qunit = limit;
+ do_div(qunit, 2 * slv_cnt);
+ }
+
} else {
/* shrink qunit until we find a suitable value */
while (qunit > pool->qpi_least_qunit &&