Whamcloud - gitweb
LU-12342 spec: mark lsvcgss as a config file in the rpm
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_quota.c
index 5c4ce09..b7edc53 100644 (file)
@@ -97,8 +97,12 @@ int osd_acct_obj_lookup(struct osd_thread_info *info, struct osd_device *osd,
                        RETURN(-ENOENT);
                break;
        }
-       if (!ldiskfs_valid_inum(sb, id->oii_ino))
+
+       if (!ldiskfs_valid_inum(sb, id->oii_ino) &&
+           id->oii_ino != LDISKFS_USR_QUOTA_INO &&
+           id->oii_ino != LDISKFS_GRP_QUOTA_INO)
                RETURN(-ENOENT);
+
        RETURN(0);
 }
 
@@ -551,6 +555,7 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
        struct qsd_instance *qsd;
        struct inode *inode = NULL;
        int i, rc = 0, crd;
+       __u8 res = qi->lqi_is_blk ? LQUOTA_RES_DT : LQUOTA_RES_MD;
        bool found = false;
 
        ENTRY;
@@ -562,10 +567,14 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
        dev = osd_dt_dev(oh->ot_super.th_dev);
        LASSERT(dev != NULL);
 
-       qsd = dev->od_quota_slave;
+       if (res == LQUOTA_RES_DT)
+               qsd = dev->od_quota_slave_dt;
+       else
+               qsd = dev->od_quota_slave_md;
 
        for (i = 0; i < oh->ot_id_cnt; i++) {
                if (oh->ot_id_array[i] == qi->lqi_id.qid_uid &&
+                   oh->ot_id_res[i] == res &&
                    oh->ot_id_types[i] == qi->lqi_type) {
                        found = true;
                        break;
@@ -613,6 +622,7 @@ int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
 
                oh->ot_id_array[i] = qi->lqi_id.qid_uid;
                oh->ot_id_types[i] = qi->lqi_type;
+               oh->ot_id_res[i] = res;
                oh->ot_id_cnt++;
        }
 
@@ -694,9 +704,11 @@ int osd_declare_inode_qid(const struct lu_env *env, qid_t uid, qid_t gid,
        qi->lqi_type = PRJQUOTA;
        rcp = osd_declare_qid(env, oh, qi, obj, true, flags);
 
-       if (force && (rcp == -EDQUOT || rcp == -EINPROGRESS))
+       if (force && (rcp == -EDQUOT || rcp == -EINPROGRESS)) {
+               CDEBUG(D_ERROR, "force to ignore quota flags =%d\n", *flags);
                /* as before, ignore EDQUOT & EINPROGRESS for root */
                rcp = 0;
+       }
 #endif
 
        RETURN(rcu ? rcu : (rcg ? rcg : rcp));