return false;
}
-static void qmt_set_revoke(struct lu_env *env, struct lquota_entry *lqe,
+static bool qmt_set_revoke(struct lu_env *env, struct lquota_entry *lqe,
int stype, int idx)
{
unsigned long least_qunit = lqe2qpi(lqe)->qpi_least_qunit;
struct lqe_glbl_data *lgd = lqe->lqe_glbl_data;
+ bool notify = false;
if (lgd->lqeg_arr[idx].lge_qunit == least_qunit) {
int i;
if (qti_lqes(env)[i]->lqe_qunit == least_qunit) {
qti_lqes(env)[i]->lqe_revoke_time =
ktime_get_seconds();
- qmt_adjust_edquot(qti_lqes(env)[i],
+ notify |= qmt_adjust_edquot(qti_lqes(env)[i],
ktime_get_real_seconds());
}
}
qti_lqes_write_unlock(env);
}
+ return notify;
}
/*
if (rc)
GOTO(out_exp, rc);
- if (need_revoke)
- qmt_set_revoke(env, lqe, rc, idx);
+ if (need_revoke && qmt_set_revoke(env, lqe, rc, idx) &&
+ lqe->lqe_glbl_data) {
+ qmt_seed_glbe_edquot(env, lqe->lqe_glbl_data);
+ qmt_id_lock_notify(qmt, lqe);
+ }
if (lvb->lvb_id_rel) {
LQUOTA_DEBUG(lqe, "releasing:%llu may release:%llu",
* we are thus dealing with an ID lock. */
struct lquota_entry *lqe = res->lr_lvb_data;
struct qmt_device *qmt;
- struct obd_uuid *uuid;
+ struct obd_uuid *uuid;
int idx;
uuid = &(lock)->l_export->exp_client_uuid;
lqe_putref(lqe);
} else {
/* global quota lock */
- struct dt_object *obj = res->lr_lvb_data;
+ struct dt_object *obj = res->lr_lvb_data;
/* return current version of global index */
qlvb->lvb_glb_ver = dt_version_get(env, obj);
struct lquota_entry *lqe = res->lr_lvb_data;
struct lqe_glbl_data *lgd = lqe->lqe_glbl_data;
- /* release lqe reference */
+ mutex_lock(&lqe->lqe_glbl_data_lock);
lqe->lqe_glbl_data = NULL;
- lqe_putref(lqe);
qmt_free_lqe_gd(lgd);
+ mutex_unlock(&lqe->lqe_glbl_data_lock);
+
+ /* release lqe reference */
+ lqe_putref(lqe);
} else {
struct dt_object *obj = res->lr_lvb_data;
/* release object reference */
qti->qti_gl_desc.lquota_desc.gl_time = LQUOTA_GRACE_FLAG(0,
LQUOTA_FLAG_DEFAULT);
+ } else if (lqe->lqe_is_deleted) {
+ qti->qti_gl_desc.lquota_desc.gl_hardlimit = 0;
+ qti->qti_gl_desc.lquota_desc.gl_softlimit = 0;
+ qti->qti_gl_desc.lquota_desc.gl_time = LQUOTA_GRACE_FLAG(0,
+ LQUOTA_FLAG_DELETED);
} else {
qti->qti_gl_desc.lquota_desc.gl_hardlimit = lqe->lqe_hardlimit;
qti->qti_gl_desc.lquota_desc.gl_softlimit = lqe->lqe_softlimit;
/* look up ldlm resource associated with global index */
fid_build_reg_res_name(&qti->qti_fid, &qti->qti_resid);
- res = ldlm_resource_get(pool->qpi_qmt->qmt_ns, NULL, &qti->qti_resid,
+ res = ldlm_resource_get(pool->qpi_qmt->qmt_ns, &qti->qti_resid,
LDLM_PLAIN, 0);
if (IS_ERR(res)) {
/* this might happen if no slaves have enqueued global quota
lquota_generate_fid(&qti->qti_fid, pool->qpi_rtype, lqe_qtype(lqe));
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);
+ res = ldlm_resource_get(qmt->qmt_ns, &qti->qti_resid, LDLM_PLAIN, 0);
if (IS_ERR(res)) {
/* this might legitimately happens if slaves haven't had the
* opportunity to enqueue quota lock yet. */
rc = lu_env_init(&args->qra_env, LCT_MD_THREAD);
if (rc) {
- CERROR("%s: failed to init env.", qmt->qmt_svname);
+ CERROR("%s: failed to init env.\n", qmt->qmt_svname);
GOTO(out_env, rc);
}