From 67aca7525d52c8e9d14f221bc0a627f833a3d230 Mon Sep 17 00:00:00 2001
From: tianzy <tianzy>
Date: Fri, 5 Sep 2008 06:41:09 +0000
Subject: [PATCH] Branch b1_6 Lustre returns an EQUOTA error before hitting the
 block quota hardlimit b=16948 i=johann i=panda

---
 lustre/quota/quota_context.c   | 6 ++++++
 lustre/quota/quota_interface.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c
index 5a0e0bab32..629f9c8b96 100644
--- a/lustre/quota/quota_context.c
+++ b/lustre/quota/quota_context.c
@@ -325,6 +325,12 @@ check_cur_qunit(struct obd_device *obd,
                        limit_org > qdata->qd_count + qunit_sz)
                         qdata->qd_count += qunit_sz;
                 ret = 2;
+                /* if there are other pending writes for this uid/gid, releasing
+                 * quota is put off until the last pending write b=16645 */
+                if (ret == 2 && pending_write) {
+                        CDEBUG(D_QUOTA, "delay quota release\n");
+                        ret = 0;
+                }
         }
         CDEBUG(D_QUOTA, "type: %c, limit: "LPU64", usage: "LPU64
                ", pending_write: "LPU64", record: "LPD64
diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c
index 9149153fd7..1c75df77da 100644
--- a/lustre/quota/quota_interface.c
+++ b/lustre/quota/quota_interface.c
@@ -289,6 +289,7 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid,
         int rc = 0, cycle = 0, count_err = 0;
         ENTRY;
 
+        CDEBUG(D_QUOTA, "check quota for %s\n", obd->obd_name);
         /* Unfortunately, if quota master is too busy to handle the
          * pre-dqacq in time and quota hash on ost is used up, we
          * have to wait for the completion of in flight dqacq/dqrel,
@@ -373,6 +374,7 @@ static int quota_pending_commit(struct obd_device *obd, unsigned int uid,
         struct qunit_data qdata[MAXQUOTAS];
         ENTRY;
 
+        CDEBUG(D_QUOTA, "commit pending quota for  %s\n", obd->obd_name);
         CLASSERT(MAXQUOTAS < 4);
         if (!sb_any_quota_enabled(qctxt->lqc_sb))
                 RETURN(0);
-- 
GitLab