Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / quota / quota_master.c
index 512fc49..ab5214f 100644 (file)
@@ -141,7 +141,7 @@ static struct lustre_dquot *alloc_dquot(struct lustre_quota_info *lqi,
         struct lustre_dquot *dquot = NULL;
         ENTRY;
 
-        OBD_SLAB_ALLOC(dquot, lustre_dquot_cachep, CFS_ALLOC_IO, sizeof(*dquot));
+        OBD_SLAB_ALLOC_PTR_GFP(dquot, lustre_dquot_cachep, CFS_ALLOC_IO);
         if (dquot == NULL)
                 RETURN(NULL);
 
@@ -552,8 +552,9 @@ int mds_quota_adjust(struct obd_device *obd, unsigned int qcids[],
         }
 
         if (rc2)
-                CDEBUG(rc2 == -EAGAIN ? D_QUOTA: D_ERROR,
-                       "mds adjust qunit failed! (opc:%d rc:%d)\n", opc, rc2);
+                CDEBUG(rc2 == QUOTA_REQ_RETURNED ? D_QUOTA: D_ERROR,
+                       "mds adjust qunit %ssuccessfully! (opc:%d rc:%d)\n",
+                       rc2 == QUOTA_REQ_RETURNED ? "" : "un", opc, rc2);
         RETURN(0);
 }
 
@@ -590,9 +591,9 @@ int filter_quota_adjust(struct obd_device *obd, unsigned int qcids[],
         if (rc || rc2) {
                 if (!rc)
                         rc = rc2;
-                CDEBUG(rc == -EAGAIN ? D_QUOTA: D_ERROR,
-                       "filter adjust qunit failed! (opc:%d rc%d)\n",
-                       opc, rc);
+                CDEBUG(rc == QUOTA_REQ_RETURNED ? D_QUOTA: D_ERROR,
+                       "filter adjust qunit %ssuccessfully! (opc:%d rc%d)\n",
+                       QUOTA_REQ_RETURNED ? "" : "un", opc, rc);
         }
 
         RETURN(0);
@@ -658,7 +659,6 @@ int mds_quota_finvalidate(struct obd_device *obd, struct obd_quotactl *oqctl)
         down(&mds->mds_qonoff_sem);
 
         oqctl->qc_cmd = Q_FINVALIDATE;
-        oqctl->qc_id = obd->u.obt.obt_qfmt;
         rc = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
         if (!rc)
                 rc = obd_quotactl(mds->mds_osc_exp, oqctl);
@@ -863,15 +863,16 @@ int mds_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         rc = mds_admin_quota_on(obd, oqctl);
         if (rc)
-                goto out;
-
-        rc = obd_quotactl(mds->mds_osc_exp, oqctl);
-        if (rc)
-                goto out;
+                GOTO(out, rc);
 
         rc = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
         if (!rc)
                 obt->obt_qctxt.lqc_flags |= UGQUOTA2LQC(oqctl->qc_type);
+        else
+                GOTO(out, rc);
+
+        rc = obd_quotactl(mds->mds_osc_exp, oqctl);
+
 out:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         up(&mds->mds_qonoff_sem);
@@ -1597,18 +1598,23 @@ free:
 
 int mds_quota_recovery(struct obd_device *obd)
 {
-        struct lov_obd *lov = &obd->u.mds.mds_osc_obd->u.lov;
+        struct mds_obd *mds = &obd->u.mds;
         struct qmaster_recov_thread_data data;
         int rc = 0;
         ENTRY;
 
-        mutex_down(&lov->lov_lock);
-        if (lov->desc.ld_tgt_count != lov->desc.ld_active_tgt_count) {
-                CWARN("Not all osts are active, abort quota recovery\n");
-                mutex_up(&lov->lov_lock);
+        if (unlikely(!mds->mds_quota))
+                RETURN(rc);
+
+        mutex_down(&obd->obd_dev_sem);
+        if (mds->mds_lov_desc.ld_active_tgt_count != mds->mds_lov_objid_count) {
+                CWARN("Only %u/%u OSTs are active, abort quota recovery\n",
+                      mds->mds_lov_desc.ld_active_tgt_count,
+                      mds->mds_lov_objid_count);
+                mutex_up(&obd->obd_dev_sem);
                 RETURN(rc);
         }
-        mutex_up(&lov->lov_lock);
+        mutex_up(&obd->obd_dev_sem);
 
         data.obd = obd;
         init_completion(&data.comp);