Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-19618

default quotas not applied for IDs with 0 limits

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Medium
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      Default quotas are not applied for the IDs for which quota limits were set to 0:

      [root@vm4 tests]# lfs setquota -u quota_usr -B0 -b0 -I0 -i0 /mnt/lustre
      [root@vm4 tests]# lfs setquota -U -B100M -I3000 /mnt/lustre
      [root@vm4 tests]# lfs quota -u quota_usr
      Disk quotas for usr quota_usr (uid 1000):
            Filesystem  kbytes   bquota  blimit  bgrace   files   iquota  ilimit  igrace
           /mnt/lustre       0        0       0       -       0        0       0       -
      [root@vm4 tests]# lfs quota -u quota_2usr
      Disk quotas for usr quota_2usr (uid 1001):
            Filesystem  kbytes   bquota  blimit  bgrace   files   iquota  ilimit  igrace
           /mnt/lustre       0        0  102400       -       0        0    3000       -
      [root@vm4 tests]# lfs quota -U
      Disk default usr quota:
            Filesystem  bquota  blimit  bgrace  iquota  ilimit  igrace
           /mnt/lustre       0  102400       -       0    3000       - 

      It ignores lqes with disalbed lqe_is_default flag:

      static int qmt_entry_iter_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd,           
                                   struct hlist_node *hnode, void *d)                     
      {                                                                                   
              struct qmt_entry_iter_data *iter = (struct qmt_entry_iter_data *)d;         
              struct lquota_entry     *lqe;                                               
                                                                                          
              lqe = hlist_entry(hnode, struct lquota_entry, lqe_hash);                    
              LASSERT(kref_read(&lqe->lqe_ref) > 0);                                      
                                                                                          
              if (lqe->lqe_id.qid_uid == 0 || !lqe->lqe_is_default)                       
                      return 0;                                                           
                                                                                          
              return qmt_set_with_lqe(iter->qeid_env, iter->qeid_qmt, lqe, 0, 0, 0, 0,
                                      true, true);                                        
      }                                             
       

      My first thought was to don't skip enforced lqes(i.e. lqes that has any limits) instead of checking lqe_is_default flag:

      if (lqe->lqe_id.qid_uid == 0 || lqe->lqe_enforced)
               return 0;

      However, this approach doesn't work as it later qmt_set_with_lqe doesn't set LQUOTA_FLAG_DEFAULT flag for that lqe and quota slaves won't be aware of this change and won't enforce this lqe. In the recent implementation default quotas flag(LQUOTA_FLAG_DEFAULT) is set only when quota global record doesn't exist in the global index file. If it is already exists even with zero limits, default quotas can't be applied.

      Note, that sanity-quota.sh calls reset_quota_settings in the very beginning before executing any test case. This causes creating lqes with zero limits for users and groups TSTUSR, TSTUSR2 plus for TSTPRJID. That said, default quotas won't be applied for these IDs in sanity-quota.sh.

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              scherementsev Sergey Cheremencev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: