Whamcloud - gitweb
b=21816 allow querying quota stats even when some OSTs are down
authorAndrew Perepechko <Andrew.Perepechko@sun.com>
Tue, 6 Jul 2010 13:59:43 +0000 (17:59 +0400)
committerRobert Read <robert.read@oracle.com>
Tue, 6 Jul 2010 17:26:00 +0000 (10:26 -0700)
i=Yong Fan
i=Landen

lustre/quota/quota_ctl.c
lustre/quota/quota_master.c
lustre/utils/lfs.c

index 7a4f1cf..72d3955 100644 (file)
@@ -321,23 +321,19 @@ int client_quota_ctl(struct obd_device *unused, struct obd_export *exp,
         req->rq_no_resend = 1;
 
         rc = ptlrpc_queue_wait(req);
-        if (rc) {
+        if (rc)
                 CERROR("ptlrpc_queue_wait failed, rc: %d\n", rc);
-                GOTO(out, rc);
-        }
 
-        oqc = NULL;
-        if (req->rq_repmsg)
-                oqc = req_capsule_server_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
-
-        if (oqc == NULL) {
+        if (req->rq_repmsg &&
+            (oqc = req_capsule_server_get(&req->rq_pill, &RMF_OBD_QUOTACTL))) {
+                *oqctl = *oqc;
+        } else if (!rc) {
                 CERROR ("Can't unpack obd_quotactl\n");
-                GOTO(out, rc = -EPROTO);
+                rc = -EPROTO;
         }
 
-        *oqctl = *oqc;
         EXIT;
-out:
+
         ptlrpc_req_finished(req);
 
         return rc;
index bd6e966..0af7afd 100644 (file)
@@ -1516,6 +1516,18 @@ int mds_get_dqblk(struct obd_device *obd, struct obd_quotactl *oqctl)
         dqblk->dqb_curinodes = 0;
         dqblk->dqb_curspace = 0;
         rc = mds_get_space(obd, oqctl);
+
+        /*
+         * Querying of curinodes and/or curspace may have failed, administrative
+         * quota data are likely to be better approximation to the real usage in
+         * this case.
+         */
+        if (!(dqblk->dqb_valid & QIF_INODES) && dquot->dq_dqb.dqb_curinodes > 0)
+                dqblk->dqb_curinodes = dquot->dq_dqb.dqb_curinodes;
+
+        if (!(dqblk->dqb_valid & QIF_SPACE) && dquot->dq_dqb.dqb_curspace > 0)
+                dqblk->dqb_curspace = dquot->dq_dqb.dqb_curspace;
+
         RETURN(rc);
 
 out:
index bb055c5..d55c6f2 100644 (file)
@@ -2051,7 +2051,8 @@ static int lfs_quota(int argc, char **argv)
                                     .qc_type = UGQUOTA };
         char *obd_type = (char *)qctl.obd_type;
         char *obd_uuid = (char *)qctl.obd_uuid.uuid;
-        int rc, rc1 = 0, rc2 = 0, rc3 = 0, verbose = 0, pass = 0, quiet = 0;
+        int rc, rc1 = 0, rc2 = 0, rc3 = 0,
+            verbose = 0, pass = 0, quiet = 0, inacc;
         char *endptr;
         __u32 valid = QC_GENERAL, idx = 0;
 
@@ -2172,6 +2173,9 @@ ug_output:
         if (qctl.qc_valid != QC_GENERAL)
                 mnt = "";
 
+        inacc = (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) &&
+                ((qctl.qc_dqblk.dqb_valid&(QIF_LIMITS|QIF_USAGE))!=(QIF_LIMITS|QIF_USAGE));
+
         print_quota(mnt, &qctl, QC_GENERAL, rc1);
 
         if (qctl.qc_valid == QC_GENERAL && qctl.qc_cmd != LUSTRE_Q_GETINFO && verbose) {
@@ -2179,7 +2183,7 @@ ug_output:
                 rc3 = print_obd_quota(mnt, &qctl, 0);
         }
 
-        if (rc1 || rc2 || rc3)
+        if (rc1 || rc2 || rc3 || inacc)
                 printf("Some errors happened when getting quota info. "
                        "Some devices may be not working or deactivated. "
                        "The data in \"[]\" is inaccurate.\n");