X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_pool.c;h=ad9e478281a968aef4f653cd7b98606321787bfc;hp=c1f8b7247cb7635f178175d0cc0f3f148d4d0200;hb=2a42554850e92ef1aa515269e7d2a4020403c12d;hpb=51435cfffcd6815e70fb46b0ec2edcac3327bf44;ds=sidebyside diff --git a/lustre/quota/qmt_pool.c b/lustre/quota/qmt_pool.c index c1f8b72..ad9e478 100644 --- a/lustre/quota/qmt_pool.c +++ b/lustre/quota/qmt_pool.c @@ -453,8 +453,10 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt, struct dt_object *qmt_root) { struct qmt_thread_info *qti = qmt_info(env); + struct lquota_glb_rec *rec = &qti->qti_glb_rec; struct qmt_pool_info *pool; struct dt_device *dev = NULL; + dt_obj_version_t version; cfs_list_t *pos; int rc = 0, qtype; ENTRY; @@ -505,6 +507,34 @@ int qmt_pool_prepare(const struct lu_env *env, struct qmt_device *qmt, pool->qpi_glb_obj[qtype] = obj; + version = dt_version_get(env, obj); + /* set default grace time for newly created index */ + if (version == 0) { + rec->qbr_hardlimit = 0; + rec->qbr_softlimit = 0; + rec->qbr_granted = 0; + rec->qbr_time = pool_type == LQUOTA_RES_MD ? + MAX_IQ_TIME : MAX_DQ_TIME; + + rc = lquota_disk_write_glb(env, obj, 0, rec); + if (rc) { + CERROR("%s: failed to set default " + "grace time for %s type (%d)\n", + qmt->qmt_svname, + QTYPE_NAME(qtype), rc); + RETURN(rc); + } + + rc = lquota_disk_update_ver(env, dev, obj, 1); + if (rc) { + CERROR("%s: failed to set initial " + "version for %s type (%d)\n", + qmt->qmt_svname, + QTYPE_NAME(qtype), rc); + RETURN(rc); + } + } + /* create quota entry site for this quota type */ pool->qpi_site[qtype] = lquota_site_alloc(env, pool, true, qtype,