Whamcloud - gitweb
LU-974 security: ignore umask if acl enabled
authorLai Siyao <laisiyao@whamcloud.com>
Fri, 13 Jan 2012 10:34:33 +0000 (18:34 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Nov 2012 19:08:19 +0000 (14:08 -0500)
* add OBD_CONNECT_UMASK to show whether MDS supports umask.
* client packs umask in create/open request, MDS will use it in
  object creation.
* client ignores umask if acl is enabled.
* client enforces umask if MDS doesn't support OBD_CONNECT_UMASK.
* don't update inode->i_mode after creation because la_mode may
  not be correct which doesn't consider umask.
* add an acl test for this.

Signed-off-by: Lai Siyao <laisiyao@whamcloud.com>
Change-Id: Ibbb45dd79378d116eb428b76070a417fe08a8142
Reviewed-on: http://review.whamcloud.com/1972
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
16 files changed:
lustre/include/liblustre.h
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_export.h
lustre/llite/dcache.c
lustre/llite/llite_lib.c
lustre/llite/namei.c
lustre/mdc/mdc_lib.c
lustre/mdd/mdd_dir.c
lustre/mdd/mdd_internal.h
lustre/mdt/mdt_lib.c
lustre/osd-ldiskfs/osd_handler.c
lustre/ptlrpc/wiretest.c
lustre/tests/acl/974.test [new file with mode: 0644]
lustre/tests/sanity.sh
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index bf34f04..17260ae 100644 (file)
@@ -266,6 +266,7 @@ typedef struct task_struct cfs_task_t;
 #define cfs_curproc_comm()      (current->comm)
 #define cfs_curproc_fsuid()     (current->fsuid)
 #define cfs_curproc_fsgid()     (current->fsgid)
+#define cfs_curproc_umask()     ({ mode_t mask = umask(0); umask(mask); mask; })
 
 extern struct task_struct *current;
 int cfs_curproc_is_in_groups(gid_t gid);
index 6b75347..a097158 100644 (file)
@@ -1209,7 +1209,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
                                 OBD_CONNECT_SOM | OBD_CONNECT_FULL20 | \
                                OBD_CONNECT_64BITHASH | OBD_CONNECT_JOBSTATS | \
                                OBD_CONNECT_EINPROGRESS | \
-                               OBD_CONNECT_LIGHTWEIGHT)
+                               OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_UMASK)
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                 OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
                                 OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \
@@ -2146,7 +2146,7 @@ struct mdt_rec_create {
          * extend cr_flags size without breaking 1.8 compat */
         __u32           cr_flags_l;     /* for use with open, low  32 bits  */
         __u32           cr_flags_h;     /* for use with open, high 32 bits */
-        __u32           cr_padding_3;   /* rr_padding_3 */
+        __u32           cr_umask;       /* umask for create */
         __u32           cr_padding_4;   /* rr_padding_4 */
 };
 
index 166955b..ef0d64e 100644 (file)
@@ -316,6 +316,11 @@ static inline int exp_connect_som(struct obd_export *exp)
         return !!(exp->exp_connect_flags & OBD_CONNECT_SOM);
 }
 
+static inline int exp_connect_umask(struct obd_export *exp)
+{
+        return !!(exp->exp_connect_flags & OBD_CONNECT_UMASK);
+}
+
 static inline int imp_connect_lru_resize(struct obd_import *imp)
 {
         struct obd_connect_data *ocd;
index cad36a4..1edafba 100644 (file)
@@ -495,7 +495,8 @@ do_lock:
         if (IS_ERR(op_data))
                 RETURN(PTR_ERR(op_data));
 
-        it->it_create_mode &= ~cfs_curproc_umask();
+        if (!IS_POSIXACL(parent) || !exp_connect_umask(exp))
+                it->it_create_mode &= ~cfs_curproc_umask();
         it->it_create_mode |= M_CHECK_STALE;
         rc = md_intent_lock(exp, op_data, NULL, 0, it,
                             lookup_flags,
index c8bba12..baddd60 100644 (file)
@@ -231,7 +231,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                 data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
 #endif
 #ifdef CONFIG_FS_POSIX_ACL
-        data->ocd_connect_flags |= OBD_CONNECT_ACL;
+        data->ocd_connect_flags |= OBD_CONNECT_ACL | OBD_CONNECT_UMASK;
 #endif
 
        if (OBD_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT))
index eca2929..32095e0 100644 (file)
@@ -516,7 +516,9 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
         if (IS_ERR(op_data))
                 RETURN((void *)op_data);
 
-        it->it_create_mode &= ~cfs_curproc_umask();
+        /* enforce umask if acl disabled or MDS doesn't support umask */
+        if (!IS_POSIXACL(parent) || !exp_connect_umask(ll_i2mdexp(parent)))
+                it->it_create_mode &= ~cfs_curproc_umask();
 
         rc = md_intent_lock(ll_i2mdexp(parent), op_data, NULL, 0, it,
                             lookup_flags, &req, ll_md_blocking_ast, 0);
@@ -788,7 +790,8 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
                name->len, name->name, dir->i_ino, dir->i_generation, dir,
                mode, rdev);
 
