Whamcloud - gitweb
b=21826 refuse to invalidate operational quota files when they are in use
authorAndrew Perepechko <Andrew.Perepechko@Sun.COM>
Wed, 20 Jan 2010 20:06:38 +0000 (23:06 +0300)
committerJohann Lombardi <johann@sun.com>
Thu, 21 Jan 2010 10:37:48 +0000 (11:37 +0100)
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

lustre/quota/quota_master.c

index c8b3ccd..ea9b353 100644 (file)
@@ -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;
 }