X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqsd_reint.c;h=a74d9f5f18c9f16c4d3f11a74fb147da467e299b;hb=c3a836364892cacbc4737645893b094971c6ec49;hp=c4c6e11e0051110cffd59091c17c2a6518f527cf;hpb=3f4ca2cb52dc9c88c8061d8b907b6f793d604f6c;p=fs%2Flustre-release.git diff --git a/lustre/quota/qsd_reint.c b/lustre/quota/qsd_reint.c index c4c6e11..a74d9f5 100644 --- a/lustre/quota/qsd_reint.c +++ b/lustre/quota/qsd_reint.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, 2013, Intel Corporation. + * Copyright (c) 2012, 2017, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -30,6 +30,8 @@ #define DEBUG_SUBSYSTEM S_LQUOTA +#include +#include #include "qsd_internal.h" /* @@ -56,7 +58,7 @@ static void qsd_reint_completion(const struct lu_env *env, } CDEBUG(D_QUOTA, "%s: global quota lock successfully acquired, glb " - "fid:"DFID", glb ver:"LPU64", slv fid:"DFID", slv ver:"LPU64"\n", + "fid:"DFID", glb ver:%llu, slv fid:"DFID", slv ver:%llu\n", qsd->qsd_svname, PFID(&req_qbody->qb_fid), lvb->lvb_glb_ver, PFID(&rep_qbody->qb_slv_fid), rep_qbody->qb_slv_ver); @@ -87,6 +89,14 @@ static int qsd_reint_qid(const struct lu_env *env, struct qsd_qtype_info *qqi, rc = qsd_update_index(env, qqi, qid, global, 0, rec); out: + + if (global && qid->qid_uid == 0) { + struct lquota_glb_rec *glb_rec = (struct lquota_glb_rec *)rec; + qsd_update_default_quota(qqi, glb_rec->qbr_hardlimit, + glb_rec->qbr_softlimit, + glb_rec->qbr_time); + } + lqe_putref(lqe); RETURN(rc); } @@ -194,14 +204,14 @@ static int qsd_reint_index(const struct lu_env *env, struct qsd_qtype_info *qqi, /* let's do a 1MB bulk */ npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20); - npages /= PAGE_CACHE_SIZE; + npages /= PAGE_SIZE; /* allocate pages for bulk index read */ OBD_ALLOC(pages, npages * sizeof(*pages)); if (pages == NULL) GOTO(out, rc = -ENOMEM); for (i = 0; i < npages; i++) { - pages[i] = alloc_page(GFP_IOFS); + pages[i] = alloc_page(GFP_NOFS); if (pages[i] == NULL) GOTO(out, rc = -ENOMEM); } @@ -254,7 +264,7 @@ repeat: ver = ii->ii_version; pg_cnt = (ii->ii_count + (LU_PAGE_COUNT) - 1); - pg_cnt >>= PAGE_CACHE_SHIFT - LU_PAGE_SHIFT; + pg_cnt >>= PAGE_SHIFT - LU_PAGE_SHIFT; if (pg_cnt > npages) { CERROR("%s: master returned more pages than expected, %u > %u" @@ -282,8 +292,8 @@ out: if (rc == 0) { rc = qsd_write_version(env, qqi, ver, global); if (rc) - CERROR("%s: write version "LPU64" to "DFID" failed. " - "%d\n", qsd->qsd_svname, ver, PFID(fid), rc); + CERROR("%s: write version %llu to "DFID" failed : rc = %d\n", + qsd->qsd_svname, ver, PFID(fid), rc); } RETURN(rc); @@ -305,7 +315,7 @@ static int qsd_reconciliation(const struct lu_env *env, LASSERT(qqi->qqi_glb_obj != NULL); iops = &qqi->qqi_glb_obj->do_index_ops->dio_it; - it = iops->init(env, qqi->qqi_glb_obj, 0, BYPASS_CAPA); + it = iops->init(env, qqi->qqi_glb_obj, 0); if (IS_ERR(it)) { CWARN("%s: Initialize it for "DFID" failed. %ld\n", qsd->qsd_svname, PFID(&qqi->qqi_fid), PTR_ERR(it)); @@ -467,8 +477,8 @@ static int qsd_reint_main(void *args) if (rc) GOTO(out_env_init, rc); - CDEBUG(D_QUOTA, "%s: glb_ver:"LPU64"/"LPU64",slv_ver:"LPU64"/" - LPU64"\n", qsd->qsd_svname, + CDEBUG(D_QUOTA, "%s: glb_ver:%llu/%llu,slv_ver:%llu/" + "%llu\n", qsd->qsd_svname, qti->qti_lvb.lvb_glb_ver, qqi->qqi_glb_ver, qti->qti_slv_ver, qqi->qqi_slv_ver); } @@ -530,11 +540,12 @@ out: qqi->qqi_reint = 0; write_unlock(&qsd->qsd_lock); - qqi_putref(qqi); - lu_ref_del(&qqi->qqi_reference, "reint_thread", thread); - thread_set_flags(thread, SVC_STOPPED); wake_up(&thread->t_ctl_waitq); + + lu_ref_del(&qqi->qqi_reference, "reint_thread", thread); + qqi_putref(qqi); + return rc; } @@ -552,7 +563,7 @@ void qsd_stop_reint_thread(struct qsd_qtype_info *qqi) } } -static int qsd_entry_iter_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd, +static int qsd_entry_iter_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *data) { struct lquota_entry *lqe; @@ -628,11 +639,14 @@ int qsd_start_reint_thread(struct qsd_qtype_info *qqi) char *name; ENTRY; + if (qsd->qsd_dev->dd_rdonly) + RETURN(0); + /* don't bother to do reintegration when quota isn't enabled */ if (!qsd_type_enabled(qsd, qqi->qqi_qtype)) RETURN(0); - if (qsd->qsd_acct_failed) + if (qqi->qqi_acct_failed) /* no space accounting support, can't enable enforcement */ RETURN(0);