X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdd%2Fmdd_trans.c;h=3ba0bf86d92f0aec8a1ab9e122f46ff6d6b70682;hb=72a29cd28c104ae0948fe5f29146005aa1e5a999;hp=947ef75f2527f2c6bc08d16e2de053deeaec3942;hpb=90d8e7fd28746a572c8de488222f5312fe927fc3;p=fs%2Flustre-release.git diff --git a/lustre/mdd/mdd_trans.c b/lustre/mdd/mdd_trans.c index 947ef75..3ba0bf8 100644 --- a/lustre/mdd/mdd_trans.c +++ b/lustre/mdd/mdd_trans.c @@ -46,14 +46,22 @@ #define DEBUG_SUBSYSTEM S_MDS #include +#ifdef HAVE_EXT4_LDISKFS +#include +#else #include +#endif #include #include #include #include #include +#ifdef HAVE_EXT4_LDISKFS +#include +#else #include +#endif #include #include @@ -131,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); } @@ -143,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); } @@ -156,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; } } @@ -250,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; }