X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fquota%2Fqsd_lock.c;h=d72d800a73416411e1097265e75715ac136be786;hp=1649d63802acd4820ec4f26f520e324f7c9000a6;hb=3f4ca2cb52dc9c88c8061d8b907b6f793d604f6c;hpb=caa55aec4ae0421db69a0b9feac5cf0880f1c098 diff --git a/lustre/quota/qsd_lock.c b/lustre/quota/qsd_lock.c index 1649d63..d72d800 100644 --- a/lustre/quota/qsd_lock.c +++ b/lustre/quota/qsd_lock.c @@ -28,10 +28,6 @@ * Author: Niu Yawei */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif - #define DEBUG_SUBSYSTEM S_LQUOTA #include @@ -217,7 +213,7 @@ static int qsd_glb_blocking_ast(struct ldlm_lock *lock, /* kick off reintegration thread if not running already, if * it's just local cancel (for stack clean up or eviction), * don't re-trigger the reintegration. */ - if ((lock->l_flags & LDLM_FL_LOCAL_ONLY) == 0) + if (!ldlm_is_local_only(lock)) qsd_start_reint_thread(qqi); lu_ref_del(&qqi->qqi_reference, "ast_data_get", lock); @@ -225,7 +221,7 @@ static int qsd_glb_blocking_ast(struct ldlm_lock *lock, break; } default: - LASSERTF(0, "invalid flags for blocking ast %d", flag); + LASSERTF(0, "invalid flags for blocking ast %d\n", flag); } RETURN(rc); @@ -314,64 +310,60 @@ static int qsd_id_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *de case LDLM_CB_CANCELING: { struct lu_env *env; struct lquota_entry *lqe; - bool rel = false; - LDLM_DEBUG(lock, "canceling global quota lock"); + LDLM_DEBUG(lock, "canceling ID quota lock"); lqe = qsd_id_ast_data_get(lock, true); if (lqe == NULL) break; LQUOTA_DEBUG(lqe, "losing ID lock"); - /* just local cancel (for stack clean up or eviction), don't - * release quota space in this case */ - if ((lock->l_flags & LDLM_FL_LOCAL_ONLY) != 0) { - lqe_putref(lqe); - break; - } - - /* allocate environment */ - OBD_ALLOC_PTR(env); - if (env == NULL) { - lqe_putref(lqe); - rc = -ENOMEM; - break; - } - - /* initialize environment */ - rc = lu_env_init(env, LCT_DT_THREAD); - if (rc) { - OBD_FREE_PTR(env); - lqe_putref(lqe); - break; - } - ldlm_lock2handle(lock, &lockh); lqe_write_lock(lqe); if (lustre_handle_equal(&lockh, &lqe->lqe_lockh)) { /* Clear lqe_lockh & reset qunit to 0 */ qsd_set_qunit(lqe, 0); memset(&lqe->lqe_lockh, 0, sizeof(lqe->lqe_lockh)); - lqe->lqe_edquot = false; - rel = true; + qsd_set_edquot(lqe, false); } lqe_write_unlock(lqe); - /* If there is qqacq inflight, the release will be skipped + /* If there is dqacq inflight, the release will be skipped * at this time, and triggered on dqacq completion later, * which means there could be a short window that slave is * holding spare grant wihtout per-ID lock. */ - if (rel) + + /* don't release quota space for local cancel (stack clean + * up or eviction) */ + if (!ldlm_is_local_only(lock)) { + /* allocate environment */ + OBD_ALLOC_PTR(env); + if (env == NULL) { + lqe_putref(lqe); + rc = -ENOMEM; + break; + } + + /* initialize environment */ + rc = lu_env_init(env, LCT_DT_THREAD); + if (rc) { + OBD_FREE_PTR(env); + lqe_putref(lqe); + break; + } + rc = qsd_adjust(env, lqe); + lu_env_fini(env); + OBD_FREE_PTR(env); + } + /* release lqe reference grabbed by qsd_id_ast_data_get() */ lqe_putref(lqe); - lu_env_fini(env); - OBD_FREE_PTR(env); break; } default: - LASSERTF(0, "invalid flags for blocking ast %d", flag); + LASSERTF(0, "invalid flags for blocking ast %d\n", flag); } RETURN(rc); @@ -447,11 +439,11 @@ static int qsd_id_glimpse_ast(struct ldlm_lock *lock, void *data) } } - lqe->lqe_edquot = !!(desc->gl_flags & LQUOTA_FL_EDQUOT); + qsd_set_edquot(lqe, !!(desc->gl_flags & LQUOTA_FL_EDQUOT)); lqe_write_unlock(lqe); if (wakeup) - cfs_waitq_broadcast(&lqe->lqe_waiters); + wake_up_all(&lqe->lqe_waiters); lqe_putref(lqe); out: req->rq_status = rc; @@ -516,7 +508,7 @@ int qsd_id_lock_cancel(const struct lu_env *env, struct lquota_entry *lqe) if (lustre_handle_is_used(&qti->qti_lockh)) { memset(&lqe->lqe_lockh, 0, sizeof(lqe->lqe_lockh)); qsd_set_qunit(lqe, 0); - lqe->lqe_edquot = false; + qsd_set_edquot(lqe, false); } lqe_write_unlock(lqe);