Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / lustre / quota / quota_ctl.c
index 5e8cd88..ad4f9a4 100644 (file)
@@ -151,6 +151,7 @@ int filter_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                 }
                 if (oqctl->qc_cmd == Q_FINVALIDATE &&
                     (obt->obt_qctxt.lqc_flags & UGQUOTA2LQC(oqctl->qc_type))) {
+                        atomic_inc(&obt->obt_quotachecking);
                         rc = -EBUSY;
                         break;
                 }
@@ -164,7 +165,7 @@ int filter_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                  * dqacq/dqrel done then return the correct limits to master */
                 if (oqctl->qc_stat == QUOTA_RECOVERING)
                         qctxt_wait_pending_dqacq(&obd->u.obt.obt_qctxt,
-                                                 oqctl->qc_id, oqctl->qc_type, 
+                                                 oqctl->qc_id, oqctl->qc_type,
                                                  1);
 
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
@@ -336,6 +337,7 @@ int lov_quota_ctl(struct obd_device *unused, struct obd_export *exp,
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct lov_obd *lov = &obd->u.lov;
+        struct lov_tgt_desc *tgt;
         __u64 curspace = 0;
         __u64 bhardlimit = 0;
         int i, rc = 0;
@@ -351,10 +353,13 @@ int lov_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                 RETURN(-EFAULT);
         }
 
+        /* for lov tgt */
+        obd_getref(obd);
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
                 int err;
 
-                if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) {
+                tgt = lov->lov_tgts[i];
+                if (!tgt || !tgt->ltd_active || tgt->ltd_reap) {
                         if (oqctl->qc_cmd == Q_GETOQUOTA) {
                                 CERROR("ost %d is inactive\n", i);
                                 rc = -EIO;
@@ -364,9 +369,9 @@ int lov_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                         continue;
                 }
 
-                err = obd_quotactl(lov->lov_tgts[i]->ltd_exp, oqctl);
+                err = obd_quotactl(tgt->ltd_exp, oqctl);
                 if (err) {
-                        if (lov->lov_tgts[i]->ltd_active && !rc)
+                        if (tgt->ltd_active && !rc)
                                 rc = err;
                         continue;
                 }
@@ -376,6 +381,7 @@ int lov_quota_ctl(struct obd_device *unused, struct obd_export *exp,
                         bhardlimit += oqctl->qc_dqblk.dqb_bhardlimit;
                 }
         }
+        obd_putref(obd);
 
         if (oqctl->qc_cmd == Q_GETOQUOTA) {
                 oqctl->qc_dqblk.dqb_curspace = curspace;