Whamcloud - gitweb
LU-6403 quota: fix soft lockup in qmt_adjust_qunit 87/14187/2
authorLi Dongyang <dongyang.li@anu.edu.au>
Wed, 25 Mar 2015 22:33:54 +0000 (09:33 +1100)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 Apr 2015 00:58:30 +0000 (00:58 +0000)
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>
lustre/quota/qmt_entry.c

index 47a1ccf..8997dec 100644 (file)
@@ -641,8 +641,14 @@ void qmt_adjust_qunit(const struct lu_env *env, struct lquota_entry *lqe)
                /* 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% */
                /* 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;
                        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 &&
        } else {
                /* shrink qunit until we find a suitable value */
                while (qunit > pool->qpi_least_qunit &&