-        mode &= ~cfs_curproc_umask();
+        if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
+                mode &= ~cfs_curproc_umask();
 
         switch (mode & S_IFMT) {
         case 0:
@@ -912,7 +915,9 @@ static int ll_mkdir_generic(struct inode *dir, struct qstr *name,
         CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
                name->len, name->name, dir->i_ino, dir->i_generation, dir);
 
-        mode = (mode & (S_IRWXUGO|S_ISVTX) & ~cfs_curproc_umask()) | S_IFDIR;
+        if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
+                mode &= ~cfs_curproc_umask();
+        mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR;
         err = ll_new_node(dir, name, NULL, mode, 0, dchild, LUSTRE_OPC_MKDIR);
 
         if (!err)
index 9e9b829..9d09ab6 100644 (file)
@@ -152,6 +152,7 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
         rec->cr_suppgid2 = op_data->op_suppgids[1];
         set_mrc_cr_flags(rec, op_data->op_flags & MF_SOM_LOCAL_FLAGS);
         rec->cr_bias     = op_data->op_bias;
+        rec->cr_umask    = cfs_curproc_umask();
 
         mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
 
@@ -223,6 +224,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
         rec->cr_suppgid1 = op_data->op_suppgids[0];
         rec->cr_suppgid2 = op_data->op_suppgids[1];
         rec->cr_bias     = op_data->op_bias;
+        rec->cr_umask    = cfs_curproc_umask();
 
         mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
         /* the next buffer is child capa, which is used for replay,
index e83415e..b4994b4 100644 (file)
@@ -1436,6 +1436,13 @@ int mdd_object_initialize(const struct lu_env *env, const struct lu_fid *pfid,
          *  (2) maybe, the child attributes should be set in OSD when creation.
          */
 
+       /*
+        * inode mode has been set in creation time, and it's based on umask,
+        * la_mode and acl, don't set here again! (which will go wrong
+        * because below function doesn't consider umask).
+        * I'd suggest set all object attributes in creation time, see above.
+        */
+       attr->la_valid &= ~LA_MODE;
        rc = mdd_attr_set_internal(env, child, attr, handle, 0);
         if (rc != 0)
                 RETURN(rc);
index d6319db..5351615 100644 (file)
@@ -846,7 +846,22 @@ int mdo_create_obj(const struct lu_env *env, struct mdd_object *o,
                    struct thandle *handle)
 {
         struct dt_object *next = mdd_object_child(o);
-        return next->do_ops->do_create(env, next, attr, hint, dof, handle);
+       struct md_ucred *uc = md_ucred(env);
+       __u32 saved;
+       int rc;
+
+       /*
+        *  LU-974 enforce client umask in creation.
+        * TODO: CMD needs to handle this for remote object.
+        */
+        saved = xchg(&current->fs->umask, uc->mu_umask & S_IRWXUGO);
+
+       rc = next->do_ops->do_create(env, next, attr, hint, dof, handle);
+
+       /* restore previous umask value */
+       current->fs->umask = saved;
+
+       return rc;
 }
 
 static inline
index 5b40877..5ed23d6 100644 (file)
@@ -925,6 +925,7 @@ static int mdt_create_unpack(struct mdt_thread_info *info)
         uc->mu_cap   = rec->cr_cap;
         uc->mu_suppgids[0] = rec->cr_suppgid1;
         uc->mu_suppgids[1] = -1;
+        uc->mu_umask = rec->cr_umask;
 
         rr->rr_fid1 = &rec->cr_fid1;
         rr->rr_fid2 = &rec->cr_fid2;
@@ -1169,6 +1170,7 @@ static int mdt_open_unpack(struct mdt_thread_info *info)
         uc->mu_cap   = rec->cr_cap;
         uc->mu_suppgids[0] = rec->cr_suppgid1;
         uc->mu_suppgids[1] = rec->cr_suppgid2;
+        uc->mu_umask = rec->cr_umask;
 
         rr->rr_fid1   = &rec->cr_fid1;
         rr->rr_fid2   = &rec->cr_fid2;
index 49258c6..76a346c 100644 (file)
@@ -1878,11 +1878,6 @@ static int __osd_object_create(struct osd_thread_info *info,
                                struct thandle *th)
 {
        int     result;
-       __u32   umask;
-
-       /* we drop umask so that permissions we pass are not affected */
-       umask = current->fs->umask;
-       current->fs->umask = 0;
 
        result = osd_create_type_f(dof->dof_type)(info, obj, attr, hint, dof,
                                                  th);
@@ -1894,9 +1889,6 @@ static int __osd_object_create(struct osd_thread_info *info,
                        unlock_new_inode(obj->oo_inode);
         }
 
-       /* restore previous umask value */
-       current->fs->umask = umask;
-
         return result;
 }
 
index eaa5f64..0909d64 100644 (file)
@@ -54,7 +54,7 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux rhel6 2.6.32 #1 SMP Mon Aug 20 00:36:28 EDT 2012 x86_64 x86_64 x86_64 GNU
+         * running on Linux chopin 2.6.32.wc #9 SMP Thu Feb 9 14:43:41 CST 2012 x86_64 x86_64 x86_64 
          * with gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)  */
 
 
@@ -319,13 +319,13 @@ void lustre_assert_wire_constants(void)
         CLASSERT(LDLM_MAX_TYPE == 14);
         CLASSERT(LUSTRE_RES_ID_SEQ_OFF == 0);
         CLASSERT(LUSTRE_RES_ID_VER_OID_OFF == 1);
-       CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2);
-       CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3);
+        CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2);
+        CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3);
         CLASSERT(LUSTRE_RES_ID_HSH_OFF == 3);
-       CLASSERT(LQUOTA_TYPE_USR == 0);
-       CLASSERT(LQUOTA_TYPE_GRP == 1);
-       CLASSERT(LQUOTA_RES_MD == 1);
-       CLASSERT(LQUOTA_RES_DT == 2);
+        CLASSERT(LQUOTA_TYPE_USR == 0);
+        CLASSERT(LQUOTA_TYPE_GRP == 1);
+        CLASSERT(LQUOTA_RES_MD == 1);
+        CLASSERT(LQUOTA_RES_DT == 2);
         LASSERTF(OBD_PING == 400, "found %lld\n",
                  (long long)OBD_PING);
         LASSERTF(OBD_LOG_CANCEL == 401, "found %lld\n",
@@ -563,8 +563,9 @@ void lustre_assert_wire_constants(void)
                  (long long)LDF_COLLIDE);
         LASSERTF(LU_PAGE_SIZE == 4096, "found %lld\n",
                  (long long)LU_PAGE_SIZE);
-       LASSERTF((int)sizeof(union lu_page) == 4096, "found %lld\n",
-                (long long)(int)sizeof(union lu_page));
+        /* Checks for union lu_page */
+        LASSERTF((int)sizeof(union lu_page) == 4096, "found %lld\n",
+                 (long long)(int)sizeof(union lu_page));
 
         /* Checks for struct lustre_handle */
         LASSERTF((int)sizeof(struct lustre_handle) == 8, "found %lld\n",
@@ -1073,12 +1074,12 @@ void lustre_assert_wire_constants(void)
                  OBD_CONNECT_FLOCK_OWNER);
         LASSERTF(OBD_CONNECT_LVB_TYPE == 0x400000000000ULL, "found 0x%.16llxULL\n",
                  OBD_CONNECT_LVB_TYPE);
-       LASSERTF(OBD_CONNECT_NANOSEC_TIME == 0x800000000000ULL, "found 0x%.16llxULL\n",
+        LASSERTF(OBD_CONNECT_NANOSEC_TIME == 0x800000000000ULL, "found 0x%.16llxULL\n",
                  OBD_CONNECT_NANOSEC_TIME);
         LASSERTF(OBD_CONNECT_LIGHTWEIGHT == 0x1000000000000ULL, "found 0x%.16llxULL\n",
                  OBD_CONNECT_LIGHTWEIGHT);
-       LASSERTF(OBD_CONNECT_SHORTIO == 0x2000000000000ULL, "found 0x%.16llxULL\n",
-                OBD_CONNECT_SHORTIO);
+        LASSERTF(OBD_CONNECT_SHORTIO == 0x2000000000000ULL, "found 0x%.16llxULL\n",
+                 OBD_CONNECT_SHORTIO);
         LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                  (unsigned)OBD_CKSUM_CRC32);
         LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
@@ -1469,10 +1470,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct obd_statfs, os_state));
         LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_state) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_statfs *)0)->os_state));
-       LASSERTF((int)offsetof(struct obd_statfs, os_fprecreated) == 108, "found %lld\n",
-                (long long)(int)offsetof(struct obd_statfs, os_fprecreated));
-       LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fprecreated) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct obd_statfs *)0)->os_fprecreated));
+        LASSERTF((int)offsetof(struct obd_statfs, os_fprecreated) == 108, "found %lld\n",
+                 (long long)(int)offsetof(struct obd_statfs, os_fprecreated));
+        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fprecreated) == 4, "found %lld\n",
+                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_fprecreated));
         LASSERTF((int)offsetof(struct obd_statfs, os_spare2) == 112, "found %lld\n",
                  (long long)(int)offsetof(struct obd_statfs, os_spare2));
         LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare2) == 4, "found %lld\n",
@@ -1530,10 +1531,10 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
                  (long long)(int)sizeof(union lquota_id));
 
-       LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n",
-                (long long)QUOTABLOCK_BITS);
-       LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n",
-                (long long)QUOTABLOCK_SIZE);
+        LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n",
+                 (long long)QUOTABLOCK_BITS);
+        LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n",
+                 (long long)QUOTABLOCK_SIZE);
 
         /* Checks for struct obd_quotactl */
         LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
@@ -2278,10 +2279,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct mdt_rec_create, cr_flags_h));
         LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_flags_h) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_flags_h));
