Whamcloud - gitweb
b=21147 call build_lqs only from generic_quota_on
authorAndrew Perepechko <Andrew.Perepechko@Sun.COM>
Wed, 3 Feb 2010 17:13:59 +0000 (20:13 +0300)
committerJohann Lombardi <johann@sun.com>
Wed, 3 Feb 2010 18:39:17 +0000 (19:39 +0100)
i=Johann Lombardi
i=ZhiYong Tian

lustre/quota/lproc_quota.c
lustre/quota/quota_ctl.c

index 425b4f5..cbef63d 100644 (file)
@@ -279,7 +279,6 @@ int generic_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl, int glo
                         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                         /* turn on local quota */
                         rc = fsfilt_quotactl(obd, obt->obt_sb, oqctl);
-                        pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                         if (rc) {
                                 if (rc != -ENOENT)
                                         CERROR("%s: %s quotaon failed with"
@@ -287,7 +286,11 @@ int generic_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl, int glo
                                                global ? "global" : "local", rc);
                         } else {
                                 obt->obt_qctxt.lqc_flags |= UGQUOTA2LQC(oqctl->qc_type);
+                                /* when quotaon, create lqs for every
+                                 * quota uid/gid b=18574 */
+                                build_lqs(obd);
                         }
+                        pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 }
 
                 if (rc == 0 && global && is_master)
@@ -439,15 +442,13 @@ int lprocfs_quota_wr_type(struct file *file, const char *buffer,
         if (type != 0) {
                 int rc = auto_quota_on(obd, type - 1);
 
-                if (rc == 0)
-                        build_lqs(obd);
-                else if (rc == -ENOENT)
+                if (rc == -ENOENT)
                         CWARN("%s: quotaon failed because quota files don't "
                               "exist, please run quotacheck firstly\n",
                               obd->obd_name);
                 else if (rc == -EALREADY)
                         CWARN("%s: quota is on already!\n", obd->obd_name);
-                else
+                else if (rc != 0)
                         return rc;
         }
 
index afc0b0d..5652b3d 100644 (file)
@@ -129,8 +129,6 @@ int mds_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl)
         switch (oqctl->qc_cmd) {
         case Q_QUOTAON:
                 rc = mds_quota_on(obd, oqctl);
-                /* when quotaon, create lqs for every quota uid/gid b=18574 */
-                build_lqs(obd);
                 break;
         case Q_QUOTAOFF:
                 oqctl->qc_id = obt->obt_qfmt; /* override qfmt version */
@@ -195,8 +193,6 @@ int filter_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl)
         case Q_QUOTAON:
                 oqctl->qc_id = obt->obt_qfmt;
                 rc = generic_quota_on(obd, oqctl, 0);
-                /* when quotaon, create lqs for every quota uid/gid b=18574 */
-                build_lqs(obd);
                 break;
         case Q_FINVALIDATE:
         case Q_QUOTAOFF: