Whamcloud - gitweb
b=21962 Quote the error message in results.yaml
[fs/lustre-release.git] / lustre / mdd / mdd_trans.c
index 947ef75..3ba0bf8 100644 (file)
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include <linux/module.h>
+#ifdef HAVE_EXT4_LDISKFS
+#include <ldiskfs/ldiskfs_jbd2.h>
+#else
 #include <linux/jbd.h>
+#endif
 #include <obd.h>
 #include <obd_class.h>
 #include <lustre_ver.h>
 #include <obd_support.h>
 #include <lprocfs_status.h>
 
+#ifdef HAVE_EXT4_LDISKFS
+#include <ldiskfs/ldiskfs.h>
+#else
 #include <linux/ldiskfs_fs.h>
+#endif
 #include <lustre_mds.h>
 #include <lustre/lustre_idl.h>
 
@@ -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;
 }