-        LASSERTF((int)offsetof(struct mdt_rec_create, cr_padding_3) == 128, "found %lld\n",
-                 (long long)(int)offsetof(struct mdt_rec_create, cr_padding_3));
-        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_padding_3) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_padding_3));
+        LASSERTF((int)offsetof(struct mdt_rec_create, cr_umask) == 128, "found %lld\n",
+                 (long long)(int)offsetof(struct mdt_rec_create, cr_umask));
+        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_umask) == 4, "found %lld\n",
+                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_umask));
         LASSERTF((int)offsetof(struct mdt_rec_create, cr_padding_4) == 132, "found %lld\n",
                  (long long)(int)offsetof(struct mdt_rec_create, cr_padding_4));
         LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_padding_4) == 4, "found %lld\n",
@@ -3089,8 +3090,6 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lquota_lvb, lvb_id_rel));
         LASSERTF((int)sizeof(((struct lquota_lvb *)0)->lvb_id_rel) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct lquota_lvb *)0)->lvb_id_rel));
-        LASSERTF(LQUOTA_FL_EDQUOT == 1, "found %lld\n",
-                 (long long)LQUOTA_FL_EDQUOT);
         LASSERTF((int)offsetof(struct lquota_lvb, lvb_id_qunit) == 24, "found %lld\n",
                  (long long)(int)offsetof(struct lquota_lvb, lvb_id_qunit));
         LASSERTF((int)sizeof(((struct lquota_lvb *)0)->lvb_id_qunit) == 8, "found %lld\n",
@@ -3099,6 +3098,8 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lquota_lvb, lvb_pad1));
         LASSERTF((int)sizeof(((struct lquota_lvb *)0)->lvb_pad1) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct lquota_lvb *)0)->lvb_pad1));
+        LASSERTF(LQUOTA_FL_EDQUOT == 1, "found %lld\n",
+                 (long long)LQUOTA_FL_EDQUOT);
 
         /* Checks for struct ldlm_gl_lquota_desc */
         LASSERTF((int)sizeof(struct ldlm_gl_lquota_desc) == 64, "found %lld\n",
diff --git a/lustre/tests/acl/974.test b/lustre/tests/acl/974.test
new file mode 100644 (file)
index 0000000..2026681
--- /dev/null
@@ -0,0 +1,18 @@
+LU-974 ignore umask when default acl with mask is set
+
+       $ umask 022
+       $ mkdir d
+
+       $ touch d/f1
+       $ ls -dl d/f1 | awk '{ print $1 }'
+       > -rw-r--r--
+
+       $ setfacl -R -d -m mask:007 d
+       $ touch d/f2
+       $ ls -dl d/f2 | awk '{ print $1 }'
+       > -rw-rw-r--+
+
+       $ umask 077
+       $ touch f3
+       $ ls -dl f3 | awk '{ print $1 }'
+       > -rw-------
index 7f9bdef..f3752a1 100644 (file)
@@ -5802,6 +5802,12 @@ test_103 () {
     run_acl_subtest inheritance || error "inheritance test failed"
     rm -f make-tree
 
+    echo "LU-974 ignore umask when acl is enabled..."
+    mkdir $DIR/974
+    cd $DIR/974
+    run_acl_subtest 974 || error "LU-974 test failed"
+    rm -rf $DIR/974
+
     cd $SAVE_PWD
     umask $SAVE_UMASK
 
index a049517..e184d47 100644 (file)
@@ -680,7 +680,7 @@ check_obd_statfs(void)
         CHECK_MEMBER(obd_statfs, os_bsize);
         CHECK_MEMBER(obd_statfs, os_namelen);
         CHECK_MEMBER(obd_statfs, os_state);
-        CHECK_MEMBER(obd_statfs, os_spare1);
+        CHECK_MEMBER(obd_statfs, os_fprecreated);
         CHECK_MEMBER(obd_statfs, os_spare2);
         CHECK_MEMBER(obd_statfs, os_spare3);
         CHECK_MEMBER(obd_statfs, os_spare4);
@@ -1008,7 +1008,7 @@ check_mdt_rec_create(void)
         CHECK_MEMBER(mdt_rec_create, cr_bias);
         CHECK_MEMBER(mdt_rec_create, cr_flags_l);
         CHECK_MEMBER(mdt_rec_create, cr_flags_h);
-        CHECK_MEMBER(mdt_rec_create, cr_padding_3);
+        CHECK_MEMBER(mdt_rec_create, cr_umask);
         CHECK_MEMBER(mdt_rec_create, cr_padding_4);
 }
 
index bdefdd2..8d139f5 100644 (file)
@@ -62,7 +62,7 @@ void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
          * (make -C lustre/utils newwiretest)
-         * running on Linux rhel6 2.6.32 #1 SMP Mon Aug 20 00:36:28 EDT 2012 x86_64 x86_64 x86_64 GNU
+         * running on Linux chopin 2.6.32.wc #9 SMP Thu Feb 9 14:43:41 CST 2012 x86_64 x86_64 x86_64 
          * with gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)  */
 
 
