Port from b23858.
In check_cur_qunit(), it checks "if (limit + record < 0)", however,
the limit is unsigned, so this check will be always false, and when
limit is smaller than -record, following "limit += record" will make
limit a unreasonable large value.
This patch also fixed a similar defect in dqacq_handler().
Signed-off-by: Vladimir Saveliev <vladimir.saveliev@oracle.com>
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ibe1d643ea3b310b2e55c05a8c200ba5e0137ee27
Reviewed-on: http://review.whamcloud.com/1750
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
limit_org = limit;
/* when a releasing quota req is sent, before it returned
limit is assigned a small value. limit will overflow */
- if (limit + record < 0)
+ if (record < 0)
usage -= record;
else
limit += record;
"blocks\n", obd->obd_name);
else
pending[i] += mb;
+ LASSERTF(pending[i] >= 0, "pending is not valid,"
+ " count=%d, mb=%d\n", count, mb);
lqs->lqs_bwrite_pending += pending[i];
} else {
pending[i] = count;
spin_lock(&lqs->lqs_lock);
if (isblk) {
if (lqs->lqs_bwrite_pending >= pending[i]) {
+ LASSERT(pending[i] >= 0);
lqs->lqs_bwrite_pending -= pending[i];
flag = 1;
} else {
case QUOTA_DQREL:
/* The usage in administrative file might be incorrect before
* recovery done */
- if (*usage - qdata->qd_count < 0)
+ if (*usage < qdata->qd_count)
*usage = 0;
else
*usage -= qdata->qd_count;