From 7c4afbb06b0f96f56f52ce8a56fc1e60f25fb5ae Mon Sep 17 00:00:00 2001 From: Andrew Perepechko Date: Tue, 6 Jul 2010 17:59:43 +0400 Subject: [PATCH] b=21816 allow querying quota stats even when some OSTs are down i=Yong Fan i=Landen --- lustre/quota/quota_ctl.c | 18 +++++++----------- lustre/quota/quota_master.c | 12 ++++++++++++ lustre/utils/lfs.c | 8 ++++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lustre/quota/quota_ctl.c b/lustre/quota/quota_ctl.c index 7a4f1cf..72d3955 100644 --- a/lustre/quota/quota_ctl.c +++ b/lustre/quota/quota_ctl.c @@ -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; diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index bd6e966..0af7afd 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -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: diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index bb055c5..d55c6f2 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -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"); -- 1.8.3.1