@@ -327,13 +327,13 @@ void lustre_assert_wire_constants(void)
         CLASSERT(LDLM_MAX_TYPE == 14);
         CLASSERT(LUSTRE_RES_ID_SEQ_OFF == 0);
         CLASSERT(LUSTRE_RES_ID_VER_OID_OFF == 1);
-       CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2);
-       CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3);
+        CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2);
+        CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3);
         CLASSERT(LUSTRE_RES_ID_HSH_OFF == 3);
-       CLASSERT(LQUOTA_TYPE_USR == 0);
-       CLASSERT(LQUOTA_TYPE_GRP == 1);
-       CLASSERT(LQUOTA_RES_MD == 1);
-       CLASSERT(LQUOTA_RES_DT == 2);
+        CLASSERT(LQUOTA_TYPE_USR == 0);
+        CLASSERT(LQUOTA_TYPE_GRP == 1);
+        CLASSERT(LQUOTA_RES_MD == 1);
+        CLASSERT(LQUOTA_RES_DT == 2);
         LASSERTF(OBD_PING == 400, "found %lld\n",
                  (long long)OBD_PING);
         LASSERTF(OBD_LOG_CANCEL == 401, "found %lld\n",
@@ -571,8 +571,9 @@ void lustre_assert_wire_constants(void)
                  (long long)LDF_COLLIDE);
         LASSERTF(LU_PAGE_SIZE == 4096, "found %lld\n",
                  (long long)LU_PAGE_SIZE);
-       LASSERTF((int)sizeof(union lu_page) == 4096, "found %lld\n",
-                (long long)(int)sizeof(union lu_page));
+        /* Checks for union lu_page */
+        LASSERTF((int)sizeof(union lu_page) == 4096, "found %lld\n",
+                 (long long)(int)sizeof(union lu_page));
 
         /* Checks for struct lustre_handle */
         LASSERTF((int)sizeof(struct lustre_handle) == 8, "found %lld\n",
@@ -1083,10 +1084,10 @@ void lustre_assert_wire_constants(void)
                  OBD_CONNECT_LVB_TYPE);
         LASSERTF(OBD_CONNECT_NANOSEC_TIME == 0x800000000000ULL, "found 0x%.16llxULL\n",
                  OBD_CONNECT_NANOSEC_TIME);
-       LASSERTF(OBD_CONNECT_LIGHTWEIGHT == 0x1000000000000ULL, "found 0x%.16llxULL\n",
+        LASSERTF(OBD_CONNECT_LIGHTWEIGHT == 0x1000000000000ULL, "found 0x%.16llxULL\n",
                  OBD_CONNECT_LIGHTWEIGHT);
-       LASSERTF(OBD_CONNECT_SHORTIO == 0x2000000000000ULL, "found 0x%.16llxULL\n",
-                OBD_CONNECT_SHORTIO);
+        LASSERTF(OBD_CONNECT_SHORTIO == 0x2000000000000ULL, "found 0x%.16llxULL\n",
+                 OBD_CONNECT_SHORTIO);
         LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                  (unsigned)OBD_CKSUM_CRC32);
         LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
