Whamcloud - gitweb
b=21571 stacksize and locking fixes for loadgen patch from umka
[fs/lustre-release.git] / lustre / quota / quota_master.c
index 51b6d65..f0ccb99 100644 (file)
@@ -255,9 +255,7 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
 {
         struct mds_obd *mds = &obd->u.mds;
         struct lustre_quota_ctxt *qctxt = &mds->mds_obt.obt_qctxt;
-        struct obd_device *lov_mds_obd = class_exp2obd(mds->mds_osc_exp);
-        struct lov_obd *lov = &lov_mds_obd->u.lov;
-        __u32 ost_num = lov->desc.ld_tgt_count, mdt_num = 1;
+        __u32 ost_num = mds->mds_lov_objid_count, mdt_num = 1;
         struct quota_adjust_qunit *oqaq = NULL;
         unsigned int qid[MAXQUOTAS] = { 0, 0 };
         struct lustre_quota_info *info = &mds->mds_quota_info;
@@ -283,7 +281,7 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
                                LQUOTA_FLAGS_ADJINO, oqaq);
 
         if (rc < 0) {
-                CDEBUG(D_ERROR, "create oqaq failed! (rc:%d)\n", rc);
+                CERROR("create oqaq failed! (rc:%d)\n", rc);
                 GOTO(out_sem, rc);
         }
         QAQ_DEBUG(oqaq, "show oqaq.\n")
@@ -296,8 +294,8 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
         if (adjust_res <= 0) {
                 if (adjust_res < 0) {
                         rc = adjust_res;
-                        CDEBUG(D_ERROR, "adjust mds slave's qunit size failed! \
-                               (rc:%d)\n", rc);
+                        CERROR("adjust mds slave's qunit size failed! "
+                               "(rc:%d)\n", rc);
                 } else {
                         CDEBUG(D_QUOTA, "qunit doesn't need to be adjusted.\n");
                 }
@@ -317,8 +315,8 @@ int dqacq_adjust_qunit_sz(struct obd_device *obd, qid_t id, int type,
                 rc = 0;
         }
         if (rc) {
-                CDEBUG(D_ERROR, "mds fail to adjust file quota! \
-                               (rc:%d)\n", rc);
+                CERROR("%s: mds fail to adjust file quota! (rc:%d)\n",
+                       obd->obd_name, rc);
                 GOTO(out, rc);
         }
 
@@ -533,7 +531,7 @@ int mds_quota_adjust(struct obd_device *obd, const unsigned int qcids[],
         }
 
         if (rc2)
-                CDEBUG(rc2 == QUOTA_REQ_RETURNED ? D_QUOTA: D_ERROR,
+                CDEBUG(D_QUOTA,
                        "mds adjust qunit %ssuccessfully! (opc:%d rc:%d)\n",
                        rc2 == QUOTA_REQ_RETURNED ? "" : "un", opc, rc2);
         RETURN(0);
@@ -569,9 +567,9 @@ int filter_quota_adjust(struct obd_device *obd, const unsigned int qcids[],
         if (rc || rc2) {
                 if (!rc)
                         rc = rc2;
-                CDEBUG(rc == QUOTA_REQ_RETURNED ? D_QUOTA: D_ERROR,
+                CDEBUG(D_QUOTA,
                        "filter adjust qunit %ssuccessfully! (opc:%d rc%d)\n",
-                       QUOTA_REQ_RETURNED ? "" : "un", opc, rc);
+                       rc == QUOTA_REQ_RETURNED ? "" : "un", opc, rc);
         }
 
         RETURN(0);
@@ -620,8 +618,8 @@ int mds_quota_invalidate(struct obd_device *obd, struct obd_quotactl *oqctl)
                 fp = filp_open(name, O_CREAT | O_TRUNC | O_RDWR, 0644);
                 if (IS_ERR(fp)) {
                         rc = PTR_ERR(fp);
-                        CERROR("error invalidating admin quotafile %s (rc:%d)\n",
-                               name, rc);
+                        CERROR("%s: error invalidating admin quotafile %s (rc:%d)\n",
+                               obd->obd_name, name, rc);
                 }
                 else
                         filp_close(fp, 0);
@@ -717,8 +715,8 @@ int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl)
 
                 /* -EINVAL may be returned by quotainfo for bad quota file */
                 if (rc != -ENOENT && rc != -EINVAL) {
-                        CERROR("error opening old quota file %s (%d)\n",
-                               name, rc);
+                        CERROR("%s: error opening old quota file %s (%d)\n",
+                               obd->obd_name, name, rc);
                         break;
                 }
 
@@ -729,8 +727,8 @@ int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl)
                 fp = filp_open(name, O_CREAT | O_TRUNC | O_RDWR, 0644);
                 if (IS_ERR(fp)) {
                         rc = PTR_ERR(fp);
-                        CERROR("error creating admin quotafile %s (rc:%d)\n",
-                               name, rc);
+                        CERROR("%s: error creating admin quotafile %s (rc:%d)\n",
+                               obd->obd_name, name, rc);
                         break;
                 }
 
@@ -1576,13 +1574,14 @@ int mds_get_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         up(&dquot->dq_sem);
 
         lustre_dqput(dquot);
+        up(&mds->mds_qonoff_sem);
 
         /* the usages in admin quota file is inaccurate */
         dqblk->dqb_curinodes = 0;
         dqblk->dqb_curspace = 0;
         rc = mds_get_space(obd, oqctl);
         EXIT;
-
+        return rc;
 out:
         up(&mds->mds_qonoff_sem);
         return rc;
@@ -1691,7 +1690,7 @@ static int qmaster_recovery_main(void *arg)
         unsigned short type;
         ENTRY;
 
-        ptlrpc_daemonize("qmaster_recovd");
+        cfs_daemonize_ctxt("qmaster_recovd");
 
         /* for mds */
         class_incref(obd, "qmaster_recovd_mds", obd);
@@ -1724,8 +1723,9 @@ static int qmaster_recovery_main(void *arg)
 
                         rc = dquot_recovery(obd, dqid->di_id, type);
                         if (rc)
-                                CERROR("qmaster recovery failed! (id:%d type:%d"
-                                       " rc:%d)\n", dqid->di_id, type, rc);
+                                CERROR("%s: qmaster recovery failed for %sid %d"
+                                       " rc:%d)\n", obd->obd_name,
+                                       type ? "g" : "u", dqid->di_id, rc);
 free:
                         OBD_FREE_PTR(dqid);
                 }
@@ -1760,7 +1760,8 @@ int mds_quota_recovery(struct obd_device *obd)
 
         rc = kernel_thread(qmaster_recovery_main, &data, CLONE_VM|CLONE_FILES);
         if (rc < 0)
-                CERROR("Cannot start quota recovery thread: rc %d\n", rc);
+                CERROR("%s: cannot start quota recovery thread: rc %d\n",
+                       obd->obd_name, rc);
 
         wait_for_completion(&data.comp);
         RETURN(rc);