Whamcloud - gitweb
LU-12930 various: use schedule_timeout_*interruptible
[fs/lustre-release.git] / lustre / quota / qsd_handler.c
index 02ebad1..2119271 100644 (file)
@@ -654,10 +654,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);
@@ -694,7 +692,6 @@ static int qsd_op_begin0(const struct lu_env *env, struct qsd_qtype_info *qqi,
                         enum osd_quota_local_flags *local_flags)
 {
        struct lquota_entry *lqe;
-       struct l_wait_info lwi;
        enum osd_quota_local_flags qtype_flag = 0;
        int rc, ret = -EINPROGRESS;
        ENTRY;
@@ -737,16 +734,18 @@ static int qsd_op_begin0(const struct lu_env *env, struct qsd_qtype_info *qqi,
 
        /* acquire quota space for the operation, cap overall wait time to
         * prevent a service thread from being stuck for too long */
-       lwi = LWI_TIMEOUT(cfs_time_seconds(qsd_wait_timeout(qqi->qqi_qsd)),
-                         NULL, NULL);
-       rc = l_wait_event(lqe->lqe_waiters, qsd_acquire(env, lqe, space, &ret),
-                         &lwi);
+       rc = wait_event_idle_timeout(
+               lqe->lqe_waiters, qsd_acquire(env, lqe, space, &ret),
+               cfs_time_seconds(qsd_wait_timeout(qqi->qqi_qsd)));
 
-       if (rc == 0 && ret == 0) {
+       if (rc > 0 && ret == 0) {
                qid->lqi_space += space;
+               rc = 0;
        } else {
-               if (rc == 0)
+               if (rc > 0)
                        rc = ret;
+               else if (rc == 0)
+                       rc = -ETIMEDOUT;
 
                LQUOTA_DEBUG(lqe, "acquire quota failed:%d", rc);