Whamcloud - gitweb
LU-882 quota: Quota code compares unsigned < 0
[fs/lustre-release.git] / lustre / quota / quota_master.c
index 6397393..05a8dac 100644 (file)
@@ -454,7 +454,7 @@ int dqacq_handler(struct obd_device *obd, struct qunit_data *qdata, int opc)
         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;
@@ -938,6 +938,8 @@ int do_mds_quota_off(struct obd_device *obd, struct obd_quotactl *oqctl)
         EXIT;
 
 out:
+        CDEBUG(D_QUOTA, "%s: quotaoff type:flags:rc %u:%lu:%d\n",
+               obd->obd_name, oqctl->qc_type, qctxt->lqc_flags, rc);
         cfs_up_write(&mds->mds_qonoff_sem);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         return rc ? : (rc1 ? : rc2);
@@ -1052,6 +1054,8 @@ int dquot_create_oqaq(struct lustre_quota_ctxt *qctxt,
                         oqaq->qaq_bunit_sz =
                                 QUSG(oqaq->qaq_bunit_sz * cqs_factor, 1)
                                 << QUOTABLOCK_BITS;
+                        if (oqaq->qaq_bunit_sz >= qctxt->lqc_bunit_sz)
+                                break;
                         b_limitation = oqaq->qaq_bunit_sz * (ost_num + 1) *
                                 shrink_qunit_limit;
                 }
@@ -1086,6 +1090,8 @@ int dquot_create_oqaq(struct lustre_quota_ctxt *qctxt,
                 while (ilimit > dquot->dq_dqb.dqb_curinodes
                        + 2 * i_limitation) {
                         oqaq->qaq_iunit_sz = oqaq->qaq_iunit_sz * cqs_factor;
+                        if (oqaq->qaq_iunit_sz >= qctxt->lqc_iunit_sz)
+                                break;
                         i_limitation = oqaq->qaq_iunit_sz * mdt_num *
                                 shrink_qunit_limit;
                 }
@@ -1764,8 +1770,8 @@ int mds_quota_recovery(struct obd_device *obd)
         data.obd = obd;
         cfs_init_completion(&data.comp);
 
-        rc = cfs_kernel_thread(qmaster_recovery_main, &data,
-                               CLONE_VM|CLONE_FILES);
+        rc = cfs_create_thread(qmaster_recovery_main, &data,
+                               CFS_DAEMON_FLAGS);
         if (rc < 0)
                 CERROR("%s: cannot start quota recovery thread: rc %d\n",
                        obd->obd_name, rc);