X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_lock.c;h=e73fcd174e1e35534d545634582f16c7302079f1;hb=93743d00e5e7fa7497aa24cac3989f83d7fae432;hp=8b7abb616e5fcb89e9b312404584984bf4e5383e;hpb=9fb46705ae86aa2c0ac29427f0ff24f923560eb7;p=fs%2Flustre-release.git diff --git a/lustre/quota/qmt_lock.c b/lustre/quota/qmt_lock.c index 8b7abb6..e73fcd1 100644 --- a/lustre/quota/qmt_lock.c +++ b/lustre/quota/qmt_lock.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012 Intel, Inc. + * Copyright (c) 2012, 2013, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -52,10 +52,12 @@ int qmt_intent_policy(const struct lu_env *env, struct lu_device *ld, struct obd_uuid *uuid; struct lquota_lvb *lvb; struct ldlm_resource *res = (*lockp)->l_resource; - int rc; + int rc, lvb_len; ENTRY; req_capsule_extend(&req->rq_pill, &RQF_LDLM_INTENT_QUOTA); + req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, + ldlm_lvbo_size(*lockp)); /* extract quota body and intent opc */ it = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); @@ -132,10 +134,13 @@ int qmt_intent_policy(const struct lu_env *env, struct lu_device *ld, } /* on success, pack lvb in reply */ - req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, - ldlm_lvbo_size(*lockp)); lvb = req_capsule_server_get(&req->rq_pill, &RMF_DLM_LVB); - ldlm_lvbo_fill(*lockp, lvb, ldlm_lvbo_size(*lockp)); + lvb_len = ldlm_lvbo_size(*lockp); + lvb_len = ldlm_lvbo_fill(*lockp, lvb, lvb_len); + if (lvb_len < 0) + GOTO(out, rc = lvb_len); + + req_capsule_shrink(&req->rq_pill, &RMF_DLM_LVB, lvb_len, RCL_SERVER); EXIT; out: return rc; @@ -169,14 +174,12 @@ int qmt_lvbo_init(struct lu_device *ld, struct ldlm_resource *res) /* initialize environment */ rc = lu_env_init(env, LCT_MD_THREAD); - if (rc) { - OBD_FREE_PTR(env); - RETURN(rc); - } + if (rc != 0) + GOTO(out_free, rc); qti = qmt_info(env); /* extract global index FID and quota identifier */ - fid_extract_quota_resid(&res->lr_name, &qti->qti_fid, &qti->qti_id); + fid_extract_from_quota_res(&qti->qti_fid, &qti->qti_id, &res->lr_name); /* sanity check the global index FID */ rc = lquota_extract_fid(&qti->qti_fid, &pool_id, &pool_type, &qtype); @@ -217,10 +220,11 @@ int qmt_lvbo_init(struct lu_device *ld, struct ldlm_resource *res) CDEBUG(D_QUOTA, DFID" initialized lvb\n", PFID(&qti->qti_fid)); } - res->lr_lvb_len = sizeof(struct lquota_lvb); + res->lr_lvb_len = sizeof(struct lquota_lvb); EXIT; out: lu_env_fini(env); +out_free: OBD_FREE_PTR(env); return rc; } @@ -252,7 +256,8 @@ int qmt_lvbo_update(struct lu_device *ld, struct ldlm_resource *res, /* no need to update lvb for global quota locks */ RETURN(0); - lvb = req_capsule_server_get(&req->rq_pill, &RMF_DLM_LVB); + lvb = req_capsule_server_swab_get(&req->rq_pill, &RMF_DLM_LVB, + lustre_swab_lquota_lvb); if (lvb == NULL) { CERROR("%s: failed to extract lvb from request\n", qmt->qmt_svname); @@ -549,6 +554,7 @@ void qmt_glb_lock_notify(const struct lu_env *env, struct lquota_entry *lqe, qti->qti_gl_desc.lquota_desc.gl_flags = 0; qti->qti_gl_desc.lquota_desc.gl_hardlimit = lqe->lqe_hardlimit; qti->qti_gl_desc.lquota_desc.gl_softlimit = lqe->lqe_softlimit; + qti->qti_gl_desc.lquota_desc.gl_time = lqe->lqe_gracetime; qti->qti_gl_desc.lquota_desc.gl_ver = ver; /* look up ldlm resource associated with global index */ @@ -605,7 +611,7 @@ static void qmt_id_lock_glimpse(const struct lu_env *env, lquota_generate_fid(&qti->qti_fid, pool->qpi_key & 0x0000ffff, pool->qpi_key >> 16, lqe->lqe_site->lqs_qtype); - fid_build_quota_resid(&qti->qti_fid, &lqe->lqe_id, &qti->qti_resid); + fid_build_quota_res_name(&qti->qti_fid, &lqe->lqe_id, &qti->qti_resid); res = ldlm_resource_get(qmt->qmt_ns, NULL, &qti->qti_resid, LDLM_PLAIN, 0); if (res == NULL) {