X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqsd_handler.c;h=16f274cf457963817fa9a5328f565f0ec2f7a68c;hb=49b17944e1a61f88bddb5595bb053a555c8c08da;hp=ef12ddba1a7df46456d36a51a7e12edc5f20dd93;hpb=929ec628e6fef5609e55d519a1eb9e2cbbf1f1e8;p=fs%2Flustre-release.git diff --git a/lustre/quota/qsd_handler.c b/lustre/quota/qsd_handler.c index ef12ddb..16f274c 100644 --- a/lustre/quota/qsd_handler.c +++ b/lustre/quota/qsd_handler.c @@ -21,17 +21,13 @@ * GPL HEADER END */ /* - * Copyright (c) 2012 Intel, Inc. + * Copyright (c) 2012, 2014, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi * Author: Niu Yawei */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif - #define DEBUG_SUBSYSTEM S_LQUOTA #include "qsd_internal.h" @@ -69,7 +65,7 @@ static inline void qsd_request_exit(struct lquota_entry *lqe) } lqe->lqe_pending_req--; lqe->lqe_pending_rel = 0; - cfs_waitq_broadcast(&lqe->lqe_waiters); + wake_up_all(&lqe->lqe_waiters); } /** @@ -389,13 +385,10 @@ static void qsd_req_completion(const struct lu_env *env, } /* extract information from lvb */ - if (ret == 0 && lvb != 0) { + if (ret == 0 && lvb != NULL) { if (lvb->lvb_id_qunit != 0) qsd_set_qunit(lqe, lvb->lvb_id_qunit); - if (lvb->lvb_flags & LQUOTA_FL_EDQUOT) - lqe->lqe_edquot = true; - else - lqe->lqe_edquot = false; + qsd_set_edquot(lqe, !!(lvb->lvb_flags & LQUOTA_FL_EDQUOT)); } else if (repbody != NULL && repbody->qb_qunit != 0) { qsd_set_qunit(lqe, repbody->qb_qunit); } @@ -465,9 +458,15 @@ static int qsd_acquire_local(struct lquota_entry *lqe, __u64 space) lqe->lqe_pending_write += space; lqe->lqe_waiting_write -= space; rc = 0; - } else if (lqe->lqe_edquot) { + /* lqe_edquot flag is used to avoid flooding dqacq requests when + * the user is over quota, however, the lqe_edquot could be stale + * sometimes due to the race reply of dqacq vs. id lock glimpse + * (see LU-4505), so we revalidate it every 5 seconds. */ + } else if (lqe->lqe_edquot && + cfs_time_before_64(cfs_time_shift_64(-5), + lqe->lqe_edquot_time)) { rc = -EDQUOT; - } else { + }else { rc = -EAGAIN; } lqe_write_unlock(lqe); @@ -849,11 +848,13 @@ int qsd_op_begin(const struct lu_env *env, struct qsd_instance *qsd, /* ignore quota enforcement request when: * - quota isn't enforced for this quota type - * or - the user/group is root */ - if (!qsd_type_enabled(qsd, qi->lqi_type) || qi->lqi_id.qid_uid == 0) + * or - the user/group is root + * or - quota accounting isn't enabled */ + if (!qsd_type_enabled(qsd, qi->lqi_type) || qi->lqi_id.qid_uid == 0 || + qsd->qsd_acct_failed) RETURN(0); - LASSERTF(trans->lqt_id_cnt <= QUOTA_MAX_TRANSIDS, "id_cnt=%d", + LASSERTF(trans->lqt_id_cnt <= QUOTA_MAX_TRANSIDS, "id_cnt=%d\n", trans->lqt_id_cnt); /* check whether we already allocated a slot for this id */ for (i = 0; i < trans->lqt_id_cnt; i++) {