X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_entry.c;h=6fe3c920c33852491fb53f0d9bce4876eb34a7a9;hb=2841be335687840cf98961e6c6cde6ee9312e4d7;hp=588440a57c76287462eac83fa4bfce4355272150;hpb=51435cfffcd6815e70fb46b0ec2edcac3327bf44;p=fs%2Flustre-release.git diff --git a/lustre/quota/qmt_entry.c b/lustre/quota/qmt_entry.c index 588440a..6fe3c92 100644 --- a/lustre/quota/qmt_entry.c +++ b/lustre/quota/qmt_entry.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012 Intel, Inc. + * Copyright (c) 2012, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -47,7 +47,7 @@ static void qmt_lqe_init(struct lquota_entry *lqe, void *arg) LASSERT(lqe_is_master(lqe)); lqe->lqe_revoke_time = 0; - cfs_init_rwsem(&lqe->lqe_sem); + init_rwsem(&lqe->lqe_sem); } /* @@ -118,14 +118,14 @@ static void qmt_lqe_debug(struct lquota_entry *lqe, void *arg, libcfs_debug_vmsg2(msgdata, fmt, args, "qmt:%s pool:%d-%s id:"LPU64" enforced:%d hard:"LPU64 " soft:"LPU64" granted:"LPU64" time:"LPU64" qunit:" - LPU64" edquot:%d revoke:"LPU64"\n", + LPU64" edquot:%d may_rel:"LPU64" revoke:"LPU64"\n", pool->qpi_qmt->qmt_svname, pool->qpi_key & 0x0000ffff, RES_NAME(pool->qpi_key >> 16), lqe->lqe_id.qid_uid, lqe->lqe_enforced, lqe->lqe_hardlimit, lqe->lqe_softlimit, lqe->lqe_granted, lqe->lqe_gracetime, - lqe->lqe_qunit, lqe->lqe_edquot, + lqe->lqe_qunit, lqe->lqe_edquot, lqe->lqe_may_rel, lqe->lqe_revoke_time); } @@ -261,21 +261,16 @@ int qmt_glb_write(const struct lu_env *env, struct thandle *th, LQUOTA_DEBUG(lqe, "write glb"); - if (!lqe->lqe_enforced && lqe->lqe_granted == 0 && - lqe->lqe_id.qid_uid != 0) { - /* quota isn't enforced any more for this entry and there is no - * more space granted to slaves, let's just remove the entry - * from the index */ - rec = NULL; - } else { - rec = &qti->qti_glb_rec; + /* never delete the entry even when the id isn't enforced and + * no any guota granted, otherwise, this entry will not be + * synced to slave during the reintegration. */ + rec = &qti->qti_glb_rec; - /* fill global index with updated quota settings */ - rec->qbr_granted = lqe->lqe_granted; - rec->qbr_hardlimit = lqe->lqe_hardlimit; - rec->qbr_softlimit = lqe->lqe_softlimit; - rec->qbr_time = lqe->lqe_gracetime; - } + /* fill global index with updated quota settings */ + rec->qbr_granted = lqe->lqe_granted; + rec->qbr_hardlimit = lqe->lqe_hardlimit; + rec->qbr_softlimit = lqe->lqe_softlimit; + rec->qbr_time = lqe->lqe_gracetime; /* write new quota settings */ rc = lquota_disk_write(env, th, LQE_GLB_OBJ(lqe), &lqe->lqe_id, @@ -372,16 +367,12 @@ int qmt_slv_write(const struct lu_env *env, struct thandle *th, LQUOTA_DEBUG(lqe, "write slv "DFID" granted:"LPU64, PFID(lu_object_fid(&slv_obj->do_lu)), granted); - if (granted == 0) { - /* this slave does not own any quota space for this ID any more, - * so let's just remove the entry from the index */ - rec = NULL; - } else { - rec = &qti->qti_slv_rec; + /* never delete the entry, otherwise, it'll not be transferred + * to slave during reintegration. */ + rec = &qti->qti_slv_rec; - /* updated space granted to this slave */ - rec->qsr_granted = granted; - } + /* updated space granted to this slave */ + rec->qsr_granted = granted; /* write new granted space */ rc = lquota_disk_write(env, th, slv_obj, &lqe->lqe_id, @@ -423,8 +414,9 @@ int qmt_validate_limits(struct lquota_entry *lqe, __u64 hard, __u64 soft) void qmt_adjust_edquot(struct lquota_entry *lqe, __u64 now) { struct qmt_pool_info *pool = lqe2qpi(lqe); + ENTRY; - if (!lqe->lqe_enforced) + if (!lqe->lqe_enforced || lqe->lqe_id.qid_uid == 0) RETURN_EXIT; if (!lqe->lqe_edquot) { @@ -441,9 +433,13 @@ void qmt_adjust_edquot(struct lquota_entry *lqe, __u64 now) * some quota space */ RETURN_EXIT; + if (lqe->lqe_revoke_time == 0) + /* least qunit value not sent to all slaves yet */ + RETURN_EXIT; + if (lqe->lqe_may_rel != 0 && - cfs_time_beforeq_64(lqe->lqe_revoke_time, - cfs_time_shift_64(-QMT_REBA_TIMEOUT))) + cfs_time_before_64(cfs_time_shift_64(-QMT_REBA_TIMEOUT), + lqe->lqe_revoke_time)) /* Let's give more time to slave to release space */ RETURN_EXIT; @@ -473,6 +469,7 @@ void qmt_adjust_edquot(struct lquota_entry *lqe, __u64 now) /* let's notify slave by issuing glimpse on per-ID lock. * the rebalance thread will take care of this */ qmt_id_lock_notify(pool->qpi_qmt, lqe); + EXIT; } /* @@ -548,7 +545,7 @@ void qmt_adjust_qunit(const struct lu_env *env, struct lquota_entry *lqe) LASSERT(lqe_is_locked(lqe)); - if (!lqe->lqe_enforced) + if (!lqe->lqe_enforced || lqe->lqe_id.qid_uid == 0) /* no quota limits */ RETURN_EXIT;