X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdd%2Fmdd_trans.c;h=3ba0bf86d92f0aec8a1ab9e122f46ff6d6b70682;hb=7a2519183f9d039d454e466221c60bc46860ee79;hp=8a408696e6763ca45dc49c5a4eed54831bebfc30;hpb=9dce07db5dc5ff3e0ffa57289ac095966a88adcc;p=fs%2Flustre-release.git diff --git a/lustre/mdd/mdd_trans.c b/lustre/mdd/mdd_trans.c index 8a40869..3ba0bf8 100644 --- a/lustre/mdd/mdd_trans.c +++ b/lustre/mdd/mdd_trans.c @@ -139,7 +139,7 @@ int mdd_log_txn_param_build(const struct lu_env *env, struct md_object *obj, stripe = le32_to_cpu(ma->ma_lmm->lmm_stripe_count); log_credits = stripe * dto_txn_credits[DTO_LOG_REC]; - mdd_env_info(env)->mti_param.tp_credits += log_credits; + txn_param_credit_add(&mdd_env_info(env)->mti_param, log_credits); RETURN(rc); } @@ -151,8 +151,13 @@ int mdd_setattr_txn_param_build(const struct lu_env *env, struct md_object *obj, mdd_txn_param_build(env, mdd, op); if (ma->ma_attr.la_valid & (LA_UID | LA_GID)) - mdd_env_info(env)->mti_param.tp_credits = - dto_txn_credits[DTO_ATTR_SET_CHOWN]; + txn_param_credit_add(&mdd_env_info(env)->mti_param, + dto_txn_credits[DTO_ATTR_SET_CHOWN]); + + /* permission changes may require sync operation */ + if (ma->ma_attr.la_valid & (LA_MODE|LA_UID|LA_GID) && + mdd->mdd_sync_permission == 1) + txn_param_sync(&mdd_env_info(env)->mti_param); RETURN(0); } @@ -164,7 +169,7 @@ static void mdd_txn_init_dto_credits(const struct lu_env *env, for (op = 0; op < DTO_NR; op++) { credits = mdd_child_ops(mdd)->dt_credit_get(env, mdd->mdd_child, op); - LASSERT(credits > 0); + LASSERT(credits >= 0); dto_txn_credits[op] = credits; } } @@ -258,7 +263,7 @@ struct thandle* mdd_trans_start(const struct lu_env *env, { struct txn_param *p = &mdd_env_info(env)->mti_param; struct thandle *th; - + th = mdd_child_ops(mdd)->dt_trans_start(env, mdd->mdd_child, p); return th; }