From: Andrew Perepechko Date: Wed, 20 Jan 2010 20:06:38 +0000 (+0300) Subject: b=21826 refuse to invalidate operational quota files when they are in use X-Git-Tag: 1.8.2~12 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ad42e736c36a24101578dad823cba43b782d0aee;p=fs%2Flustre-release.git b=21826 refuse to invalidate operational quota files when they are in use an attempt to invalidate operational quota files on the quota master is not actually permitted by VFS (returning -EPERM), but we should not depend on that and should return the error earlier. i=Johann Lombardi i=ZhiYong Tian --- diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index c8b3ccd..ea9b353 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -673,24 +673,37 @@ out: int mds_quota_finvalidate(struct obd_device *obd, struct obd_quotactl *oqctl) { struct mds_obd *mds = &obd->u.mds; + struct obd_device_target *obt = &obd->u.obt; int rc; struct lvfs_run_ctxt saved; + ENTRY; if (oqctl->qc_type != USRQUOTA && oqctl->qc_type != GRPQUOTA && oqctl->qc_type != UGQUOTA) RETURN(-EINVAL); + if (!atomic_dec_and_test(&obt->obt_quotachecking)) { + CDEBUG(D_INFO, "other people are doing quotacheck\n"); + GOTO(out, rc = -EBUSY); + } + + if (obt->obt_qctxt.lqc_flags & UGQUOTA2LQC(oqctl->qc_type)) + GOTO(out, rc = -EBUSY); + down(&mds->mds_qonoff_sem); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); oqctl->qc_cmd = Q_FINVALIDATE; - rc = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl); + rc = fsfilt_quotactl(obd, obt->obt_sb, oqctl); if (!rc) rc = obd_quotactl(mds->mds_lov_exp, oqctl); pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); up(&mds->mds_qonoff_sem); + EXIT; +out: + atomic_inc(&obt->obt_quotachecking); return rc; }