@@ -1477,10 +1478,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct obd_statfs, os_state));
         LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_state) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_statfs *)0)->os_state));
-       LASSERTF((int)offsetof(struct obd_statfs, os_fprecreated) == 108, "found %lld\n",
-                (long long)(int)offsetof(struct obd_statfs, os_fprecreated));
-       LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fprecreated) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct obd_statfs *)0)->os_fprecreated));
+        LASSERTF((int)offsetof(struct obd_statfs, os_fprecreated) == 108, "found %lld\n",
+                 (long long)(int)offsetof(struct obd_statfs, os_fprecreated));
+        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fprecreated) == 4, "found %lld\n",
+                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_fprecreated));
         LASSERTF((int)offsetof(struct obd_statfs, os_spare2) == 112, "found %lld\n",
                  (long long)(int)offsetof(struct obd_statfs, os_spare2));
         LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare2) == 4, "found %lld\n",
@@ -1538,10 +1539,10 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
                  (long long)(int)sizeof(union lquota_id));
 
-       LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n",
-                (long long)QUOTABLOCK_BITS);
-       LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n",
-                (long long)QUOTABLOCK_SIZE);
+        LASSERTF(QUOTABLOCK_BITS == 10, "found %lld\n",
+                 (long long)QUOTABLOCK_BITS);
+        LASSERTF(QUOTABLOCK_SIZE == 1024, "found %lld\n",
+                 (long long)QUOTABLOCK_SIZE);
 
         /* Checks for struct obd_quotactl */
         LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
@@ -2286,10 +2287,10 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct mdt_rec_create, cr_flags_h));
         LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_flags_h) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_flags_h));
-        LASSERTF((int)offsetof(struct mdt_rec_create, cr_padding_3) == 128, "found %lld\n",
-                 (long long)(int)offsetof(struct mdt_rec_create, cr_padding_3));
-        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_padding_3) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_padding_3));
+        LASSERTF((int)offsetof(struct mdt_rec_create, cr_umask) == 128, "found %lld\n",
+                 (long long)(int)offsetof(struct mdt_rec_create, cr_umask));
+        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_umask) == 4, "found %lld\n",
+                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_umask));
         LASSERTF((int)offsetof(struct mdt_rec_create, cr_padding_4) == 132, "found %lld\n",
                  (long long)(int)offsetof(struct mdt_rec_create, cr_padding_4));
         LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_padding_4) == 4, "found %lld\n",
@@ -3097,8 +3098,6 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lquota_lvb, lvb_id_rel));
         LASSERTF((int)sizeof(((struct lquota_lvb *)0)->lvb_id_rel) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct lquota_lvb *)0)->lvb_id_rel));
-        LASSERTF(LQUOTA_FL_EDQUOT == 1, "found %lld\n",
-                 (long long)LQUOTA_FL_EDQUOT);
         LASSERTF((int)offsetof(struct lquota_lvb, lvb_id_qunit) == 24, "found %lld\n",
                  (long long)(int)offsetof(struct lquota_lvb, lvb_id_qunit));
         LASSERTF((int)sizeof(((struct lquota_lvb *)0)->lvb_id_qunit) == 8, "found %lld\n",
@@ -3107,6 +3106,8 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lquota_lvb, lvb_pad1));
         LASSERTF((int)sizeof(((struct lquota_lvb *)0)->lvb_pad1) == 8, "found %lld\n",
                  (long long)(int)sizeof(((struct lquota_lvb *)0)->lvb_pad1));
+        LASSERTF(LQUOTA_FL_EDQUOT == 1, "found %lld\n",
+                 (long long)LQUOTA_FL_EDQUOT);
 
         /* Checks for struct ldlm_gl_lquota_desc */
         LASSERTF((int)sizeof(struct ldlm_gl_lquota_desc) == 64, "found %lld\n",