Whamcloud - gitweb
b=21816 allow querying quota stats even when some OSTs are down
[fs/lustre-release.git] / lustre / quota / quota_master.c
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: