Whamcloud - gitweb
LU-12854 nodemap: allow boolean value for audit_mode
[fs/lustre-release.git] / lustre / quota / qsd_handler.c
index 3fff49a..ed67286 100644 (file)
@@ -623,7 +623,8 @@ static int qsd_acquire_remote(const struct lu_env *env,
  * \param space - is the amount of quota required for the operation
  * \param ret   - is the return code (-EDQUOT, -EINPROGRESS, ...)
  *
- * \retval true  - exit from l_wait_event and real return value in \a ret
+ * \retval true  - stop waiting in wait_event_idle_timeout,
+ *                 and real return value in \a ret
  * \retval false - continue waiting
  */
 static bool qsd_acquire(const struct lu_env *env, struct lquota_entry *lqe,
@@ -654,10 +655,8 @@ static bool qsd_acquire(const struct lu_env *env, struct lquota_entry *lqe,
 
                /* if we have gotten some quota and stil wait more quota,
                 * it's better to give QMT some time to reclaim from clients */
-               if (count > 0) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(cfs_time_seconds(1));
-               }
+               if (count > 0)
+                       schedule_timeout_interruptible(cfs_time_seconds(1));
 
                /* need to acquire more quota space from master */
                rc = qsd_acquire_remote(env, lqe);
@@ -667,7 +666,7 @@ static bool qsd_acquire(const struct lu_env *env, struct lquota_entry *lqe,
                /* already a request in flight, continue waiting */
                RETURN(false);
        *ret = rc;
-       RETURN(true); /* exit from l_wait_event */
+       RETURN(true);
 }
 
 /**
@@ -787,8 +786,11 @@ out_flags:
                        lqe_read_lock(lqe);
                        usage = lqe->lqe_pending_write;
                        usage += lqe->lqe_waiting_write;
-                       if (lqe->lqe_qunit != 0 && (usage % lqe->lqe_qunit >
-                           qqi->qqi_qsd->qsd_sync_threshold))
+                       /* There is a chance to successfully grant more quota
+                        * but get edquot flag through glimpse. */
+                       if (lqe->lqe_edquot || (lqe->lqe_qunit != 0 &&
+                          (usage % lqe->lqe_qunit >
+                           qqi->qqi_qsd->qsd_sync_threshold)))
                                usage += qqi->qqi_qsd->qsd_sync_threshold;
 
                        usage += lqe->lqe_usage;