Whamcloud - gitweb
land b_groups onto HEAD:
authorericm <ericm>
Mon, 30 Aug 2004 20:53:00 +0000 (20:53 +0000)
committerericm <ericm>
Mon, 30 Aug 2004 20:53:00 +0000 (20:53 +0000)
 - add a flag in lustre_msg which indicate message type
 - add a security descriptor into most of messages send to MDSs, which
   include the uid, supplementary groups array etc.
 - add group hash
 - MDS retrive local groups database through upcall, and set/merge with
   which sent from client based on policies (here not totally finished)
 - move root_squash test into separate sanity-sec.sh

55 files changed:
lustre/cmobd/cmobd_mds_reint.c
lustre/cobd/cache_obd.c
lustre/include/linux/lustre_compat25.h
lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_lite.h
lustre/include/linux/lustre_mds.h
lustre/include/linux/lustre_net.h
lustre/include/linux/lvfs.h
lustre/include/linux/obd.h
lustre/include/linux/obd_class.h
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/llite/dcache.c
lustre/llite/dir.c
lustre/llite/namei.c
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_internal.h
lustre/lvfs/lvfs_linux.c
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_lib.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/mds/Makefile.in
lustre/mds/Makefile.mk
lustre/mds/handler.c
lustre/mds/lproc_mds.c
lustre/mds/mds_groups.c [new file with mode: 0644]
lustre/mds/mds_internal.h
lustre/mds/mds_lib.c
lustre/mds/mds_lmv.c
lustre/mds/mds_open.c
lustre/mds/mds_reint.c
lustre/mgmt/mgmt_svc.c
lustre/osc/osc_create.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/ptlbd/client.c
lustre/ptlbd/rpc.c
lustre/ptlrpc/client.c
lustre/ptlrpc/import.c
lustre/ptlrpc/llog_client.c
lustre/ptlrpc/llog_net.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/pinger.c
lustre/ptlrpc/ptlrpc_module.c
lustre/ptlrpc/recov_thread.c
lustre/smfs/mds_kml.c
lustre/tests/sanity-sec.sh [new file with mode: 0644]
lustre/tests/sanity.sh
lustre/utils/Makefile.am
lustre/utils/l_getgroups.c [new file with mode: 0644]
lustre/utils/lconf
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index c2edd3f..0fb8e07 100644 (file)
@@ -156,8 +156,8 @@ int cmobd_reint_mds(struct obd_device *obd, void* record)
         mkpi = (struct mds_kml_pack_info *)record; 
        
         req = ptlrpc_prep_req(class_exp2cliimp(cmobd->cm_master_exp), 
         mkpi = (struct mds_kml_pack_info *)record; 
        
         req = ptlrpc_prep_req(class_exp2cliimp(cmobd->cm_master_exp), 
-                              MDS_REINT, mkpi->mpi_bufcount, mkpi->mpi_size, 
-                              NULL);
+                              LUSTRE_MDS_VERSION, MDS_REINT,
+                              mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
         record += sizeof(*mkpi);
         if (req == NULL)
                 RETURN(-ENOMEM);
         record += sizeof(*mkpi);
index 43b29ab..f4072eb 100644 (file)
@@ -1141,7 +1141,7 @@ static int cobd_md_enqueue(struct obd_export *exp, int lock_type,
                           cb_data);
 }
 
                           cb_data);
 }
 
-static int cobd_md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
+static int cobd_md_intent_lock(struct obd_export *exp,
                                struct ll_fid *pfid, const char *name, int len,
                                void *lmm, int lmmsize,
                                struct ll_fid *cfid, struct lookup_intent *it,
                                struct ll_fid *pfid, const char *name, int len,
                                void *lmm, int lmmsize,
                                struct ll_fid *cfid, struct lookup_intent *it,
@@ -1157,7 +1157,7 @@ static int cobd_md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
                 return -EINVAL;
         }
         cobd_exp = cobd_get_exp(obd);
-        return md_intent_lock(cobd_exp, uctxt, pfid, name, len, lmm, lmmsize,
+        return md_intent_lock(cobd_exp, pfid, name, len, lmm, lmmsize,
                               cfid, it, lookup_flags, reqp, cb_blocking);
 }
 
                               cfid, it, lookup_flags, reqp, cb_blocking);
 }
 
index 9b985d5..48ba509 100644 (file)
 
 #include <linux/portals_compat25.h>
 
 
 #include <linux/portals_compat25.h>
 
+/*
+ * groups_info related staff
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
+
+#define NGROUPS_SMALL           NGROUPS
+#define NGROUPS_PER_BLOCK       ((int)(EXEC_PAGESIZE / sizeof(gid_t)))
+struct group_info {
+        int        ngroups;
+        atomic_t   usage;
+        gid_t      small_block[NGROUPS_SMALL];
+        int        nblocks;
+        gid_t     *blocks[0];
+};
+#define current_ngroups current->ngroups
+                                                                           
+struct group_info *groups_alloc(int gidsetsize);
+void groups_free(struct group_info *ginfo);
+int groups_search(struct group_info *ginfo, gid_t grp);
+
+#define get_group_info(group_info)                              \
+        do {                                                    \
+                atomic_inc(&(group_info)->usage);               \
+        } while (0)
+
+#define put_group_info(group_info)                              \
+        do {                                                    \
+                if (atomic_dec_and_test(&(group_info)->usage))  \
+                        groups_free(group_info);                \
+        } while (0)
+
+#define groups_sort(gi) do {} while (0)
+
+#define GROUP_AT(gi, i) ((gi)->small_block[(i)])
+
+static inline int cleanup_group_info(void)
+{
+        /* Get rid of unneeded supplementary groups */
+        current->ngroups = 0;
+        memset(current->groups, 0, sizeof(current->groups));
+        return 0;
+}
+
+#else /* >= 2.6.4 */
+
+#define current_ngroups current->group_info->ngroups
+
+void groups_sort(struct group_info *ginfo);
+int groups_search(struct group_info *ginfo, gid_t grp);
+
+static inline int cleanup_group_info(void)
+{
+        struct group_info *ginfo;
+
+        ginfo = groups_alloc(0);
+        if (!ginfo)
+                return -ENOMEM;
+
+        set_current_groups(ginfo);
+        put_group_info(ginfo);
+
+        return 0;
+}
+#endif /* end of groups_info stuff */
+
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 
 /*
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 
 /*
@@ -85,21 +151,6 @@ static inline void lustre_daemonize_helper(void)
         current->signal->tty = NULL;
 }
 
         current->signal->tty = NULL;
 }
 
-static inline int cleanup_group_info(void)
-{
-        struct group_info *ginfo;
-
-        ginfo = groups_alloc(2);
-        if (!ginfo)
-                return -ENOMEM;
-
-        ginfo->ngroups = 0;
-        set_current_groups(ginfo);
-        put_group_info(ginfo);
-
-        return 0;
-}
-
 #define smp_num_cpus    NR_CPUS
 
 #include <linux/proc_fs.h>
 #define smp_num_cpus    NR_CPUS
 
 #include <linux/proc_fs.h>
@@ -171,14 +222,6 @@ static inline void lustre_daemonize_helper(void)
         current->tty = NULL;
 }
 
         current->tty = NULL;
 }
 
-static inline int cleanup_group_info(void)
-{
-        /* Get rid of unneeded supplementary groups */
-        current->ngroups = 0;
-        memset(current->groups, 0, sizeof(current->groups));
-        return 0;
-}
-
 #ifndef HAVE_COND_RESCHED
 static inline void cond_resched(void)
 {
 #ifndef HAVE_COND_RESCHED
 static inline void cond_resched(void)
 {
index fcb29c7..b0d32e5 100644 (file)
 
 
 #define PTLRPC_MSG_VERSION  0x00000003
 
 
 #define PTLRPC_MSG_VERSION  0x00000003
-#define LUSTRE_MDS_VERSION  (0x00040000|PTLRPC_MSG_VERSION)
-#define LUSTRE_OST_VERSION  (0x00040000|PTLRPC_MSG_VERSION)
-#define LUSTRE_DLM_VERSION  (0x00040000|PTLRPC_MSG_VERSION)
+#define LUSTRE_VERSION_MASK 0xffff0000
+#define LUSTRE_OBD_VERSION  0x00010000
+#define LUSTRE_MDS_VERSION  0x00020000
+#define LUSTRE_OST_VERSION  0x00030000
+#define LUSTRE_DLM_VERSION  0x00040000
+#define LUSTRE_LOG_VERSION  0x00050000
+#define LUSTRE_PBD_VERSION  0x00060000
 
 /* initial pid  */
 #define LUSTRE_PTL_PID          999999
 
 /* initial pid  */
 #define LUSTRE_PTL_PID          999999
@@ -466,6 +470,38 @@ extern void lustre_swab_ost_lvb(struct ost_lvb *);
  *   MDS REQ RECORDS
  */
 
  *   MDS REQ RECORDS
  */
 
+/* offsets in the request */
+#define MDS_REQ_SECDESC_OFF             0
+#define MDS_REQ_REC_OFF                 1
+
+#define MDS_REQ_INTENT_LOCKREQ_OFF      1
+#define MDS_REQ_INTENT_IT_OFF           2
+#define MDS_REQ_INTENT_REC_OFF          3
+
+/* maximum supplementary groups */
+#define LUSTRE_MAX_GROUPS               128
+
+/* 
+ * security descriptor in mds request
+ *
+ * note gid & cap might need be removed later:
+ *  - cap should be obtained on mds
+ *  - gid is actually not used.
+ */
+struct mds_req_sec_desc {
+        __u32           rsd_uid;
+        __u32           rsd_gid;
+        __u32           rsd_fsuid;
+        __u32           rsd_fsgid;
+        __u32           rsd_cap;
+        __u32           rsd_ngroups;
+        __u32           rsd_groups[0];
+};
+
+struct ptlrpc_request;
+struct mds_req_sec_desc *lustre_swab_mds_secdesc(struct ptlrpc_request *req,
+                                                 int offset);
+
 /* opcodes */
 typedef enum {
         MDS_GETATTR      = 33,
 /* opcodes */
 typedef enum {
         MDS_GETATTR      = 33,
@@ -562,9 +598,6 @@ struct mds_body {
         __u64          io_epoch;
         __u32          ino;   /* make this a __u64 */
         __u32          valid;
         __u64          io_epoch;
         __u32          ino;   /* make this a __u64 */
         __u32          valid;
-        __u32          fsuid;
-        __u32          fsgid;
-        __u32          capability;
         __u32          mode;
         __u32          uid;
         __u32          gid;
         __u32          mode;
         __u32          uid;
         __u32          gid;
@@ -575,7 +608,6 @@ struct mds_body {
         __u32          rdev;
         __u32          nlink; /* #bytes to read in the case of MDS_READPAGE */
         __u32          generation;
         __u32          rdev;
         __u32          nlink; /* #bytes to read in the case of MDS_READPAGE */
         __u32          generation;
-        __u32          suppgid;
         __u32          eadatasize;
         __u32          mds;
 };
         __u32          eadatasize;
         __u32          mds;
 };
@@ -588,15 +620,9 @@ struct lustre_md {
         struct mea *mea;
 };
 
         struct mea *mea;
 };
 
-struct ll_uctxt {
-        __u32 gid1;
-        __u32 gid2;
-};
-
 struct mdc_op_data {
         struct ll_fid fid1;
         struct ll_fid fid2;
 struct mdc_op_data {
         struct ll_fid fid1;
         struct ll_fid fid2;
-        struct ll_uctxt ctxt;
         __u64 mod_time;
         const char *name;
         int namelen;
         __u64 mod_time;
         const char *name;
         int namelen;
@@ -610,10 +636,6 @@ struct mdc_op_data {
 
 struct mds_rec_setattr {
         __u32           sa_opcode;
 
 struct mds_rec_setattr {
         __u32           sa_opcode;
-        __u32           sa_fsuid;
-        __u32           sa_fsgid;
-        __u32           sa_cap;
-        __u32           sa_suppgid;
         __u32           sa_valid;
         struct ll_fid   sa_fid;
         __u32           sa_mode;
         __u32           sa_valid;
         struct ll_fid   sa_fid;
         __u32           sa_mode;
@@ -653,28 +675,20 @@ extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
 
 struct mds_rec_create {
         __u32           cr_opcode;
 
 struct mds_rec_create {
         __u32           cr_opcode;
-        __u32           cr_fsuid;
-        __u32           cr_fsgid;
-        __u32           cr_cap;
         __u32           cr_flags; /* for use with open */
         __u32           cr_mode;
         __u32           cr_flags; /* for use with open */
         __u32           cr_mode;
+        __u32           cr_padding;
         struct ll_fid   cr_fid;
         struct ll_fid   cr_replayfid;
         __u64           cr_time;
         __u64           cr_rdev;
         struct ll_fid   cr_fid;
         struct ll_fid   cr_replayfid;
         __u64           cr_time;
         __u64           cr_rdev;
-        __u32           cr_suppgid;
-        __u32           cr_packing;
 };
 
 extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
 
 struct mds_rec_link {
         __u32           lk_opcode;
 };
 
 extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
 
 struct mds_rec_link {
         __u32           lk_opcode;
-        __u32           lk_fsuid;
-        __u32           lk_fsgid;
-        __u32           lk_cap;
-        __u32           lk_suppgid1;
-        __u32           lk_suppgid2;
+        __u32           lk_padding;
         struct ll_fid   lk_fid1;
         struct ll_fid   lk_fid2;
         __u64           lk_time;
         struct ll_fid   lk_fid1;
         struct ll_fid   lk_fid2;
         __u64           lk_time;
@@ -684,10 +698,6 @@ extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
 
 struct mds_rec_unlink {
         __u32           ul_opcode;
 
 struct mds_rec_unlink {
         __u32           ul_opcode;
-        __u32           ul_fsuid;
-        __u32           ul_fsgid;
-        __u32           ul_cap;
-        __u32           ul_suppgid;
         __u32           ul_mode;
         struct ll_fid   ul_fid1;
         struct ll_fid   ul_fid2;
         __u32           ul_mode;
         struct ll_fid   ul_fid1;
         struct ll_fid   ul_fid2;
@@ -698,11 +708,7 @@ extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
 
 struct mds_rec_rename {
         __u32           rn_opcode;
 
 struct mds_rec_rename {
         __u32           rn_opcode;
-        __u32           rn_fsuid;
-        __u32           rn_fsgid;
-        __u32           rn_cap;
-        __u32           rn_suppgid1;
-        __u32           rn_suppgid2;
+        __u32           rn_padding;
         struct ll_fid   rn_fid1;
         struct ll_fid   rn_fid2;
         __u64           rn_time;
         struct ll_fid   rn_fid1;
         struct ll_fid   rn_fid2;
         __u64           rn_time;
index 26d38c8..1c34c4c 100644 (file)
@@ -159,26 +159,6 @@ static inline void ll_inode2fid(struct ll_fid *fid, struct inode *inode)
         fid->mds = ll_i2info(inode)->lli_mds;
 }
 
         fid->mds = ll_i2info(inode)->lli_mds;
 }
 
-static inline void ll_i2uctxt(struct ll_uctxt *ctxt, struct inode *i1,
-                              struct inode *i2)
-{
-        LASSERT(i1);
-        LASSERT(ctxt);
-
-        if (in_group_p(i1->i_gid))
-                ctxt->gid1 = i1->i_gid;
-        else
-                ctxt->gid1 = -1;
-
-        if (i2) {
-                if (in_group_p(i2->i_gid))
-                        ctxt->gid2 = i2->i_gid;
-                else
-                        ctxt->gid2 = -1;
-        } else
-                ctxt->gid2 = 0;
-}
-
 static inline void 
 ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
                        struct inode *i2, const char *name, int namelen,
 static inline void 
 ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
                        struct inode *i2, const char *name, int namelen,
@@ -186,7 +166,6 @@ ll_prepare_mdc_op_data(struct mdc_op_data *data, struct inode *i1,
 {
         LASSERT(i1);
 
 {
         LASSERT(i1);
 
-        ll_i2uctxt(&data->ctxt, i1, i2);
         ll_inode2fid(&data->fid1, i1);
 
         /* it could be directory with mea */
         ll_inode2fid(&data->fid1, i1);
 
         /* it could be directory with mea */
index 2d81605..04fbe09 100644 (file)
@@ -75,8 +75,7 @@ struct mds_update_record {
 #define _ur_fsuid    ur_uc.luc_fsuid
 #define _ur_fsgid    ur_uc.luc_fsgid
 #define _ur_cap      ur_uc.luc_cap
 #define _ur_fsuid    ur_uc.luc_fsuid
 #define _ur_fsgid    ur_uc.luc_fsgid
 #define _ur_cap      ur_uc.luc_cap
-#define _ur_suppgid1 ur_uc.luc_suppgid1
-#define _ur_suppgid2 ur_uc.luc_suppgid2
+#define _ur_uid      ur_uc.luc_uid
 
 /* i_attr_flags holds the open count in the inode in 2.4 */
 //XXX Alex implement on 2.4 with i_attr_flags and find soln for 2.5 please
 
 /* i_attr_flags holds the open count in the inode in 2.4 */
 //XXX Alex implement on 2.4 with i_attr_flags and find soln for 2.5 please
@@ -158,6 +157,32 @@ struct mds_file_data {
         struct dentry        *mfd_dentry;
 };
 
         struct dentry        *mfd_dentry;
 };
 
+/* group hash table */
+struct mds_grp_hash_entry {
+        struct list_head        ge_hash;
+        struct group_info      *ge_group_info;
+        uid_t                   ge_uid;
+        int                     ge_flags;
+        atomic_t                ge_refcount;
+        wait_queue_head_t       ge_waitq;
+        long                    ge_acquisition_time;
+        unsigned long           ge_acquire_expire;
+        unsigned long           ge_expire;
+};
+
+#define MDSGRP_HASH_SIZE        (128)
+#define MDSGRP_HASH_INDEX(id)   ((id) & (MDSGRP_HASH_SIZE - 1))
+#define MDSGRP_UPCALL_MAXPATH   (1024)
+
+struct mds_grp_hash {
+        struct list_head        gh_table[MDSGRP_HASH_SIZE];
+        spinlock_t              gh_lock;
+        char                    gh_upcall[MDSGRP_UPCALL_MAXPATH];
+        int                     gh_entry_expire;
+        int                     gh_acquire_expire;
+        unsigned int            gh_allow_setgroups:1;
+};
+
 /* mds/mds_reint.c  */
 int mds_reint_rec(struct mds_update_record *r, int offset,
                   struct ptlrpc_request *req, struct lustre_handle *);
 /* mds/mds_reint.c  */
 int mds_reint_rec(struct mds_update_record *r, int offset,
                   struct ptlrpc_request *req, struct lustre_handle *);
@@ -186,8 +211,7 @@ int it_open_error(int phase, struct lookup_intent *it);
 int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data);
 int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid, 
                       ldlm_iterator_t it, void *data);
 int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data);
 int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid, 
                       ldlm_iterator_t it, void *data);
-int mdc_intent_lock(struct obd_export *exp, struct ll_uctxt *, 
-                    struct ll_fid *parent, 
+int mdc_intent_lock(struct obd_export *exp, struct ll_fid *parent, 
                     const char *name, int len, void *lmm, int lmmsize,
                     struct ll_fid *child,
                     struct lookup_intent *, int, 
                     const char *name, int len, void *lmm, int lmmsize,
                     struct ll_fid *child,
                     struct lookup_intent *, int, 
@@ -206,6 +230,8 @@ int mdc_enqueue(struct obd_export *exp,
                 void *cb_data);
 
 /* mdc/mdc_request.c */
                 void *cb_data);
 
 /* mdc/mdc_request.c */
+int mdc_get_secdesc_size(void);
+void mdc_pack_secdesc(struct ptlrpc_request *req, int size);
 int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req, 
                       unsigned int offset, struct obd_export *exp_osc, 
                       struct lustre_md *md);
 int mdc_req2lustre_md(struct obd_export *exp_mdc, struct ptlrpc_request *req, 
                       unsigned int offset, struct obd_export *exp_osc, 
                       struct lustre_md *md);
index aa8309d..107d849 100644 (file)
@@ -632,8 +632,9 @@ void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *);
 void ptlrpc_set_add_new_req(struct ptlrpc_request_set *,
                             struct ptlrpc_request *);
 
 void ptlrpc_set_add_new_req(struct ptlrpc_request_set *,
                             struct ptlrpc_request *);
 
-struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, int opcode,
-                                       int count, int *lengths, char **bufs);
+struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
+                                       int opcode, int count, int *lengths,
+                                       char **bufs);
 void ptlrpc_free_req(struct ptlrpc_request *request);
 void ptlrpc_req_finished(struct ptlrpc_request *request);
 void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request);
 void ptlrpc_free_req(struct ptlrpc_request *request);
 void ptlrpc_req_finished(struct ptlrpc_request *request);
 void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request);
@@ -686,6 +687,7 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp);
 
 /* ptlrpc/pack_generic.c */
 int lustre_msg_swabbed(struct lustre_msg *msg);
 
 /* ptlrpc/pack_generic.c */
 int lustre_msg_swabbed(struct lustre_msg *msg);
+int lustre_msg_check_version(struct lustre_msg *msg, __u32 version);
 int lustre_pack_request(struct ptlrpc_request *, int count, int *lens,
                         char **bufs);
 int lustre_pack_reply(struct ptlrpc_request *, int count, int *lens,
 int lustre_pack_request(struct ptlrpc_request *, int count, int *lens,
                         char **bufs);
 int lustre_pack_reply(struct ptlrpc_request *, int count, int *lens,
@@ -703,10 +705,9 @@ void *lustre_swab_repbuf (struct ptlrpc_request *req, int n, int minlen,
 
 void lustre_init_msg (struct lustre_msg *msg, int count, 
                       int *lens, char **bufs);
 
 void lustre_init_msg (struct lustre_msg *msg, int count, 
                       int *lens, char **bufs);
-void *mdc_setattr_pack(struct lustre_msg *msg,
-                       struct mdc_op_data *data,
-                       struct iattr *iattr, void *ea, int ealen,
-                      void *ea2, int ea2len);
+void *mdc_setattr_pack(struct lustre_msg *msg, int offset,
+                       struct mdc_op_data *data, struct iattr *iattr,
+                       void *ea, int ealen, void *ea2, int ea2len);
 void *mdc_create_pack(struct lustre_msg *msg, int offset,
                       struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
                       const void *data, int datalen);
 void *mdc_create_pack(struct lustre_msg *msg, int offset,
                       struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
                       const void *data, int datalen);
index 1937168..73c7bc2 100644 (file)
@@ -6,6 +6,7 @@
 #define LL_FID_NAMELEN (16 + 1 + 8 + 1)
 
 #if defined __KERNEL__
 #define LL_FID_NAMELEN (16 + 1 + 8 + 1)
 
 #if defined __KERNEL__
+#include <linux/lustre_compat25.h>
 #include <linux/lvfs_linux.h>
 #endif 
 
 #include <linux/lvfs_linux.h>
 #endif 
 
 #include <lvfs_user_fs.h>
 #endif
 
 #include <lvfs_user_fs.h>
 #endif
 
+struct mds_grp_hash_entry;
+
 /* simple.c */
 struct lvfs_ucred {
 /* simple.c */
 struct lvfs_ucred {
+        struct mds_grp_hash_entry *luc_ghash;
+        struct group_info *luc_ginfo;
         __u32 luc_fsuid;
         __u32 luc_fsgid;
         __u32 luc_cap;
         __u32 luc_fsuid;
         __u32 luc_fsgid;
         __u32 luc_cap;
-        __u32 luc_suppgid1;
-        __u32 luc_suppgid2;
+        __u32 luc_uid;
 };
 
 struct lvfs_callback_ops {
 };
 
 struct lvfs_callback_ops {
@@ -29,15 +33,20 @@ struct lvfs_callback_ops {
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
 #define OBD_CTXT_DEBUG          /* development-only debugging */
 struct lvfs_run_ctxt {
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
 #define OBD_CTXT_DEBUG          /* development-only debugging */
 struct lvfs_run_ctxt {
-        struct vfsmount *pwdmnt;
-        struct dentry   *pwd;
-        mm_segment_t     fs;
-        struct lvfs_ucred luc;
-        int              ngroups;
+        struct vfsmount                *pwdmnt;
+        struct dentry           *pwd;
+        mm_segment_t             fs;
+        struct lvfs_ucred        luc;
         struct lvfs_callback_ops cb_ops;
         struct lvfs_callback_ops cb_ops;
+        int                      ngroups;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
+        struct group_info       *group_info;
+#else
+        struct group_info        group_info;
+#endif
 #ifdef OBD_CTXT_DEBUG
 #ifdef OBD_CTXT_DEBUG
-       int              pid;
-        __u32            magic;
+        int                      pid;
+        __u32                    magic;
 #endif
 };
 
 #endif
 };
 
index 7e7ccdc..9b56834 100644 (file)
@@ -798,8 +798,6 @@ struct obd_ops {
          */
 };
 
          */
 };
 
-struct ll_uctxt;
-
 struct md_ops {
         int (*m_getstatus)(struct obd_export *, struct ll_fid *);
         int (*m_change_cbdata)(struct obd_export *, struct ll_fid *,
 struct md_ops {
         int (*m_getstatus)(struct obd_export *, struct ll_fid *);
         int (*m_change_cbdata)(struct obd_export *, struct ll_fid *,
@@ -824,7 +822,7 @@ struct md_ops {
         int (*m_getattr_name)(struct obd_export *, struct ll_fid *,
                               char *, int, unsigned long,
                               unsigned int, struct ptlrpc_request **);
         int (*m_getattr_name)(struct obd_export *, struct ll_fid *,
                               char *, int, unsigned long,
                               unsigned int, struct ptlrpc_request **);
-        int (*m_intent_lock)(struct obd_export *, struct ll_uctxt *,
+        int (*m_intent_lock)(struct obd_export *,
                              struct ll_fid *, const char *, int,
                              void *, int, struct ll_fid *,
                              struct lookup_intent *, int,
                              struct ll_fid *, const char *, int,
                              void *, int, struct ll_fid *,
                              struct lookup_intent *, int,
index 88f16ff..d5d2457 100644 (file)
@@ -1295,7 +1295,7 @@ static inline int md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-static inline int md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
+static inline int md_intent_lock(struct obd_export *exp,
                                  struct ll_fid *pfid, const char *name,
                                  int len, void *lmm, int lmmsize,
                                  struct ll_fid *cfid, struct lookup_intent *it,
                                  struct ll_fid *pfid, const char *name,
                                  int len, void *lmm, int lmmsize,
                                  struct ll_fid *cfid, struct lookup_intent *it,
@@ -1306,7 +1306,7 @@ static inline int md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
         ENTRY;
         EXP_CHECK_MD_OP(exp, intent_lock);
         MD_COUNTER_INCREMENT(exp->exp_obd, intent_lock);
         ENTRY;
         EXP_CHECK_MD_OP(exp, intent_lock);
         MD_COUNTER_INCREMENT(exp->exp_obd, intent_lock);
-        rc = MDP(exp->exp_obd, intent_lock)(exp, uctxt, pfid, name, len,
+        rc = MDP(exp->exp_obd, intent_lock)(exp, pfid, name, len,
                                             lmm, lmmsize, cfid, it, flags,
                                             reqp, cb_blocking);
         RETURN(rc);
                                             lmm, lmmsize, cfid, it, flags,
                                             reqp, cb_blocking);
         RETURN(rc);
index d1a60fe..1a298b9 100644 (file)
@@ -394,7 +394,8 @@ int ldlm_server_blocking_ast(struct ldlm_lock *lock,
 #endif
 
         req = ptlrpc_prep_req(lock->l_export->exp_imp_reverse,
 #endif
 
         req = ptlrpc_prep_req(lock->l_export->exp_imp_reverse,
-                              LDLM_BL_CALLBACK, 1, &size, NULL);
+                              LUSTRE_DLM_VERSION, LDLM_BL_CALLBACK,
+                              1, &size, NULL);
         if (req == NULL) {
                 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
                 RETURN(-ENOMEM);
         if (req == NULL) {
                 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
                 RETURN(-ENOMEM);
@@ -454,7 +455,8 @@ int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data)
         }
 
         req = ptlrpc_prep_req(lock->l_export->exp_imp_reverse,
         }
 
         req = ptlrpc_prep_req(lock->l_export->exp_imp_reverse,
-                              LDLM_CP_CALLBACK, buffers, size, NULL);
+                              LUSTRE_DLM_VERSION, LDLM_CP_CALLBACK,
+                              buffers, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
@@ -506,7 +508,8 @@ int ldlm_server_glimpse_ast(struct ldlm_lock *lock, void *data)
         LASSERT(lock != NULL);
 
         req = ptlrpc_prep_req(lock->l_export->exp_imp_reverse,
         LASSERT(lock != NULL);
 
         req = ptlrpc_prep_req(lock->l_export->exp_imp_reverse,
-                              LDLM_GL_CALLBACK, 1, &size, NULL);
+                              LUSTRE_DLM_VERSION, LDLM_GL_CALLBACK,
+                              1, &size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
@@ -550,7 +553,8 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req,
 
         LDLM_DEBUG_NOLOCK("server-side enqueue handler START");
 
 
         LDLM_DEBUG_NOLOCK("server-side enqueue handler START");
 
-        dlm_req = lustre_swab_reqbuf (req, 0, sizeof (*dlm_req),
+        dlm_req = lustre_swab_reqbuf (req, MDS_REQ_INTENT_LOCKREQ_OFF,
+                                      sizeof (*dlm_req),
                                       lustre_swab_ldlm_request);
         if (dlm_req == NULL) {
                 CERROR ("Can't unpack dlm_req\n");
                                       lustre_swab_ldlm_request);
         if (dlm_req == NULL) {
                 CERROR ("Can't unpack dlm_req\n");
@@ -947,6 +951,43 @@ int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
         RETURN(0);
 }
 
         RETURN(0);
 }
 
+static int ldlm_msg_check_version(struct lustre_msg *msg)
+{
+        int rc;
+
+        switch (msg->opc) {
+        case LDLM_ENQUEUE:
+        case LDLM_CONVERT:
+        case LDLM_CANCEL:
+        case LDLM_BL_CALLBACK:
+        case LDLM_CP_CALLBACK:
+        case LDLM_GL_CALLBACK:
+                rc = lustre_msg_check_version(msg, LUSTRE_DLM_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_DLM_VERSION);
+                break;
+        case OBD_LOG_CANCEL:
+        case LLOG_ORIGIN_HANDLE_OPEN:
+        case LLOG_ORIGIN_HANDLE_NEXT_BLOCK:
+        case LLOG_ORIGIN_HANDLE_PREV_BLOCK:
+        case LLOG_ORIGIN_HANDLE_READ_HEADER:
+        case LLOG_ORIGIN_HANDLE_CLOSE:
+        case LLOG_CATINFO:
+                rc = lustre_msg_check_version(msg, LUSTRE_LOG_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_LOG_VERSION);
+                break;
+        default:
+                CERROR("LDLM unknown opcode %d\n", msg->opc);
+                rc = -ENOTSUPP;
+                break;
+        }
+
+        return rc;
+}
+
 static int ldlm_callback_handler(struct ptlrpc_request *req)
 {
         struct ldlm_namespace *ns;
 static int ldlm_callback_handler(struct ptlrpc_request *req)
 {
         struct ldlm_namespace *ns;
@@ -956,6 +997,12 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
+        rc = ldlm_msg_check_version(req->rq_reqmsg);
+        if (rc) {
+                CERROR("LDLM_CB drop mal-formed request\n");
+                RETURN(rc);
+        }
+
         /* Requests arrive in sender's byte order.  The ptlrpc service
          * handler has already checked and, if necessary, byte-swapped the
          * incoming request message body, but I am responsible for the
         /* Requests arrive in sender's byte order.  The ptlrpc service
          * handler has already checked and, if necessary, byte-swapped the
          * incoming request message body, but I am responsible for the
@@ -1095,6 +1142,12 @@ static int ldlm_cancel_handler(struct ptlrpc_request *req)
         int rc = 0;
         ENTRY;
 
         int rc = 0;
         ENTRY;
 
+        rc = ldlm_msg_check_version(req->rq_reqmsg);
+        if (rc) {
+                CERROR("LDLM_CL drop mal-formed request\n");
+                RETURN(rc);
+        }
+
         /* Requests arrive in sender's byte order.  The ptlrpc service
          * handler has already checked and, if necessary, byte-swapped the
          * incoming request message body, but I am responsible for the
         /* Requests arrive in sender's byte order.  The ptlrpc service
          * handler has already checked and, if necessary, byte-swapped the
          * incoming request message body, but I am responsible for the
index a18115b..635ec4d 100644 (file)
@@ -235,7 +235,7 @@ int ldlm_cli_enqueue(struct obd_export *exp,
         struct ldlm_lock *lock;
         struct ldlm_request *body;
         struct ldlm_reply *reply;
         struct ldlm_lock *lock;
         struct ldlm_request *body;
         struct ldlm_reply *reply;
-        int rc, size[2] = {sizeof(*body), lvb_len}, req_passed_in = 1;
+        int rc, size[3] = {0, sizeof(*body), lvb_len}, req_passed_in = 1;
         int is_replay = *flags & LDLM_FL_REPLAY;
         int cleanup_phase = 0;
         ENTRY;
         int is_replay = *flags & LDLM_FL_REPLAY;
         int cleanup_phase = 0;
         ENTRY;
@@ -276,16 +276,22 @@ int ldlm_cli_enqueue(struct obd_export *exp,
         cleanup_phase = 2;
 
         if (req == NULL) {
         cleanup_phase = 2;
 
         if (req == NULL) {
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), LDLM_ENQUEUE, 1,
-                                      size, NULL);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
+                                      LDLM_ENQUEUE, 2, size, NULL);
                 if (req == NULL)
                         GOTO(cleanup, rc = -ENOMEM);
                 req_passed_in = 0;
                 if (req == NULL)
                         GOTO(cleanup, rc = -ENOMEM);
                 req_passed_in = 0;
-        } else if (req->rq_reqmsg->buflens[0] != sizeof(*body))
-                LBUG();
+        }
+
+        LASSERTF(req->rq_reqmsg->buflens[MDS_REQ_INTENT_LOCKREQ_OFF] ==
+                 sizeof(*body), "buflen[%d] = %d, not %d\n",
+                 MDS_REQ_INTENT_LOCKREQ_OFF,
+                 req->rq_reqmsg->buflens[MDS_REQ_INTENT_LOCKREQ_OFF],
+                 sizeof(*body));
 
         /* Dump lock data into the request buffer */
 
         /* Dump lock data into the request buffer */
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_INTENT_LOCKREQ_OFF,
+                              sizeof (*body));
         ldlm_lock2desc(lock, &body->lock_desc);
         body->lock_flags = *flags;
 
         ldlm_lock2desc(lock, &body->lock_desc);
         body->lock_flags = *flags;
 
@@ -293,11 +299,8 @@ int ldlm_cli_enqueue(struct obd_export *exp,
 
         /* Continue as normal. */
         if (!req_passed_in) {
 
         /* Continue as normal. */
         if (!req_passed_in) {
-                int buffers = 1;
-                if (lvb_len > 0)
-                        buffers = 2;
                 size[0] = sizeof(*reply);
                 size[0] = sizeof(*reply);
-                req->rq_replen = lustre_msg_size(buffers, size);
+                req->rq_replen = lustre_msg_size(1 + (lvb_len > 0), size);
         }
         lock->l_conn_export = exp;
         lock->l_export = NULL;
         }
         lock->l_conn_export = exp;
         lock->l_export = NULL;
@@ -481,7 +484,7 @@ int ldlm_cli_convert(struct lustre_handle *lockh, int new_mode, int *flags)
         LDLM_DEBUG(lock, "client-side convert");
 
         req = ptlrpc_prep_req(class_exp2cliimp(lock->l_conn_export),
         LDLM_DEBUG(lock, "client-side convert");
 
         req = ptlrpc_prep_req(class_exp2cliimp(lock->l_conn_export),
-                              LDLM_CONVERT, 1, &size, NULL);
+                              LUSTRE_DLM_VERSION, LDLM_CONVERT, 1, &size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
@@ -559,7 +562,8 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
                         goto local_cancel;
                 }
 
                         goto local_cancel;
                 }
 
-                req = ptlrpc_prep_req(imp, LDLM_CANCEL, 1, &size, NULL);
+                req = ptlrpc_prep_req(imp, LUSTRE_DLM_VERSION, LDLM_CANCEL,
+                                      1, &size, NULL);
                 if (!req)
                         GOTO(out, rc = -ENOMEM);
                 req->rq_no_resend = 1;
                 if (!req)
                         GOTO(out, rc = -ENOMEM);
                 req->rq_no_resend = 1;
@@ -954,7 +958,7 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock)
         struct ldlm_request *body;
         struct ldlm_reply *reply;
         int buffers = 1;
         struct ldlm_request *body;
         struct ldlm_reply *reply;
         int buffers = 1;
-        int size[2];
+        int size[2] = {0, sizeof(*body)};
         int flags;
 
         /*
         int flags;
 
         /*
@@ -980,15 +984,15 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock)
         else
                 flags = LDLM_FL_REPLAY;
 
         else
                 flags = LDLM_FL_REPLAY;
 
-        size[0] = sizeof(*body);
-        req = ptlrpc_prep_req(imp, LDLM_ENQUEUE, 1, size, NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_DLM_VERSION, LDLM_ENQUEUE,
+                              2, size, NULL);
         if (!req)
                 RETURN(-ENOMEM);
 
         /* We're part of recovery, so don't wait for it. */
         req->rq_send_state = LUSTRE_IMP_REPLAY_LOCKS;
 
         if (!req)
                 RETURN(-ENOMEM);
 
         /* We're part of recovery, so don't wait for it. */
         req->rq_send_state = LUSTRE_IMP_REPLAY_LOCKS;
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+        body = lustre_msg_buf(req->rq_reqmsg, 1, sizeof (*body));
         ldlm_lock2desc(lock, &body->lock_desc);
         body->lock_flags = flags;
 
         ldlm_lock2desc(lock, &body->lock_desc);
         body->lock_flags = flags;
 
index a338e40..13867b6 100644 (file)
@@ -225,7 +225,6 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
         int rc;
         struct ll_fid pfid, cfid;
         struct it_cb_data icbd;
         int rc;
         struct ll_fid pfid, cfid;
         struct it_cb_data icbd;
-        struct ll_uctxt ctxt;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         struct obd_export *exp;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         struct obd_export *exp;
@@ -260,11 +259,9 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
         ll_frob_intent(&it, &lookup_it);
         LASSERT(it);
 
         ll_frob_intent(&it, &lookup_it);
         LASSERT(it);
 
-        ll_i2uctxt(&ctxt, de->d_parent->d_inode, de->d_inode);
-
         if (it->it_op == IT_GETATTR) { /* We need to check for LOOKUP lock
                                           as well */
         if (it->it_op == IT_GETATTR) { /* We need to check for LOOKUP lock
                                           as well */
-                rc = md_intent_lock(exp, &ctxt, &pfid, de->d_name.name,
+                rc = md_intent_lock(exp, &pfid, de->d_name.name,
                                     de->d_name.len, NULL, 0, &cfid, &lookup_it,
                                     flags, &req, ll_mdc_blocking_ast);
                 /* If there was no lookup lock, no point in even checking for
                                     de->d_name.len, NULL, 0, &cfid, &lookup_it,
                                     flags, &req, ll_mdc_blocking_ast);
                 /* If there was no lookup lock, no point in even checking for
@@ -285,7 +282,7 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd,
                 ll_lookup_finish_locks(&lookup_it, de);
         }
 
                 ll_lookup_finish_locks(&lookup_it, de);
         }
 
-        rc = md_intent_lock(exp, &ctxt, &pfid, de->d_name.name, de->d_name.len,
+        rc = md_intent_lock(exp, &pfid, de->d_name.name, de->d_name.len,
                             NULL, 0, &cfid, it, flags, &req,
                             ll_mdc_blocking_ast);
         /* If req is NULL, then mdc_intent_lock only tried to do a lock match;
                             NULL, 0, &cfid, it, flags, &req,
                             ll_mdc_blocking_ast);
         /* If req is NULL, then mdc_intent_lock only tried to do a lock match;
index 822110f..f43f4f4 100644 (file)
@@ -620,7 +620,8 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         GOTO(out_ping, rc = -ENODEV);
                 }
                 cli = &obd->u.cli;
                         GOTO(out_ping, rc = -ENODEV);
                 }
                 cli = &obd->u.cli;
-                req = ptlrpc_prep_req(cli->cl_import, OBD_PING, 0, NULL, NULL);
+                req = ptlrpc_prep_req(cli->cl_import, LUSTRE_OBD_VERSION,
+                                      OBD_PING, 0, NULL, NULL);
                 if (!req)
                         GOTO(out_ping, rc = -ENOMEM);
 
                 if (!req)
                         GOTO(out_ping, rc = -ENOMEM);
 
@@ -661,10 +662,12 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
                         bufs[1] = NULL;
                 }
                 size = data->ioc_plen1;
                         bufs[1] = NULL;
                 }
                 size = data->ioc_plen1;
-                req = ptlrpc_prep_req(sbi2mdc(sbi)->cl_import, LLOG_CATINFO,
+                req = ptlrpc_prep_req(sbi2mdc(sbi)->cl_import,
+                                      LUSTRE_LOG_VERSION, LLOG_CATINFO,
                                       2, lens, bufs);
                 if (!req)
                         GOTO(out_catinfo, rc = -ENOMEM);
                                       2, lens, bufs);
                 if (!req)
                         GOTO(out_catinfo, rc = -ENOMEM);
+
                 req->rq_replen = lustre_msg_size(1, &size);
 
                 rc = ptlrpc_queue_wait(req);
                 req->rq_replen = lustre_msg_size(1, &size);
 
                 rc = ptlrpc_queue_wait(req);
index 4b1efe3..7a06199 100644 (file)
@@ -334,7 +334,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
 {
         struct dentry *save = dentry, *retval;
         struct ll_fid pfid;
 {
         struct dentry *save = dentry, *retval;
         struct ll_fid pfid;
-        struct ll_uctxt ctxt;
         struct it_cb_data icbd;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         struct it_cb_data icbd;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
@@ -359,9 +358,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
         icbd.icbd_childp = &dentry;
         icbd.icbd_parent = parent;
         ll_inode2fid(&pfid, parent);
         icbd.icbd_childp = &dentry;
         icbd.icbd_parent = parent;
         ll_inode2fid(&pfid, parent);
-        ll_i2uctxt(&ctxt, parent, NULL);
 
 
-        rc = md_intent_lock(ll_i2mdcexp(parent), &ctxt, &pfid,
+        rc = md_intent_lock(ll_i2mdcexp(parent), &pfid,
                             dentry->d_name.name, dentry->d_name.len, NULL, 0,
                             NULL, it, flags, &req, ll_mdc_blocking_ast);
         if (rc < 0)
                             dentry->d_name.name, dentry->d_name.len, NULL, 0,
                             NULL, it, flags, &req, ll_mdc_blocking_ast);
         if (rc < 0)
@@ -486,7 +484,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,
         if (rc)
                 RETURN(rc);
 
         if (rc)
                 RETURN(rc);
 
-        mdc_store_inode_generation(mdc_exp, request, 2, 1);
+        mdc_store_inode_generation(mdc_exp, request, MDS_REQ_INTENT_REC_OFF, 1);
         inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
                                NULL, 0, mode, 0, it);
         if (IS_ERR(inode)) {
         inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
                                NULL, 0, mode, 0, it);
         if (IS_ERR(inode)) {
index b14df18..23730d3 100644 (file)
@@ -56,7 +56,7 @@ static inline void lmv_drop_intent_lock(struct lookup_intent *it)
                                  it->d.lustre.it_lock_mode);
 }
 
                                  it->d.lustre.it_lock_mode);
 }
 
-int lmv_handle_remote_inode(struct obd_export *exp, struct ll_uctxt *uctxt,
+int lmv_handle_remote_inode(struct obd_export *exp,
                             void *lmm, int lmmsize, 
                             struct lookup_intent *it, int flags,
                             struct ptlrpc_request **reqp,
                             void *lmm, int lmmsize, 
                             struct lookup_intent *it, int flags,
                             struct ptlrpc_request **reqp,
@@ -95,7 +95,7 @@ int lmv_handle_remote_inode(struct obd_export *exp, struct ll_uctxt *uctxt,
 
                 nfid = body->fid1;
                 it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE;
 
                 nfid = body->fid1;
                 it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE;
-                rc = md_intent_lock(lmv->tgts[nfid.mds].ltd_exp, uctxt, &nfid,
+                rc = md_intent_lock(lmv->tgts[nfid.mds].ltd_exp, &nfid,
                                     NULL, 0, lmm, lmmsize, NULL, it, flags,
                                     &req, cb_blocking);
 
                                     NULL, 0, lmm, lmmsize, NULL, it, flags,
                                     &req, cb_blocking);
 
@@ -117,7 +117,7 @@ int lmv_handle_remote_inode(struct obd_export *exp, struct ll_uctxt *uctxt,
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int lmv_intent_open(struct obd_export *exp, struct ll_uctxt *uctxt,
+int lmv_intent_open(struct obd_export *exp,
                     struct ll_fid *pfid, const char *name, int len,
                     void *lmm, int lmmsize, struct ll_fid *cfid,
                     struct lookup_intent *it, int flags,
                     struct ll_fid *pfid, const char *name, int len,
                     void *lmm, int lmmsize, struct ll_fid *cfid,
                     struct lookup_intent *it, int flags,
@@ -151,7 +151,7 @@ repeat:
                 lmv_put_obj(obj);
         }
 
                 lmv_put_obj(obj);
         }
 
-        rc = md_intent_lock(lmv->tgts[rpfid.mds].ltd_exp, uctxt, &rpfid, name,
+        rc = md_intent_lock(lmv->tgts[rpfid.mds].ltd_exp, &rpfid, name,
                             len, lmm, lmmsize, cfid, it, flags, reqp,
                             cb_blocking);
         if (rc == -ERESTART) {
                             len, lmm, lmmsize, cfid, it, flags, reqp,
                             cb_blocking);
         if (rc == -ERESTART) {
@@ -169,7 +169,7 @@ repeat:
 
         /* okay, MDS has returned success. Probably name has been resolved in
          * remote inode */
 
         /* okay, MDS has returned success. Probably name has been resolved in
          * remote inode */
-        rc = lmv_handle_remote_inode(exp, uctxt, lmm, lmmsize, it,
+        rc = lmv_handle_remote_inode(exp, lmm, lmmsize, it,
                                      flags, reqp, cb_blocking);
         if (rc != 0) {
                 LASSERT(rc < 0);
                                      flags, reqp, cb_blocking);
         if (rc != 0) {
                 LASSERT(rc < 0);
@@ -219,7 +219,7 @@ repeat:
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int lmv_intent_getattr(struct obd_export *exp, struct ll_uctxt *uctxt,
+int lmv_intent_getattr(struct obd_export *exp,
                        struct ll_fid *pfid, const char *name, int len,
                        void *lmm, int lmmsize, struct ll_fid *cfid,
                        struct lookup_intent *it, int flags,
                        struct ll_fid *pfid, const char *name, int len,
                        void *lmm, int lmmsize, struct ll_fid *cfid,
                        struct lookup_intent *it, int flags,
@@ -250,7 +250,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct ll_uctxt *uctxt,
                         mds = rpfid.mds;
                         lmv_put_obj(obj);
                 }
                         mds = rpfid.mds;
                         lmv_put_obj(obj);
                 }
-                rc = md_intent_lock(lmv->tgts[mds].ltd_exp, uctxt, &rpfid, name,
+                rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpfid, name,
                                     len, lmm, lmmsize, cfid, it, flags, reqp,
                                     cb_blocking);
                 if (obj && rc >= 0) {
                                     len, lmm, lmmsize, cfid, it, flags, reqp,
                                     cb_blocking);
                 if (obj && rc >= 0) {
@@ -290,7 +290,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct ll_uctxt *uctxt,
                        (unsigned long)rpfid.generation);
         }
         
                        (unsigned long)rpfid.generation);
         }
         
-        rc = md_intent_lock(lmv->tgts[mds].ltd_exp, uctxt, &rpfid, name,
+        rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpfid, name,
                             len, lmm, lmmsize, NULL, it, flags, reqp,
                             cb_blocking);
         
                             len, lmm, lmmsize, NULL, it, flags, reqp,
                             cb_blocking);
         
@@ -301,7 +301,7 @@ int lmv_intent_getattr(struct obd_export *exp, struct ll_uctxt *uctxt,
 
         /* okay, MDS has returned success. probably name has been
          * resolved in remote inode */
 
         /* okay, MDS has returned success. probably name has been
          * resolved in remote inode */
-        rc = lmv_handle_remote_inode(exp, uctxt, lmm, lmmsize, it,
+        rc = lmv_handle_remote_inode(exp, lmm, lmmsize, it,
                                      flags, reqp, cb_blocking);
         if (rc < 0)
                 RETURN(rc);
                                      flags, reqp, cb_blocking);
         if (rc < 0)
                 RETURN(rc);
@@ -352,7 +352,6 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
         struct lustre_handle *lockh;
         struct ldlm_lock *lock;
         struct mds_body *body2;
         struct lustre_handle *lockh;
         struct ldlm_lock *lock;
         struct mds_body *body2;
-        struct ll_uctxt uctxt;
         struct lmv_obj *obj;
         int i, rc = 0;
         ENTRY;
         struct lmv_obj *obj;
         int i, rc = 0;
         ENTRY;
@@ -381,9 +380,6 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
                (unsigned long)body->fid1.id,
                (unsigned long)body->fid1.generation);
 
                (unsigned long)body->fid1.id,
                (unsigned long)body->fid1.generation);
 
-        uctxt.gid1 = 0;
-        uctxt.gid2 = 0;
-
         lmv_lock_obj(obj);
         
         for (i = 0; i < obj->objcount; i++) {
         lmv_lock_obj(obj);
         
         for (i = 0; i < obj->objcount; i++) {
@@ -402,7 +398,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
                 /* is obj valid? */
                 memset(&it, 0, sizeof(it));
                 it.it_op = IT_GETATTR;
                 /* is obj valid? */
                 memset(&it, 0, sizeof(it));
                 it.it_op = IT_GETATTR;
-                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &uctxt, &fid,
+                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &fid,
                                     NULL, 0, NULL, 0, &fid, &it, 0, &req,
                                     lmv_dirobj_blocking_ast);
                 
                                     NULL, 0, NULL, 0, &fid, &it, 0, &req,
                                     lmv_dirobj_blocking_ast);
                 
@@ -425,7 +421,7 @@ int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
 
                 memset(&it, 0, sizeof(it));
                 it.it_op = IT_GETATTR;
 
                 memset(&it, 0, sizeof(it));
                 it.it_op = IT_GETATTR;
-                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &uctxt, &fid,
+                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &fid,
                                     NULL, 0, NULL, 0, NULL, &it, 0, &req,
                                     lmv_dirobj_blocking_ast);
 
                                     NULL, 0, NULL, 0, NULL, &it, 0, &req,
                                     lmv_dirobj_blocking_ast);
 
@@ -465,7 +461,7 @@ cleanup:
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int lmv_intent_lookup(struct obd_export *exp, struct ll_uctxt *uctxt,
+int lmv_intent_lookup(struct obd_export *exp,
                       struct ll_fid *pfid, const char *name, int len,
                       void *lmm, int lmmsize, struct ll_fid *cfid,
                       struct lookup_intent *it, int flags,
                       struct ll_fid *pfid, const char *name, int len,
                       void *lmm, int lmmsize, struct ll_fid *cfid,
                       struct lookup_intent *it, int flags,
@@ -502,7 +498,7 @@ int lmv_intent_lookup(struct obd_export *exp, struct ll_uctxt *uctxt,
                        (unsigned long)cfid->mds, (unsigned long)cfid->id,
                        (unsigned long)cfid->generation, mds);
 
                        (unsigned long)cfid->mds, (unsigned long)cfid->id,
                        (unsigned long)cfid->generation, mds);
 
-                rc = md_intent_lock(lmv->tgts[mds].ltd_exp, uctxt, pfid, name,
+                rc = md_intent_lock(lmv->tgts[mds].ltd_exp, pfid, name,
                                     len, lmm, lmmsize, cfid, it, flags,
                                     reqp, cb_blocking);
                 RETURN(rc);
                                     len, lmm, lmmsize, cfid, it, flags,
                                     reqp, cb_blocking);
                 RETURN(rc);
@@ -525,7 +521,7 @@ repeat:
                 lmv_put_obj(obj);
         }
 
                 lmv_put_obj(obj);
         }
 
-        rc = md_intent_lock(lmv->tgts[mds].ltd_exp, uctxt, &rpfid, name,
+        rc = md_intent_lock(lmv->tgts[mds].ltd_exp, &rpfid, name,
                             len, lmm, lmmsize, NULL, it, flags, reqp,
                             cb_blocking);
         if (rc > 0) {
                             len, lmm, lmmsize, NULL, it, flags, reqp,
                             cb_blocking);
         if (rc > 0) {
@@ -565,7 +561,7 @@ repeat:
 
         /* okay, MDS has returned success. probably name has been resolved in
          * remote inode */
 
         /* okay, MDS has returned success. probably name has been resolved in
          * remote inode */
-        rc = lmv_handle_remote_inode(exp, uctxt, lmm, lmmsize, it, flags,
+        rc = lmv_handle_remote_inode(exp, lmm, lmmsize, it, flags,
                                      reqp, cb_blocking);
 
         if (rc == 0 && (mea = body_of_splitted_dir(*reqp, 1))) {
                                      reqp, cb_blocking);
 
         if (rc == 0 && (mea = body_of_splitted_dir(*reqp, 1))) {
@@ -585,7 +581,7 @@ repeat:
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int lmv_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
+int lmv_intent_lock(struct obd_export *exp,
                     struct ll_fid *pfid, const char *name, int len,
                     void *lmm, int lmmsize, struct ll_fid *cfid,
                     struct lookup_intent *it, int flags,
                     struct ll_fid *pfid, const char *name, int len,
                     void *lmm, int lmmsize, struct ll_fid *cfid,
                     struct lookup_intent *it, int flags,
@@ -608,15 +604,15 @@ int lmv_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
                 RETURN(rc);
 
         if (it->it_op == IT_LOOKUP)
                 RETURN(rc);
 
         if (it->it_op == IT_LOOKUP)
-                rc = lmv_intent_lookup(exp, uctxt, pfid, name, len, lmm,
+                rc = lmv_intent_lookup(exp, pfid, name, len, lmm,
                                        lmmsize, cfid, it, flags, reqp,
                                        cb_blocking);
         else if (it->it_op & IT_OPEN)
                                        lmmsize, cfid, it, flags, reqp,
                                        cb_blocking);
         else if (it->it_op & IT_OPEN)
-                rc = lmv_intent_open(exp, uctxt, pfid, name, len, lmm,
+                rc = lmv_intent_open(exp, pfid, name, len, lmm,
                                      lmmsize, cfid, it, flags, reqp,
                                      cb_blocking);
         else if (it->it_op == IT_GETATTR || it->it_op == IT_CHDIR)
                                      lmmsize, cfid, it, flags, reqp,
                                      cb_blocking);
         else if (it->it_op == IT_GETATTR || it->it_op == IT_CHDIR)
-                rc = lmv_intent_getattr(exp, uctxt, pfid, name, len, lmm,
+                rc = lmv_intent_getattr(exp, pfid, name, len, lmm,
                                         lmmsize, cfid, it, flags, reqp,
                                         cb_blocking);
         else
                                         lmmsize, cfid, it, flags, reqp,
                                         cb_blocking);
         else
@@ -635,7 +631,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
         struct ldlm_lock *lock;
         unsigned long size = 0;
         struct mds_body *body;
         struct ldlm_lock *lock;
         unsigned long size = 0;
         struct mds_body *body;
-        struct ll_uctxt uctxt;
         struct lmv_obj *obj;
         int master_lock_mode;
         int i, rc = 0;
         struct lmv_obj *obj;
         int master_lock_mode;
         int i, rc = 0;
@@ -649,8 +644,6 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
         obj = lmv_grab_obj(obd, mfid);
         LASSERT(obj != NULL);
 
         obj = lmv_grab_obj(obd, mfid);
         LASSERT(obj != NULL);
 
-        uctxt.gid1 = 0;
-        uctxt.gid2 = 0;
         master_lock_mode = 0;
 
         lmv_lock_obj(obj);
         master_lock_mode = 0;
 
         lmv_lock_obj(obj);
@@ -693,7 +686,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
                 }
 
                 /* is obj valid? */
                 }
 
                 /* is obj valid? */
-                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &uctxt, &fid,
+                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &fid,
                                     NULL, 0, NULL, 0, &fid, &it, 0, &req, cb);
                 lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
                 if (rc > 0) {
                                     NULL, 0, NULL, 0, &fid, &it, 0, &req, cb);
                 lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
                 if (rc > 0) {
@@ -714,7 +707,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
                 
                 memset(&it, 0, sizeof(it));
                 it.it_op = IT_GETATTR;
                 
                 memset(&it, 0, sizeof(it));
                 it.it_op = IT_GETATTR;
-                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &uctxt, &fid,
+                rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &fid,
                                     NULL, 0, NULL, 0, NULL, &it, 0, &req, cb);
                 lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
                 LASSERT(rc <= 0);
                                     NULL, 0, NULL, 0, NULL, &it, 0, &req, cb);
                 lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
                 LASSERT(rc <= 0);
index 8770646..ccceb95 100644 (file)
@@ -72,22 +72,22 @@ struct lmv_obj *lmv_create_obj(struct obd_export *exp,
 
 int lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid);
 
 
 int lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid);
 
-int lmv_intent_lock(struct obd_export *, struct ll_uctxt *,
+int lmv_intent_lock(struct obd_export *,
                     struct ll_fid *, const char *, int, void *, int,
                    struct ll_fid *, struct lookup_intent *, int,
                    struct ptlrpc_request **, ldlm_blocking_callback);
 
                     struct ll_fid *, const char *, int, void *, int,
                    struct ll_fid *, struct lookup_intent *, int,
                    struct ptlrpc_request **, ldlm_blocking_callback);
 
-int lmv_intent_lookup(struct obd_export *, struct ll_uctxt *,
+int lmv_intent_lookup(struct obd_export *,
                       struct ll_fid *, const char *, int, void *, int,
                      struct ll_fid *, struct lookup_intent *, int,
                      struct ptlrpc_request **, ldlm_blocking_callback);
 
                       struct ll_fid *, const char *, int, void *, int,
                      struct ll_fid *, struct lookup_intent *, int,
                      struct ptlrpc_request **, ldlm_blocking_callback);
 
-int lmv_intent_getattr(struct obd_export *, struct ll_uctxt *,
+int lmv_intent_getattr(struct obd_export *,
                        struct ll_fid *, const char *, int, void *, int,
                       struct ll_fid *, struct lookup_intent *, int,
                       struct ptlrpc_request **, ldlm_blocking_callback);
 
                        struct ll_fid *, const char *, int, void *, int,
                       struct ll_fid *, struct lookup_intent *, int,
                       struct ptlrpc_request **, ldlm_blocking_callback);
 
-int lmv_intent_open(struct obd_export *, struct ll_uctxt *,
+int lmv_intent_open(struct obd_export *,
                     struct ll_fid *, const char *, int, void *, int,
                    struct ll_fid *, struct lookup_intent *, int,
                    struct ptlrpc_request **, ldlm_blocking_callback);
                     struct ll_fid *, const char *, int, void *, int,
                    struct ll_fid *, struct lookup_intent *, int,
                    struct ptlrpc_request **, ldlm_blocking_callback);
index df8d84c..bbe3a5d 100644 (file)
@@ -49,6 +49,7 @@
 
 #include <linux/obd.h>
 #include <linux/lustre_lib.h>
 
 #include <linux/obd.h>
 #include <linux/lustre_lib.h>
+#include <linux/lustre_mds.h>   /* for mds_grp_hash_entry */
 
 atomic_t obd_memory;
 int obd_memmax;
 
 atomic_t obd_memory;
 int obd_memmax;
@@ -65,13 +66,52 @@ int obd_memmax;
 # define ASSERT_KERNEL_CTXT(msg) do {} while(0)
 #endif
 
 # define ASSERT_KERNEL_CTXT(msg) do {} while(0)
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-#define current_ngroups current->group_info->ngroups
-#define current_groups current->group_info->small_block
+static void push_group_info(struct lvfs_run_ctxt *save,
+                            struct group_info *ginfo)
+{
+        if (!ginfo) {
+                save->ngroups = current_ngroups;
+                current_ngroups = 0;
+        } else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
+                task_lock(current);
+                save->group_info = current->group_info;
+                current->group_info = group_info;
+                task_unlock(current);
+#else
+                LASSERT(ginfo->ngroups <= NGROUPS);
+                /* save old */
+                save->group_info.ngroups = current->ngroups;
+                if (current->ngroups)
+                        memcpy(save->group_info.small_block, current->groups,
+                               current->ngroups);
+                /* push new */
+                current->ngroups = ginfo->ngroups;
+                if (ginfo->ngroups)
+                        memcpy(current->groups, ginfo->small_block,
+                               current->ngroups);
+#endif
+        }
+}
+
+static void pop_group_info(struct lvfs_run_ctxt *save,
+                           struct group_info *ginfo)
+{
+        if (!ginfo) {
+                current_ngroups = save->ngroups;
+        } else {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
+                task_lock(current);
+                current->group_info = save->group_info;
+                task_unlock(current);
 #else
 #else
-#define current_ngroups current->ngroups
-#define current_groups current->groups
+                current->ngroups = ginfo->ngroups;
+                if (current->ngroups)
+                        memcpy(current->groups, save->group_info.small_block,
+                               current->ngroups);
 #endif
 #endif
+        }
+}
 
 /* push / pop to root of obd store */
 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
 
 /* push / pop to root of obd store */
 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
@@ -110,18 +150,12 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
                 save->luc.luc_fsuid = current->fsuid;
                 save->luc.luc_fsgid = current->fsgid;
                 save->luc.luc_cap = current->cap_effective;
                 save->luc.luc_fsuid = current->fsuid;
                 save->luc.luc_fsgid = current->fsgid;
                 save->luc.luc_cap = current->cap_effective;
-                save->luc.luc_suppgid1 = current_groups[0];
-                save->luc.luc_suppgid2 = current_groups[1];
 
                 current->fsuid = uc->luc_fsuid;
                 current->fsgid = uc->luc_fsgid;
                 current->cap_effective = uc->luc_cap;
 
                 current->fsuid = uc->luc_fsuid;
                 current->fsgid = uc->luc_fsgid;
                 current->cap_effective = uc->luc_cap;
-                current_ngroups = 0;
 
 
-                if (uc->luc_suppgid1 != -1)
-                        current_groups[current_ngroups++] = uc->luc_suppgid1;
-                if (uc->luc_suppgid2 != -1)
-                        current_groups[current_ngroups++] = uc->luc_suppgid2;
+                push_group_info(save, uc->luc_ginfo);
         }
         set_fs(new_ctx->fs);
         set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
         }
         set_fs(new_ctx->fs);
         set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
@@ -173,9 +207,8 @@ void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
                 current->fsuid = saved->luc.luc_fsuid;
                 current->fsgid = saved->luc.luc_fsgid;
                 current->cap_effective = saved->luc.luc_cap;
                 current->fsuid = saved->luc.luc_fsuid;
                 current->fsgid = saved->luc.luc_fsgid;
                 current->cap_effective = saved->luc.luc_cap;
-                current_ngroups = saved->ngroups;
-                current_groups[0] = saved->luc.luc_suppgid1;
-                current_groups[1] = saved->luc.luc_suppgid2;
+
+                pop_group_info(saved, uc->luc_ginfo);
         }
 
         /*
         }
 
         /*
index 4cf8017..702d3c7 100644 (file)
 #ifndef MDC_INTERNAL_H
 #define MDC_INTERNAL_H
 
 #ifndef MDC_INTERNAL_H
 #define MDC_INTERNAL_H
 
-void mdc_getattr_pack(struct lustre_msg *msg, int valid, int offset,
-                      int flags, struct mdc_op_data *data);
+void mdc_getattr_pack(struct lustre_msg *msg, int offset,
+                      int valid, int flags, struct mdc_op_data *data);
 void mdc_open_pack(struct lustre_msg *msg, int offset,
                    struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
                    __u32 flags, const void *lmm, int lmmlen);
 void mdc_open_pack(struct lustre_msg *msg, int offset,
                    struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
                    __u32 flags, const void *lmm, int lmmlen);
-void mdc_pack_req_body(struct ptlrpc_request *);
-void mdc_pack_rep_body(struct ptlrpc_request *);
-void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
-                      struct ll_fid *mdc_fid);
+void mdc_readdir_pack(struct ptlrpc_request *req, int req_offset,
+                      __u64 offset, __u32 size, struct ll_fid *mdc_fid);
 void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
                    int valid, struct obd_client_handle *och);
 
 void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
                    int valid, struct obd_client_handle *och);
 
index effaa56..74d3030 100644 (file)
 #endif
 #endif
 
 #endif
 #endif
 
-void mdc_readdir_pack(struct ptlrpc_request *req, __u64 offset, __u32 size,
-                      struct ll_fid *mdc_fid)
+void mdc_readdir_pack(struct ptlrpc_request *req, int req_offset,
+                      __u64 offset, __u32 size, struct ll_fid *mdc_fid)
 {
         struct mds_body *b;
 
 {
         struct mds_body *b;
 
-        b = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*b));
-        b->fsuid = current->fsuid;
-        b->fsgid = current->fsgid;
-        b->capability = current->cap_effective;
+        b = lustre_msg_buf(req->rq_reqmsg, req_offset, sizeof (*b));
         b->fid1 = *mdc_fid;
         b->size = offset;                       /* !! */
         b->fid1 = *mdc_fid;
         b->size = offset;                       /* !! */
-        b->suppgid = -1;
         b->nlink = size;                        /* !! */
 }
 
         b->nlink = size;                        /* !! */
 }
 
-static void mdc_pack_body(struct mds_body *b)
-{
-        LASSERT (b != NULL);
-
-        b->fsuid = current->fsuid;
-        b->fsgid = current->fsgid;
-        b->capability = current->cap_effective;
-}
-
-void mdc_pack_req_body(struct ptlrpc_request *req)
-{
-        struct mds_body *b = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*b));
-        mdc_pack_body(b);
-}
 static __u32 mds_pack_open_flags(__u32 flags)
 {
         return
 static __u32 mds_pack_open_flags(__u32 flags)
 {
         return
@@ -93,9 +75,6 @@ void mdc_open_pack(struct lustre_msg *msg, int offset,
 
         /* XXX do something about time, uid, gid */
         rec->cr_opcode = REINT_OPEN;
 
         /* XXX do something about time, uid, gid */
         rec->cr_opcode = REINT_OPEN;
-        rec->cr_fsuid = current->fsuid;
-        rec->cr_fsgid = current->fsgid;
-        rec->cr_cap = current->cap_effective;
         if (op_data != NULL)
                 rec->cr_fid = op_data->fid1;
         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
         if (op_data != NULL)
                 rec->cr_fid = op_data->fid1;
         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
@@ -103,7 +82,6 @@ void mdc_open_pack(struct lustre_msg *msg, int offset,
         rec->cr_flags = mds_pack_open_flags(flags);
         rec->cr_rdev = rdev;
         rec->cr_time = op_data->mod_time;
         rec->cr_flags = mds_pack_open_flags(flags);
         rec->cr_rdev = rdev;
         rec->cr_time = op_data->mod_time;
-        rec->cr_suppgid = op_data->ctxt.gid1;
 
         if (op_data->name) {
                 tmp = lustre_msg_buf(msg, offset + 1,
 
         if (op_data->name) {
                 tmp = lustre_msg_buf(msg, offset + 1,
@@ -117,18 +95,15 @@ void mdc_open_pack(struct lustre_msg *msg, int offset,
                 memcpy (tmp, lmm, lmmlen);
         }
 }
                 memcpy (tmp, lmm, lmmlen);
         }
 }
-void mdc_getattr_pack(struct lustre_msg *msg, int valid, int offset,
+
+void mdc_getattr_pack(struct lustre_msg *msg, int offset, int valid,
                       int flags, struct mdc_op_data *data)
 {
         struct mds_body *b;
         b = lustre_msg_buf(msg, offset, sizeof (*b));
 
                       int flags, struct mdc_op_data *data)
 {
         struct mds_body *b;
         b = lustre_msg_buf(msg, offset, sizeof (*b));
 
-        b->fsuid = current->fsuid;
-        b->fsgid = current->fsgid;
-        b->capability = current->cap_effective;
         b->valid = valid;
         b->flags = flags;
         b->valid = valid;
         b->flags = flags;
-        b->suppgid = data->ctxt.gid1;
 
         b->fid1 = data->fid1;
         b->fid2 = data->fid2;
 
         b->fid1 = data->fid1;
         b->fid2 = data->fid2;
@@ -145,7 +120,7 @@ void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
 {
         struct mds_body *body;
 
 {
         struct mds_body *body;
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
+        body = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*body));
 
         mdc_pack_fid(&body->fid1, oa->o_id, 0, oa->o_mode);
         memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
 
         mdc_pack_fid(&body->fid1, oa->o_id, 0, oa->o_mode);
         memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
index 09a709c..cc7053c 100644 (file)
@@ -53,15 +53,13 @@ void it_set_disposition(struct lookup_intent *it, int flag)
 }
 EXPORT_SYMBOL(it_set_disposition);
 
 }
 EXPORT_SYMBOL(it_set_disposition);
 
-static void mdc_fid2mdc_op_data(struct mdc_op_data *data, struct ll_uctxt *ctxt,
+static void mdc_fid2mdc_op_data(struct mdc_op_data *data,
                                 struct ll_fid *f1, struct ll_fid *f2,
                                 const char *name, int namelen, int mode)
 {
         LASSERT(data);
                                 struct ll_fid *f1, struct ll_fid *f2,
                                 const char *name, int namelen, int mode)
 {
         LASSERT(data);
-        LASSERT(ctxt);
         LASSERT(f1);
 
         LASSERT(f1);
 
-        data->ctxt = *ctxt;
         data->fid1 = *f1;
         if (f2)
                 data->fid2 = *f2;
         data->fid1 = *f1;
         if (f2)
                 data->fid2 = *f2;
@@ -194,32 +192,36 @@ int mdc_enqueue(struct obd_export *exp,
         struct ldlm_res_id res_id =
                 { .name = {data->fid1.id, data->fid1.generation} };
         ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
         struct ldlm_res_id res_id =
                 { .name = {data->fid1.id, data->fid1.generation} };
         ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
-        int size[6] = {sizeof(struct ldlm_request), sizeof(struct ldlm_intent)};
-        int rc, flags = LDLM_FL_HAS_INTENT;
+        struct ldlm_intent *lit;
+        struct ldlm_request *lockreq;
+        struct ldlm_reply *dlm_rep;
+        int reqsize[6] = {[MDS_REQ_SECDESC_OFF] = 0,
+                          [MDS_REQ_INTENT_LOCKREQ_OFF] = sizeof(*lockreq),
+                          [MDS_REQ_INTENT_IT_OFF] = sizeof(*lit)};
         int repsize[4] = {sizeof(struct ldlm_reply),
                           sizeof(struct mds_body),
                           obddev->u.cli.cl_max_mds_easize,
                           obddev->u.cli.cl_max_mds_cookiesize};
         int repsize[4] = {sizeof(struct ldlm_reply),
                           sizeof(struct mds_body),
                           obddev->u.cli.cl_max_mds_easize,
                           obddev->u.cli.cl_max_mds_cookiesize};
-        struct ldlm_reply *dlm_rep;
-        struct ldlm_intent *lit;
-        struct ldlm_request *lockreq;
+        int req_buffers = 3, reply_buffers = 0;
+        int rc, flags = LDLM_FL_HAS_INTENT;
         void *eadata;
         unsigned long irqflags;
         void *eadata;
         unsigned long irqflags;
-        int   reply_buffers = 0;
         ENTRY;
 
 //        LDLM_DEBUG_NOLOCK("mdsintent=%s,name=%s,dir=%lu",
 //                          ldlm_it2str(it->it_op), it_name, it_inode->i_ino);
 
         ENTRY;
 
 //        LDLM_DEBUG_NOLOCK("mdsintent=%s,name=%s,dir=%lu",
 //                          ldlm_it2str(it->it_op), it_name, it_inode->i_ino);
 
+        reqsize[0] = mdc_get_secdesc_size();
+
         if (it->it_op & IT_OPEN) {
                 it->it_create_mode |= S_IFREG;
                 it->it_create_mode &= ~current->fs->umask;
 
         if (it->it_op & IT_OPEN) {
                 it->it_create_mode |= S_IFREG;
                 it->it_create_mode &= ~current->fs->umask;
 
-                size[2] = sizeof(struct mds_rec_create);
-                size[3] = data->namelen + 1;
-                size[4] = obddev->u.cli.cl_max_mds_easize;
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), LDLM_ENQUEUE, 
-                                      5, size, NULL);
+                reqsize[req_buffers++] = sizeof(struct mds_rec_create);
+                reqsize[req_buffers++] = data->namelen + 1;
+                reqsize[req_buffers++] = obddev->u.cli.cl_max_mds_easize;
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
+                                      LDLM_ENQUEUE, req_buffers, reqsize, NULL);
                 if (!req)
                         RETURN(-ENOMEM);
 
                 if (!req)
                         RETURN(-ENOMEM);
 
@@ -228,41 +230,46 @@ int mdc_enqueue(struct obd_export *exp,
                 spin_unlock_irqrestore (&req->rq_lock, irqflags);
 
                 /* pack the intent */
                 spin_unlock_irqrestore (&req->rq_lock, irqflags);
 
                 /* pack the intent */
-                lit = lustre_msg_buf(req->rq_reqmsg, 1, sizeof (*lit));
+                lit = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_INTENT_IT_OFF,
+                                     sizeof (*lit));
                 lit->opc = (__u64)it->it_op;
 
                 /* pack the intended request */
                 lit->opc = (__u64)it->it_op;
 
                 /* pack the intended request */
-                mdc_open_pack(req->rq_reqmsg, 2, data, it->it_create_mode, 0,
-                              it->it_flags, lmm, lmmsize);
+                mdc_open_pack(req->rq_reqmsg, MDS_REQ_INTENT_REC_OFF, data,
+                              it->it_create_mode, 0, it->it_flags,
+                              lmm, lmmsize);
                 /* get ready for the reply */
                 reply_buffers = 3;
                 req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op & (IT_GETATTR | IT_LOOKUP | IT_CHDIR)) {
                 int valid = OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE;
                 /* get ready for the reply */
                 reply_buffers = 3;
                 req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op & (IT_GETATTR | IT_LOOKUP | IT_CHDIR)) {
                 int valid = OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE;
-                size[2] = sizeof(struct mds_body);
-                size[3] = data->namelen + 1;
+
+                reqsize[req_buffers++] = sizeof(struct mds_body);
+                reqsize[req_buffers++] = data->namelen + 1;
 
                 if (it->it_op & IT_GETATTR)
                         policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
 
                 if (it->it_op & IT_GETATTR)
                         policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), LDLM_ENQUEUE, 4,
-                                      size, NULL);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
+                                      LDLM_ENQUEUE, req_buffers, reqsize, NULL);
 
                 if (!req)
                         RETURN(-ENOMEM);
 
                 /* pack the intent */
 
                 if (!req)
                         RETURN(-ENOMEM);
 
                 /* pack the intent */
-                lit = lustre_msg_buf(req->rq_reqmsg, 1, sizeof (*lit));
+                lit = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_INTENT_IT_OFF,
+                                     sizeof (*lit));
                 lit->opc = (__u64)it->it_op;
 
                 /* pack the intended request */
                 lit->opc = (__u64)it->it_op;
 
                 /* pack the intended request */
-                mdc_getattr_pack(req->rq_reqmsg, valid, 2, it->it_flags, data);
+                mdc_getattr_pack(req->rq_reqmsg, MDS_REQ_INTENT_REC_OFF,
+                                 valid, it->it_flags, data);
                 /* get ready for the reply */
                 reply_buffers = 3;
                 req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op == IT_READDIR) {
                 policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
                 /* get ready for the reply */
                 reply_buffers = 3;
                 req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op == IT_READDIR) {
                 policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), LDLM_ENQUEUE, 1,
-                                      size, NULL);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
+                                      LDLM_ENQUEUE, 2, reqsize, NULL);
                 
                 if (!req)
                         RETURN(-ENOMEM);
                 
                 if (!req)
                         RETURN(-ENOMEM);
@@ -270,18 +277,20 @@ int mdc_enqueue(struct obd_export *exp,
                 reply_buffers = 1;
                 req->rq_replen = lustre_msg_size(1, repsize);
         } else if (it->it_op == IT_UNLINK) {
                 reply_buffers = 1;
                 req->rq_replen = lustre_msg_size(1, repsize);
         } else if (it->it_op == IT_UNLINK) {
-                size[2] = sizeof(struct mds_body);
+                reqsize[req_buffers++] = sizeof(struct mds_body);
                 policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
                 policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), LDLM_ENQUEUE, 3,
-                                      size, NULL);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_DLM_VERSION,
+                                      LDLM_ENQUEUE, req_buffers, reqsize, NULL);
                 if (!req)
                         RETURN(-ENOMEM);
 
                 /* pack the intended request */
                 if (!req)
                         RETURN(-ENOMEM);
 
                 /* pack the intended request */
-                mdc_getattr_pack(req->rq_reqmsg, 0,  2, 0, data);
+                mdc_getattr_pack(req->rq_reqmsg, MDS_REQ_INTENT_REC_OFF,
+                                 0, 0, data);
 
                 /* pack the intent */
 
                 /* pack the intent */
-                lit = lustre_msg_buf(req->rq_reqmsg, 1, sizeof (*lit));
+                lit = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_INTENT_IT_OFF,
+                                     sizeof (*lit));
                 lit->opc = (__u64)it->it_op;
 
                 /* get ready for the reply */
                 lit->opc = (__u64)it->it_op;
 
                 /* get ready for the reply */
@@ -291,6 +300,9 @@ int mdc_enqueue(struct obd_export *exp,
                 LBUG();
                 RETURN(-EINVAL);
         }
                 LBUG();
                 RETURN(-EINVAL);
         }
+
+        mdc_pack_secdesc(req, reqsize[0]);
+
         mdc_get_rpc_lock(obddev->u.cli.cl_rpc_lock, it);
         rc = ldlm_cli_enqueue(exp, req, obddev->obd_namespace, res_id,
                               lock_type, &policy, lock_mode, &flags,cb_blocking,
         mdc_get_rpc_lock(obddev->u.cli.cl_rpc_lock, it);
         rc = ldlm_cli_enqueue(exp, req, obddev->obd_namespace, res_id,
                               lock_type, &policy, lock_mode, &flags,cb_blocking,
@@ -301,7 +313,9 @@ int mdc_enqueue(struct obd_export *exp,
         /* Similarly, if we're going to replay this request, we don't want to
          * actually get a lock, just perform the intent. */
         if (req->rq_transno || req->rq_replay) {
         /* Similarly, if we're going to replay this request, we don't want to
          * actually get a lock, just perform the intent. */
         if (req->rq_transno || req->rq_replay) {
-                lockreq = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*lockreq));
+                lockreq = lustre_msg_buf(req->rq_reqmsg,
+                                         MDS_REQ_INTENT_LOCKREQ_OFF,
+                                         sizeof (*lockreq));
                 lockreq->lock_flags |= LDLM_FL_INTENT_ONLY;
         }
 
                 lockreq->lock_flags |= LDLM_FL_INTENT_ONLY;
         }
 
@@ -376,13 +390,14 @@ int mdc_enqueue(struct obd_export *exp,
                         if (it->it_op & IT_OPEN) {
                                 void *replayea;
 
                         if (it->it_op & IT_OPEN) {
                                 void *replayea;
 
-                                replayea = lustre_msg_buf(req->rq_reqmsg, 4,
+                                replayea = lustre_msg_buf(req->rq_reqmsg,
+                                                          MDS_REQ_INTENT_REC_OFF + 2,
                                                           body->eadatasize);
                                 LASSERT(replayea);
                                 memcpy(replayea, eadata, body->eadatasize);
 
                                                           body->eadatasize);
                                 LASSERT(replayea);
                                 memcpy(replayea, eadata, body->eadatasize);
 
-                                LASSERT(req->rq_reqmsg->bufcount == 5);
-                                req->rq_reqmsg->buflens[4] = body->eadatasize;
+                                LASSERT(req->rq_reqmsg->bufcount == 6);
+                                req->rq_reqmsg->buflens[5] = body->eadatasize;
                                 /* If this isn't the last buffer, we might
                                  * have to shift other data around. */
                         }
                                 /* If this isn't the last buffer, we might
                                  * have to shift other data around. */
                         }
@@ -420,7 +435,7 @@ EXPORT_SYMBOL(mdc_enqueue);
  * Else, if DISP_LOOKUP_EXECD then d.lustre.it_status is the rc of the
  * child lookup.
  */
  * Else, if DISP_LOOKUP_EXECD then d.lustre.it_status is the rc of the
  * child lookup.
  */
-int mdc_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
+int mdc_intent_lock(struct obd_export *exp,
                     struct ll_fid *pfid, const char *name, int len,
                     void *lmm, int lmmsize, struct ll_fid *cfid,
                     struct lookup_intent *it, int lookup_flags,
                     struct ll_fid *pfid, const char *name, int len,
                     void *lmm, int lmmsize, struct ll_fid *cfid,
                     struct lookup_intent *it, int lookup_flags,
@@ -486,7 +501,7 @@ int mdc_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
          * never dropped its reference, so the refcounts are all OK */
         if (!it_disposition(it, DISP_ENQ_COMPLETE)) {
                 struct mdc_op_data op_data;
          * never dropped its reference, so the refcounts are all OK */
         if (!it_disposition(it, DISP_ENQ_COMPLETE)) {
                 struct mdc_op_data op_data;
-                mdc_fid2mdc_op_data(&op_data, uctxt, pfid, cfid, name, len, 0);
+                mdc_fid2mdc_op_data(&op_data, pfid, cfid, name, len, 0);
 
                 rc = mdc_enqueue(exp, LDLM_IBITS, it, it_to_lock_mode(it),
                                  &op_data, &lockh, lmm, lmmsize,
 
                 rc = mdc_enqueue(exp, LDLM_IBITS, it, it_to_lock_mode(it),
                                  &op_data, &lockh, lmm, lmmsize,
index ba4e3b9..0515372 100644 (file)
@@ -75,22 +75,25 @@ int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
         struct mds_rec_setattr *rec;
         struct mdc_rpc_lock *rpc_lock;
         struct obd_device *obd = exp->exp_obd;
         struct mds_rec_setattr *rec;
         struct mdc_rpc_lock *rpc_lock;
         struct obd_device *obd = exp->exp_obd;
-        int rc, bufcount = 1, size[3] = {sizeof(*rec), ealen, ea2len};
+        int rc, bufcount = 2, size[4] = {0, sizeof(*rec), ealen, ea2len};
         ENTRY;
 
         LASSERT(iattr != NULL);
 
         ENTRY;
 
         LASSERT(iattr != NULL);
 
+        size[0] = mdc_get_secdesc_size();
         if (ealen > 0) {
         if (ealen > 0) {
-                bufcount = 2;
+                bufcount++;
                 if (ea2len > 0)
                 if (ea2len > 0)
-                        bufcount = 3;
+                        bufcount++;
         }
 
         }
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_REINT, bufcount,
-                              size, NULL);
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_REINT, bufcount, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
+        mdc_pack_secdesc(req, size[0]);
+
         if (iattr->ia_valid & ATTR_FROM_OPEN) {
                 req->rq_request_portal = MDS_SETATTR_PORTAL; //XXX FIXME bug 249
                 rpc_lock = obd->u.cli.cl_setattr_lock;
         if (iattr->ia_valid & ATTR_FROM_OPEN) {
                 req->rq_request_portal = MDS_SETATTR_PORTAL; //XXX FIXME bug 249
                 rpc_lock = obd->u.cli.cl_setattr_lock;
@@ -101,7 +104,8 @@ int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
         if (iattr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
                 CDEBUG(D_INODE, "setting mtime %lu, ctime %lu\n",
                        LTIME_S(iattr->ia_mtime), LTIME_S(iattr->ia_ctime));
         if (iattr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
                 CDEBUG(D_INODE, "setting mtime %lu, ctime %lu\n",
                        LTIME_S(iattr->ia_mtime), LTIME_S(iattr->ia_ctime));
-        mdc_setattr_pack(req->rq_reqmsg, data, iattr, ea, ealen, ea2, ea2len);
+        mdc_setattr_pack(req->rq_reqmsg, 1, data, iattr, ea, ealen,
+                         ea2, ea2len);
 
         size[0] = sizeof(struct mds_body);
         req->rq_replen = lustre_msg_size(1, size);
 
         size[0] = sizeof(struct mds_body);
         req->rq_replen = lustre_msg_size(1, size);
@@ -120,23 +124,27 @@ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
 {
         struct obd_device *obd = exp->exp_obd;
         struct ptlrpc_request *req;
 {
         struct obd_device *obd = exp->exp_obd;
         struct ptlrpc_request *req;
-        int rc, size[3] = {sizeof(struct mds_rec_create), op_data->namelen + 1};
-        int level, bufcount = 2;
+        int rc, size[4] = {0, sizeof(struct mds_rec_create),
+                           op_data->namelen + 1};
+        int level, bufcount = 3;
         ENTRY;
 
         ENTRY;
 
+        size[0] = mdc_get_secdesc_size();
         if (data && datalen) {
                 size[bufcount] = datalen;
                 bufcount++;
         }
 
         if (data && datalen) {
                 size[bufcount] = datalen;
                 bufcount++;
         }
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_REINT, bufcount,
-                              size, NULL);
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_REINT, bufcount, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
+        mdc_pack_secdesc(req, size[0]);
+
         /* mdc_create_pack fills msg->bufs[1] with name
          * and msg->bufs[2] with tgt, for symlinks or lov MD data */
         /* mdc_create_pack fills msg->bufs[1] with name
          * and msg->bufs[2] with tgt, for symlinks or lov MD data */
-        mdc_create_pack(req->rq_reqmsg, 0, op_data, mode, rdev, data, datalen);
+        mdc_create_pack(req->rq_reqmsg, 1, op_data, mode, rdev, data, datalen);
 
         size[0] = sizeof(struct mds_body);
         req->rq_replen = lustre_msg_size(1, size);
 
         size[0] = sizeof(struct mds_body);
         req->rq_replen = lustre_msg_size(1, size);
@@ -151,7 +159,7 @@ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
         }
 
         if (!rc)
         }
 
         if (!rc)
-                mdc_store_inode_generation(exp, req, 0, 0);
+                mdc_store_inode_generation(exp, req, MDS_REQ_REC_OFF, 0);
 
         *request = req;
         RETURN(rc);
 
         *request = req;
         RETURN(rc);
@@ -162,16 +170,20 @@ int mdc_unlink(struct obd_export *exp, struct mdc_op_data *data,
 {
         struct obd_device *obddev = class_exp2obd(exp);
         struct ptlrpc_request *req = *request;
 {
         struct obd_device *obddev = class_exp2obd(exp);
         struct ptlrpc_request *req = *request;
-        int rc, size[3] = {sizeof(struct mds_rec_unlink),
+        int rc, size[4] = {0, sizeof(struct mds_rec_unlink),
                            data->namelen + 1,
                            obddev->u.cli.cl_max_mds_cookiesize};
         ENTRY;
                            data->namelen + 1,
                            obddev->u.cli.cl_max_mds_cookiesize};
         ENTRY;
-
         LASSERT(req == NULL);
         LASSERT(req == NULL);
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_REINT, 3, size,
-                              NULL);
+
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_REINT, 4, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
         if (req == NULL)
                 RETURN(-ENOMEM);
+
+        mdc_pack_secdesc(req, size[0]);
         *request = req;
 
         size[0] = sizeof(struct mds_body);
         *request = req;
 
         size[0] = sizeof(struct mds_body);
@@ -179,7 +191,7 @@ int mdc_unlink(struct obd_export *exp, struct mdc_op_data *data,
         size[2] = obddev->u.cli.cl_max_mds_cookiesize;
         req->rq_replen = lustre_msg_size(3, size);
 
         size[2] = obddev->u.cli.cl_max_mds_cookiesize;
         req->rq_replen = lustre_msg_size(3, size);
 
-        mdc_unlink_pack(req->rq_reqmsg, 0, data);
+        mdc_unlink_pack(req->rq_reqmsg, 1, data);
 
         rc = mdc_reint(req, obddev->u.cli.cl_rpc_lock, LUSTRE_IMP_FULL);
         if (rc == -ERESTARTSYS)
 
         rc = mdc_reint(req, obddev->u.cli.cl_rpc_lock, LUSTRE_IMP_FULL);
         if (rc == -ERESTARTSYS)
@@ -192,15 +204,19 @@ int mdc_link(struct obd_export *exp, struct mdc_op_data *data,
 {
         struct obd_device *obd = exp->exp_obd;
         struct ptlrpc_request *req;
 {
         struct obd_device *obd = exp->exp_obd;
         struct ptlrpc_request *req;
-        int rc, size[2] = {sizeof(struct mds_rec_link), data->namelen + 1};
+        int rc, size[3] = {0, sizeof(struct mds_rec_link), data->namelen + 1};
         ENTRY;
 
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_REINT, 2, size,
-                              NULL);
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_REINT, 3, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_link_pack(req->rq_reqmsg, 0, data);
+        mdc_pack_secdesc(req, size[0]);
+
+        mdc_link_pack(req->rq_reqmsg, 1, data);
 
         size[0] = sizeof(struct mds_body);
         req->rq_replen = lustre_msg_size(1, size);
 
         size[0] = sizeof(struct mds_body);
         req->rq_replen = lustre_msg_size(1, size);
@@ -219,16 +235,20 @@ int mdc_rename(struct obd_export *exp, struct mdc_op_data *data,
 {
         struct obd_device *obd = exp->exp_obd;
         struct ptlrpc_request *req;
 {
         struct obd_device *obd = exp->exp_obd;
         struct ptlrpc_request *req;
-        int rc, size[4] = {sizeof(struct mds_rec_rename), oldlen + 1,
+        int rc, size[5] = {0, sizeof(struct mds_rec_rename), oldlen + 1,
                            newlen + 1, obd->u.cli.cl_max_mds_cookiesize};
         ENTRY;
 
                            newlen + 1, obd->u.cli.cl_max_mds_cookiesize};
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_REINT, 4, size,
-                              NULL);
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_REINT, 5, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_rename_pack(req->rq_reqmsg, 0, data, old, oldlen, new, newlen);
+        mdc_pack_secdesc(req, size[0]);
+
+        mdc_rename_pack(req->rq_reqmsg, 1, data, old, oldlen, new, newlen);
 
         size[0] = sizeof(struct mds_body);
         size[1] = obd->u.cli.cl_max_mds_easize;
 
         size[0] = sizeof(struct mds_body);
         size[1] = obd->u.cli.cl_max_mds_easize;
index 7c29799..3994916 100644 (file)
 
 static int mdc_cleanup(struct obd_device *obd, int flags);
 
 
 static int mdc_cleanup(struct obd_device *obd, int flags);
 
+int mdc_get_secdesc_size(void)
+{
+        int ngroups = current_ngroups;
+
+        if (ngroups > LUSTRE_MAX_GROUPS)
+                ngroups = LUSTRE_MAX_GROUPS;
+        return sizeof(struct mds_req_sec_desc) +
+               sizeof(__u32) * ngroups;
+}
+
+/*
+ * because group info might have changed since last time
+ * we call get_secdesc_size(), so here we did more sanity check
+ * to prevent garbage gids
+ */
+void mdc_pack_secdesc(struct ptlrpc_request *req, int size)
+{
+        struct mds_req_sec_desc *rsd;
+        struct group_info *ginfo;
+
+        rsd = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_SECDESC_OFF, size);
+        rsd->rsd_uid = current->uid;
+        rsd->rsd_gid = current->gid;
+        rsd->rsd_fsuid = current->fsuid;
+        rsd->rsd_fsgid = current->fsgid;
+        rsd->rsd_cap = current->cap_effective;
+        rsd->rsd_ngroups = (size - sizeof(*rsd)) / sizeof(__u32);
+        LASSERT(rsd->rsd_ngroups <= LUSTRE_MAX_GROUPS);
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
+        task_lock(current);
+        get_group_info(current->group_info);
+        ginfo = current->group_info;
+        task_unlock(current);
+        if (rsd->rsd_ngroups > ginfo->ngropus)
+                rsd->rsd_ngroups = ginfo->ngroups;
+        memcpy(rsd->rsd_groups, ginfo->blocks[0],
+               rsd->rsd_ngroups * sizeof(__u32));
+#else
+        LASSERT(rsd->rsd_ngroups <= NGROUPS);
+        if (rsd->rsd_ngroups > current->ngroups)
+                rsd->rsd_ngroups = current->ngroups;
+        memcpy(rsd->rsd_groups, current->groups,
+               rsd->rsd_ngroups * sizeof(__u32));
+#endif
+}
+
 extern int mds_queue_req(struct ptlrpc_request *);
 /* Helper that implements most of mdc_getstatus and signal_completed_replay. */
 /* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */
 extern int mds_queue_req(struct ptlrpc_request *);
 /* Helper that implements most of mdc_getstatus and signal_completed_replay. */
 /* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */
@@ -51,18 +98,22 @@ static int send_getstatus(struct obd_import *imp, struct ll_fid *rootfid,
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int rc, size = sizeof(*body);
+        int rc, size[2] = {0, sizeof(*body)};
         ENTRY;
 
         ENTRY;
 
-        req = ptlrpc_prep_req(imp, MDS_GETSTATUS, 1, &size, NULL);
+        //size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_GETSTATUS,
+                              2, size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+        //mdc_pack_secdesc(req, size[0]);
+
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
         req->rq_send_state = level;
         req->rq_send_state = level;
-        req->rq_replen = lustre_msg_size(1, &size);
+        req->rq_replen = lustre_msg_size(1, &size[1]);
 
 
-        mdc_pack_req_body(req);
         req->rq_reqmsg->flags |= msg_flags;
         rc = ptlrpc_queue_wait(req);
 
         req->rq_reqmsg->flags |= msg_flags;
         rc = ptlrpc_queue_wait(req);
 
@@ -101,18 +152,18 @@ int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size,
         struct mds_body *body;
         void            *eadata;
         int              rc;
         struct mds_body *body;
         void            *eadata;
         int              rc;
-        int              size[2] = {sizeof(*body), 0};
+        int              repsize[2] = {sizeof(*body), 0};
         int              bufcount = 1;
         ENTRY;
 
         /* request message already built */
 
         if (ea_size != 0) {
         int              bufcount = 1;
         ENTRY;
 
         /* request message already built */
 
         if (ea_size != 0) {
-                size[bufcount++] = ea_size;
+                repsize[bufcount++] = ea_size;
                 CDEBUG(D_INODE, "reserved %u bytes for MD/symlink in packet\n",
                        ea_size);
         }
                 CDEBUG(D_INODE, "reserved %u bytes for MD/symlink in packet\n",
                        ea_size);
         }
-        req->rq_replen = lustre_msg_size(bufcount, size);
+        req->rq_replen = lustre_msg_size(bufcount, repsize);
 
         mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
         rc = ptlrpc_queue_wait(req);
 
         mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
         rc = ptlrpc_queue_wait(req);
@@ -148,23 +199,26 @@ int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int size = sizeof(*body);
+        int size[2] = {0, sizeof(*body)};
         int rc;
         ENTRY;
 
         /* XXX do we need to make another request here?  We just did a getattr
          *     to do the lookup in the first place.
          */
         int rc;
         ENTRY;
 
         /* XXX do we need to make another request here?  We just did a getattr
          *     to do the lookup in the first place.
          */
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_GETATTR, 1, &size,
-                              NULL);
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_GETATTR, 2, size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+        mdc_pack_secdesc(req, size[0]);
+
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
         memcpy(&body->fid1, fid, sizeof(*fid));
         body->valid = valid;
         body->eadatasize = ea_size;
         memcpy(&body->fid1, fid, sizeof(*fid));
         body->valid = valid;
         body->eadatasize = ea_size;
-        mdc_pack_req_body(req);
 
         rc = mdc_getattr_common(exp, ea_size, req);
         if (rc != 0) {
 
         rc = mdc_getattr_common(exp, ea_size, req);
         if (rc != 0) {
@@ -182,23 +236,26 @@ int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int rc, size[2] = {sizeof(*body), namelen};
+        int rc, size[3] = {0, sizeof(*body), namelen};
         ENTRY;
 
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_GETATTR_NAME, 2,
-                              size, NULL);
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_GETATTR_NAME, 3, size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+        mdc_pack_secdesc(req, size[0]);
+
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof (*body));
         memcpy(&body->fid1, fid, sizeof(*fid));
         body->valid = valid;
         body->eadatasize = ea_size;
         memcpy(&body->fid1, fid, sizeof(*fid));
         body->valid = valid;
         body->eadatasize = ea_size;
-        mdc_pack_req_body(req);
 
         if (filename != NULL) {
                 LASSERT (strnlen (filename, namelen) == namelen - 1);
 
         if (filename != NULL) {
                 LASSERT (strnlen (filename, namelen) == namelen - 1);
-                memcpy(lustre_msg_buf(req->rq_reqmsg, 1, namelen),
+                memcpy(lustre_msg_buf(req->rq_reqmsg, 2, namelen),
                        filename, namelen);
         } else {
                 LASSERT(namelen == 1);
                        filename, namelen);
         } else {
                 LASSERT(namelen == 1);
@@ -216,8 +273,8 @@ int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
 
 /* This should be called with both the request and the reply still packed. */
 int mdc_store_inode_generation(struct obd_export *exp,
 
 /* This should be called with both the request and the reply still packed. */
 int mdc_store_inode_generation(struct obd_export *exp,
-                                struct ptlrpc_request *req, int reqoff,
-                                int repoff)
+                               struct ptlrpc_request *req,
+                               int reqoff, int repoff)
 {
         struct mds_rec_create *rec =
                 lustre_msg_buf(req->rq_reqmsg, reqoff, sizeof(*rec));
 {
         struct mds_rec_create *rec =
                 lustre_msg_buf(req->rq_reqmsg, reqoff, sizeof(*rec));
@@ -344,7 +401,8 @@ static void mdc_replay_open(struct ptlrpc_request *req)
         if (close_req != NULL) {
                 struct mds_body *close_body;
                 LASSERT(close_req->rq_reqmsg->opc == MDS_CLOSE);
         if (close_req != NULL) {
                 struct mds_body *close_body;
                 LASSERT(close_req->rq_reqmsg->opc == MDS_CLOSE);
-                close_body = lustre_msg_buf(close_req->rq_reqmsg, 0,
+                close_body = lustre_msg_buf(close_req->rq_reqmsg,
+                                            MDS_REQ_REC_OFF,
                                             sizeof(*close_body));
                 if (och != NULL)
                         LASSERT(!memcmp(&old, &close_body->handle, sizeof old));
                                             sizeof(*close_body));
                 if (och != NULL)
                         LASSERT(!memcmp(&old, &close_body->handle, sizeof old));
@@ -361,10 +419,12 @@ int  mdc_set_open_replay_data(struct obd_export *exp,
                               struct ptlrpc_request *open_req)
 {
         struct mdc_open_data *mod;
                               struct ptlrpc_request *open_req)
 {
         struct mdc_open_data *mod;
-        struct mds_rec_create *rec =
-                lustre_msg_buf(open_req->rq_reqmsg, 2, sizeof(*rec));
-        struct mds_body *body =
-                lustre_msg_buf(open_req->rq_repmsg, 1, sizeof(*body));
+        struct mds_rec_create *rec;
+        struct mds_body *body;
+
+        rec = lustre_msg_buf(open_req->rq_reqmsg, MDS_REQ_INTENT_REC_OFF,
+                             sizeof(*rec));
+        body = lustre_msg_buf(open_req->rq_repmsg, 1, sizeof(*body));
 
         LASSERT(rec != NULL);
         /* outgoing messages always in my byte order */
 
         LASSERT(rec != NULL);
         /* outgoing messages always in my byte order */
@@ -486,7 +546,7 @@ int mdc_close(struct obd_export *exp, struct obdo *oa,
               struct obd_client_handle *och, struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
               struct obd_client_handle *och, struct ptlrpc_request **request)
 {
         struct obd_device *obd = class_exp2obd(exp);
-        int reqsize[2] = {sizeof(struct mds_body),
+        int reqsize[3] = {0, sizeof(struct mds_body),
                           obd->u.cli.cl_max_mds_cookiesize};
         int rc, repsize[3] = {sizeof(struct mds_body),
                               obd->u.cli.cl_max_mds_easize,
                           obd->u.cli.cl_max_mds_cookiesize};
         int rc, repsize[3] = {sizeof(struct mds_body),
                               obd->u.cli.cl_max_mds_easize,
@@ -496,11 +556,15 @@ int mdc_close(struct obd_export *exp, struct obdo *oa,
         struct l_wait_info lwi;
         ENTRY;
 
         struct l_wait_info lwi;
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_CLOSE, 2, reqsize,
-                              NULL);
+        //reqsize[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_CLOSE, 3, reqsize, NULL);
         if (req == NULL)
                 GOTO(out, rc = -ENOMEM);
 
         if (req == NULL)
                 GOTO(out, rc = -ENOMEM);
 
+        //mdc_pack_secdesc(req, reqsize[0]);
+
         /* Ensure that this close's handle is fixed up during replay. */
         LASSERT(och != NULL);
         mod = och->och_mod;
         /* Ensure that this close's handle is fixed up during replay. */
         LASSERT(och != NULL);
         mod = och->och_mod;
@@ -513,7 +577,7 @@ int mdc_close(struct obd_export *exp, struct obdo *oa,
                 CDEBUG(D_HA, "couldn't find open req; expecting close error\n");
         }
 
                 CDEBUG(D_HA, "couldn't find open req; expecting close error\n");
         }
 
-        mdc_close_pack(req, 0, oa, oa->o_valid, och);
+        mdc_close_pack(req, 1, oa, oa->o_valid, och);
 
         req->rq_replen = lustre_msg_size(3, repsize);
         req->rq_commit_cb = mdc_commit_close;
 
         req->rq_replen = lustre_msg_size(3, repsize);
         req->rq_commit_cb = mdc_commit_close;
@@ -570,15 +634,19 @@ int mdc_done_writing(struct obd_export *exp, struct obdo *obdo)
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int rc, size = sizeof(*body);
+        int rc, size[2] = {0, sizeof(*body)};
         ENTRY;
 
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_DONE_WRITING, 1,
-                              &size, NULL);
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_DONE_WRITING, 2, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
+        mdc_pack_secdesc(req, size[0]);
+
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
         mdc_pack_fid(&body->fid1, obdo->o_id, 0, obdo->o_mode);
         body->size = obdo->o_size;
         body->blocks = obdo->o_blocks;
         mdc_pack_fid(&body->fid1, obdo->o_id, 0, obdo->o_mode);
         body->size = obdo->o_size;
         body->blocks = obdo->o_blocks;
@@ -586,7 +654,7 @@ int mdc_done_writing(struct obd_export *exp, struct obdo *obdo)
         body->valid = obdo->o_valid;
 //        memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
 
         body->valid = obdo->o_valid;
 //        memcpy(&body->handle, &och->och_fh, sizeof(body->handle));
 
-        req->rq_replen = lustre_msg_size(1, &size);
+        req->rq_replen = lustre_msg_size(1, &size[1]);
 
         rc = ptlrpc_queue_wait(req);
         ptlrpc_req_finished(req);
 
         rc = ptlrpc_queue_wait(req);
         ptlrpc_req_finished(req);
@@ -601,17 +669,22 @@ int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
         struct ptlrpc_request *req = NULL;
         struct ptlrpc_bulk_desc *desc = NULL;
         struct mds_body *body;
         struct ptlrpc_request *req = NULL;
         struct ptlrpc_bulk_desc *desc = NULL;
         struct mds_body *body;
-        int rc, size = sizeof(*body);
+        int rc, size[2] = {0, sizeof(*body)};
         ENTRY;
 
         CDEBUG(D_INODE, "inode: %ld\n", (long)mdc_fid->id);
 
         ENTRY;
 
         CDEBUG(D_INODE, "inode: %ld\n", (long)mdc_fid->id);
 
-        req = ptlrpc_prep_req(imp, MDS_READPAGE, 1, &size, NULL);
+        size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(imp, LUSTRE_MDS_VERSION, MDS_READPAGE,
+                              2, size, NULL);
         if (req == NULL)
                 GOTO(out, rc = -ENOMEM);
         /* XXX FIXME bug 249 */
         req->rq_request_portal = MDS_READPAGE_PORTAL;
 
         if (req == NULL)
                 GOTO(out, rc = -ENOMEM);
         /* XXX FIXME bug 249 */
         req->rq_request_portal = MDS_READPAGE_PORTAL;
 
+        mdc_pack_secdesc(req, size[0]);
+
         desc = ptlrpc_prep_bulk_imp(req, 1, BULK_PUT_SINK, MDS_BULK_PORTAL);
         if (desc == NULL)
                 GOTO(out, rc = -ENOMEM);
         desc = ptlrpc_prep_bulk_imp(req, 1, BULK_PUT_SINK, MDS_BULK_PORTAL);
         if (desc == NULL)
                 GOTO(out, rc = -ENOMEM);
@@ -619,9 +692,9 @@ int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid,
 
         ptlrpc_prep_bulk_page(desc, page, 0, PAGE_CACHE_SIZE);
 
 
         ptlrpc_prep_bulk_page(desc, page, 0, PAGE_CACHE_SIZE);
 
-        mdc_readdir_pack(req, offset, PAGE_CACHE_SIZE, mdc_fid);
+        mdc_readdir_pack(req, 1, offset, PAGE_CACHE_SIZE, mdc_fid);
 
 
-        req->rq_replen = lustre_msg_size(1, &size);
+        req->rq_replen = lustre_msg_size(1, &size[1]);
         rc = ptlrpc_queue_wait(req);
 
         if (rc == 0) {
         rc = ptlrpc_queue_wait(req);
 
         if (rc == 0) {
@@ -723,8 +796,8 @@ int mdc_set_info(struct obd_export *exp, obd_count keylen,
                 int rc, size[2] = {keylen, vallen};
                 char *bufs[2] = {key, val};
 
                 int rc, size[2] = {keylen, vallen};
                 char *bufs[2] = {key, val};
 
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), OST_SET_INFO, 2,
-                                      size, bufs);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                      OST_SET_INFO, 2, size, bufs);
                 if (req == NULL)
                         RETURN(-ENOMEM);
 
                 if (req == NULL)
                         RETURN(-ENOMEM);
 
@@ -755,7 +828,8 @@ static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
          * during mount that would help a bit).  Having relative timestamps
          * is not so great if request processing is slow, while absolute
          * timestamps are not ideal because they need time synchronization. */
          * during mount that would help a bit).  Having relative timestamps
          * is not so great if request processing is slow, while absolute
          * timestamps are not ideal because they need time synchronization. */
-        req = ptlrpc_prep_req(obd->u.cli.cl_import, MDS_STATFS, 0, NULL, NULL);
+        req = ptlrpc_prep_req(obd->u.cli.cl_import, LUSTRE_MDS_VERSION,
+                              MDS_STATFS, 0, NULL, NULL);
         if (!req)
                 RETURN(-ENOMEM);
 
         if (!req)
                 RETURN(-ENOMEM);
 
@@ -787,18 +861,23 @@ static int mdc_pin(struct obd_export *exp, obd_id ino, __u32 gen, int type,
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int rc, size = sizeof(*body);
+        int rc, size[2] = {0, sizeof(*body)};
         ENTRY;
 
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_PIN, 1, &size, NULL);
+        //size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_PIN, 2, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+        //mdc_pack_secdesc(req, size[0]);
+
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
         mdc_pack_fid(&body->fid1, ino, gen, type);
         body->flags = flag;
 
         mdc_pack_fid(&body->fid1, ino, gen, type);
         body->flags = flag;
 
-        req->rq_replen = lustre_msg_size(1, &size);
+        req->rq_replen = lustre_msg_size(1, &size[1]);
 
         mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
         rc = ptlrpc_queue_wait(req);
 
         mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
         rc = ptlrpc_queue_wait(req);
@@ -833,17 +912,22 @@ static int mdc_unpin(struct obd_export *exp,
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int rc, size = sizeof(*body);
+        int rc, size[2] = {0, sizeof(*body)};
         ENTRY;
 
         if (handle->och_magic != OBD_CLIENT_HANDLE_MAGIC)
                 RETURN(0);
 
         ENTRY;
 
         if (handle->och_magic != OBD_CLIENT_HANDLE_MAGIC)
                 RETURN(0);
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_CLOSE, 1, &size, NULL);
+        //size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_CLOSE, 2, size, NULL);
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
+        //mdc_pack_secdesc(req, size[0]);
+
+        body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF, sizeof(*body));
         memcpy(&body->handle, &handle->och_fh, sizeof(body->handle));
         body->flags = flag;
 
         memcpy(&body->handle, &handle->och_fh, sizeof(body->handle));
         body->flags = flag;
 
@@ -866,21 +950,26 @@ int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
 {
         struct ptlrpc_request *req;
         struct mds_body *body;
-        int size = sizeof(*body);
+        int size[2] = {0, sizeof(*body)};
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), MDS_SYNC, 1,&size,NULL);
+        //size[0] = mdc_get_secdesc_size();
+
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
+                              MDS_SYNC, 2, size, NULL);
         if (!req)
                 RETURN(rc = -ENOMEM);
 
         if (!req)
                 RETURN(rc = -ENOMEM);
 
+        //mdc_pack_secdesc(req, size[0]);
+
         if (fid) {
         if (fid) {
-                body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
+                body = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
+                                      sizeof (*body));
                 memcpy(&body->fid1, fid, sizeof(*fid));
                 memcpy(&body->fid1, fid, sizeof(*fid));
-                mdc_pack_req_body(req);
         }
 
         }
 
-        req->rq_replen = lustre_msg_size(1, &size);
+        req->rq_replen = lustre_msg_size(1, &size[1]);
 
         rc = ptlrpc_queue_wait(req);
         if (rc || request == NULL)
 
         rc = ptlrpc_queue_wait(req);
         if (rc || request == NULL)
@@ -1060,8 +1149,9 @@ static int mdc_get_info(struct obd_export *exp, obd_count keylen,
                 __u32 *reply;
                 char *bufs[1] = {key};
                 int rc;
                 __u32 *reply;
                 char *bufs[1] = {key};
                 int rc;
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), OST_GET_INFO, 1,
-                                      &keylen, bufs);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp),
+                                      LUSTRE_OBD_VERSION, OST_GET_INFO,
+                                      1, &keylen, bufs);
                 if (req == NULL)
                         RETURN(-ENOMEM);
 
                 if (req == NULL)
                         RETURN(-ENOMEM);
 
@@ -1094,8 +1184,8 @@ int mdc_obj_create(struct obd_export *exp, struct obdo *oa,
 
         LASSERT(oa);
 
 
         LASSERT(oa);
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_CREATE,
-                                  1, &size, NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_CREATE, 1, &size, NULL);
         if (!request)
                 GOTO(out_req, rc = -ENOMEM);
 
         if (!request)
                 GOTO(out_req, rc = -ENOMEM);
 
@@ -1146,7 +1236,8 @@ int mdc_brw(int rw, struct obd_export *exp, struct obdo *oa,
         size[1] = sizeof(*ioobj);
         size[2] = oa_bufs * sizeof(*niobuf);
 
         size[1] = sizeof(*ioobj);
         size[2] = oa_bufs * sizeof(*niobuf);
 
-        req = ptlrpc_prep_req(class_exp2cliimp(exp), opc, 3, size, NULL);
+        req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION, opc,
+                              3, size, NULL);
         LASSERT(req != NULL);
 
         if (opc == OST_WRITE)
         LASSERT(req != NULL);
 
         if (opc == OST_WRITE)
index 5d42081..df14327 100644 (file)
@@ -1,5 +1,5 @@
 MODULES := mds
 mds-objs := mds_log.o mds_unlink_open.o mds_lov.o handler.o mds_reint.o
 MODULES := mds
 mds-objs := mds_log.o mds_unlink_open.o mds_lov.o handler.o mds_reint.o
-mds-objs += mds_fs.o lproc_mds.o mds_open.o mds_lib.o mds_lmv.o
+mds-objs += mds_fs.o lproc_mds.o mds_open.o mds_lib.o mds_lmv.o mds_groups.o
 
 @INCLUDE_RULES@
 
 @INCLUDE_RULES@
index aad37e0..232e252 100644 (file)
@@ -7,5 +7,5 @@ include $(src)/../portals/Kernelenv
 
 obj-y += mds.o
 mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_open.o \
 
 obj-y += mds.o
 mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_open.o \
-           mds_lib.o mds_unlink_open.o mds_log.o mds_lmv.o
+           mds_lib.o mds_unlink_open.o mds_log.o mds_lmv.o mds_groups.o
        
        
index 9f6885a..87e4999 100644 (file)
@@ -461,7 +461,7 @@ static int mds_destroy_export(struct obd_export *export)
                        dentry->d_name.len, dentry->d_name.name,
                        ll_bdevname(dentry->d_inode->i_sb, btmp),
                        dentry->d_inode->i_ino);
                        dentry->d_name.len, dentry->d_name.name,
                        ll_bdevname(dentry->d_inode->i_sb, btmp),
                        dentry->d_inode->i_ino);
-                rc = mds_mfd_close(NULL, obd, mfd,
+                rc = mds_mfd_close(NULL, 0, obd, mfd,
                                    !(export->exp_flags & OBD_OPT_FAILOVER));
 
                 if (rc)
                                    !(export->exp_flags & OBD_OPT_FAILOVER));
 
                 if (rc)
@@ -683,32 +683,11 @@ int mds_pack_md(struct obd_device *obd, struct lustre_msg *msg, int offset,
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-static void mds_root_squash_rec(struct mds_obd *mds, ptl_nid_t *peernid,
-                                struct mds_update_record *rec)
+void mds_squash_root(struct mds_obd *mds, struct mds_req_sec_desc *rsd,
+                     ptl_nid_t *peernid)
 {
 {
-        if (!mds->mds_squash_uid || rec->_ur_fsuid)
-               return;
-
-        if (*peernid == mds->mds_nosquash_nid)
-                return;
-
-        CDEBUG(D_OTHER, "squash req from 0x%llx, (%d:%d/%x)=>(%d:%d/%x)\n",
-                *peernid, 
-                rec->_ur_fsuid, rec->_ur_fsgid, rec->_ur_cap,
-                mds->mds_squash_uid, mds->mds_squash_gid,
-                (rec->_ur_cap & ~CAP_FS_MASK));
-
-        rec->_ur_fsuid = mds->mds_squash_uid;
-        rec->_ur_fsgid = mds->mds_squash_gid;
-        /* XXX should we remove all capabilities? */
-        rec->_ur_cap &= ~CAP_FS_MASK;
-        rec->_ur_suppgid1 = -1;
-        rec->_ur_suppgid2 = -1;
-}
-static void mds_root_squash_body(struct mds_obd *mds, ptl_nid_t *peernid,
-                                 struct mds_body *body)
-{
-        if (!mds->mds_squash_uid || body->fsuid)
+        if (!mds->mds_squash_uid ||
+            (rsd->rsd_uid && rsd->rsd_fsuid))
                 return;
 
         if (*peernid == mds->mds_nosquash_nid)
                 return;
 
         if (*peernid == mds->mds_nosquash_nid)
@@ -716,16 +695,17 @@ static void mds_root_squash_body(struct mds_obd *mds, ptl_nid_t *peernid,
 
         CDEBUG(D_OTHER, "squash req from 0x%llx, (%d:%d/%x)=>(%d:%d/%x)\n",
                 *peernid, 
 
         CDEBUG(D_OTHER, "squash req from 0x%llx, (%d:%d/%x)=>(%d:%d/%x)\n",
                 *peernid, 
-                body->fsuid, body->fsgid, body->capability,
+                rsd->rsd_fsuid, rsd->rsd_fsgid, rsd->rsd_cap,
                 mds->mds_squash_uid, mds->mds_squash_gid,
                 mds->mds_squash_uid, mds->mds_squash_gid,
-                (body->capability & ~CAP_FS_MASK));
+                (rsd->rsd_cap & ~CAP_FS_MASK));
 
 
-        body->fsuid = mds->mds_squash_uid;
-        body->fsgid = mds->mds_squash_gid;
+        rsd->rsd_uid = mds->mds_squash_uid;
+        rsd->rsd_fsuid = mds->mds_squash_uid;
+        rsd->rsd_fsgid = mds->mds_squash_gid;
         /* XXX should we remove all capabilities? */
         /* XXX should we remove all capabilities? */
-        body->capability &= ~CAP_FS_MASK;
-        body->suppgid = -1;
+        rsd->rsd_cap &= ~CAP_FS_MASK;
 }
 }
+
 static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry,
                                 struct ptlrpc_request *req,
                                 struct mds_body *reqbody, int reply_off)
 static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry,
                                 struct ptlrpc_request *req,
                                 struct mds_body *reqbody, int reply_off)
@@ -793,8 +773,8 @@ static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry,
 }
 
 static int mds_getattr_pack_msg_cf(struct ptlrpc_request *req,
 }
 
 static int mds_getattr_pack_msg_cf(struct ptlrpc_request *req,
-                                        struct dentry *dentry,
-                                        int offset)
+                                   struct dentry *dentry,
+                                   int offset)
 {
         int rc = 0, size[1] = {sizeof(struct mds_body)};
         ENTRY;
 {
         int rc = 0, size[1] = {sizeof(struct mds_body)};
         ENTRY;
@@ -904,18 +884,20 @@ int mds_check_mds_num(struct obd_device *obd, struct inode* inode,
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-static int mds_getattr_name(int offset, struct ptlrpc_request *req,
+static int mds_getattr_name(struct ptlrpc_request *req, int offset,
                             struct lustre_handle *child_lockh, int child_part)
 {
         struct obd_device *obd = req->rq_export->exp_obd;
                             struct lustre_handle *child_lockh, int child_part)
 {
         struct obd_device *obd = req->rq_export->exp_obd;
+        struct mds_obd *mds = &obd->u.mds;
         struct ldlm_reply *rep = NULL;
         struct lvfs_run_ctxt saved;
         struct ldlm_reply *rep = NULL;
         struct lvfs_run_ctxt saved;
+        struct mds_req_sec_desc *rsd;
         struct mds_body *body;
         struct dentry *dparent = NULL, *dchild = NULL;
         struct lvfs_ucred uc;
         struct lustre_handle parent_lockh[2];
         int namesize, update_mode;
         struct mds_body *body;
         struct dentry *dparent = NULL, *dchild = NULL;
         struct lvfs_ucred uc;
         struct lustre_handle parent_lockh[2];
         int namesize, update_mode;
-        int rc = 0, cleanup_phase = 0, resent_req = 0;
+        int rc = 0, cleanup_phase = 0, resent_req = 0, reply_offset;
         struct clonefs_info *clone_info = NULL;
         char *name;
         ENTRY;
         struct clonefs_info *clone_info = NULL;
         char *name;
         ENTRY;
@@ -924,6 +906,13 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
 
         MDS_UPDATE_COUNTER((&obd->u.mds), MDS_GETATTR_NAME_COUNT);
 
 
         MDS_UPDATE_COUNTER((&obd->u.mds), MDS_GETATTR_NAME_COUNT);
 
+        rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
+        if (!rsd) {
+                CERROR("Can't unpack security desc\n");
+                RETURN(-EFAULT);
+        }
+        mds_squash_root(mds, rsd, &req->rq_peer.peer_id.nid); 
+
         /* Swab now, before anyone looks inside the request */
         body = lustre_swab_reqbuf(req, offset, sizeof(*body),
                                   lustre_swab_mds_body);
         /* Swab now, before anyone looks inside the request */
         body = lustre_swab_reqbuf(req, offset, sizeof(*body),
                                   lustre_swab_mds_body);
@@ -940,18 +929,21 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
         }
         namesize = req->rq_reqmsg->buflens[offset + 1];
 
         }
         namesize = req->rq_reqmsg->buflens[offset + 1];
 
-        LASSERT (offset == 0 || offset == 2);
-        /* if requests were at offset 2, the getattr reply goes back at 1 */
-        if (offset) {
+        LASSERT (offset == 1 || offset == 3);
+        /* if requests were at offset 3, the getattr reply goes back at 1 */
+        if (offset == 3) {
                 rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
                 rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
-                offset = 1;
-        }
-        mds_root_squash_body(&obd->u.mds, &req->rq_peer.peer_id.nid, body); 
-        uc.luc_fsuid = body->fsuid;
-        uc.luc_fsgid = body->fsgid;
-        uc.luc_cap = body->capability;
-        uc.luc_suppgid1 = body->suppgid;
-        uc.luc_suppgid2 = -1;
+                reply_offset = 1;
+        } else {
+                reply_offset = 0;
+        }
+
+        rc = mds_init_ucred(&uc, rsd);
+        if (rc) {
+                CERROR("can't init ucred\n");
+                GOTO(cleanup, rc);
+        }
+
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         cleanup_phase = 1; /* kernel context */
         intent_set_disposition(rep, DISP_LOOKUP_EXECD);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         cleanup_phase = 1; /* kernel context */
         intent_set_disposition(rep, DISP_LOOKUP_EXECD);
@@ -982,7 +974,6 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
 #if HAVE_LOOKUP_RAW
         /* FIXME: handle raw lookup */
         if (body->valid == OBD_MD_FLID) {
 #if HAVE_LOOKUP_RAW
         /* FIXME: handle raw lookup */
         if (body->valid == OBD_MD_FLID) {
-                struct mds_obd *mds = &obd->u.mds;
                 struct mds_body *mds_reply;
                 int size = sizeof(*mds_reply);
                 struct inode *dir;
                 struct mds_body *mds_reply;
                 int size = sizeof(*mds_reply);
                 struct inode *dir;
@@ -1003,7 +994,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
                 LASSERT(dir->i_op->lookup_raw != NULL);
                 rc = dir->i_op->lookup_raw(dir, name, namesize - 1, &inum);
                 l_dput(dparent);
                 LASSERT(dir->i_op->lookup_raw != NULL);
                 rc = dir->i_op->lookup_raw(dir, name, namesize - 1, &inum);
                 l_dput(dparent);
-                mds_reply = lustre_msg_buf(req->rq_repmsg, offset,
+                mds_reply = lustre_msg_buf(req->rq_repmsg, 0,
                                            sizeof(*mds_reply));
                 mds_reply->fid1.id = inum;
                 mds_reply->valid = OBD_MD_FLID;
                                            sizeof(*mds_reply));
                 mds_reply->fid1.id = inum;
                 mds_reply->valid = OBD_MD_FLID;
@@ -1017,7 +1008,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
         }
 
         if (resent_req == 0) {
         }
 
         if (resent_req == 0) {
-                rc = mds_get_parent_child_locked(obd, &obd->u.mds, &body->fid1,
+                rc = mds_get_parent_child_locked(obd, mds, &body->fid1,
                                                  parent_lockh, &dparent,
                                                  LCK_PR, MDS_INODELOCK_LOOKUP,
                                                  &update_mode, name, namesize,
                                                  parent_lockh, &dparent,
                                                  LCK_PR, MDS_INODELOCK_LOOKUP,
                                                  &update_mode, name, namesize,
@@ -1041,7 +1032,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req,
                 res = granted_lock->l_resource;
                 child_fid.id = res->lr_name.name[0];
                 child_fid.generation = res->lr_name.name[1];
                 res = granted_lock->l_resource;
                 child_fid.id = res->lr_name.name[0];
                 child_fid.generation = res->lr_name.name[1];
-                dchild = mds_fid2dentry(&obd->u.mds, &child_fid, NULL);
+                dchild = mds_fid2dentry(mds, &child_fid, NULL);
                 LASSERT(dchild);
                 LDLM_LOCK_PUT(granted_lock);
         }
                 LASSERT(dchild);
                 LDLM_LOCK_PUT(granted_lock);
         }
@@ -1071,7 +1062,7 @@ fill_inode:
                 }
         }
 
                 }
         }
 
-        rc = mds_getattr_internal(obd, dchild, req, body, offset);
+        rc = mds_getattr_internal(obd, dchild, req, body, reply_offset);
         GOTO(cleanup, rc); /* returns the lock to the client */
 
  cleanup:
         GOTO(cleanup, rc); /* returns the lock to the client */
 
  cleanup:
@@ -1094,24 +1085,32 @@ fill_inode:
                 l_dput(dchild);
         case 1:
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
                 l_dput(dchild);
         case 1:
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+                mds_exit_ucred(&uc);
         default: ;
         }
         return rc;
 }
 
         default: ;
         }
         return rc;
 }
 
-static int mds_getattr(int offset, struct ptlrpc_request *req)
+static int mds_getattr(struct ptlrpc_request *req, int offset)
 {
         struct mds_obd *mds = mds_req2mds(req);
         struct obd_device *obd = req->rq_export->exp_obd;
         struct lvfs_run_ctxt saved;
         struct dentry *de;
 {
         struct mds_obd *mds = mds_req2mds(req);
         struct obd_device *obd = req->rq_export->exp_obd;
         struct lvfs_run_ctxt saved;
         struct dentry *de;
+        struct mds_req_sec_desc *rsd;
         struct mds_body *body;
         struct lvfs_ucred uc;
         int rc = 0;
         ENTRY;
 
         struct mds_body *body;
         struct lvfs_ucred uc;
         int rc = 0;
         ENTRY;
 
-        body = lustre_swab_reqbuf (req, offset, sizeof (*body),
-                                   lustre_swab_mds_body);
+        rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
+        if (!rsd) {
+                CERROR("Can't unpack security desc\n");
+                RETURN(-EFAULT);
+        }
+
+        body = lustre_swab_reqbuf(req, offset, sizeof (*body),
+                                  lustre_swab_mds_body);
         if (body == NULL) {
                 CERROR ("Can't unpack body\n");
                 RETURN (-EFAULT);
         if (body == NULL) {
                 CERROR ("Can't unpack body\n");
                 RETURN (-EFAULT);
@@ -1119,9 +1118,12 @@ static int mds_getattr(int offset, struct ptlrpc_request *req)
 
         MDS_UPDATE_COUNTER(mds, MDS_GETATTR_COUNT);
 
 
         MDS_UPDATE_COUNTER(mds, MDS_GETATTR_COUNT);
 
-        uc.luc_fsuid = body->fsuid;
-        uc.luc_fsgid = body->fsgid;
-        uc.luc_cap = body->capability;
+        rc = mds_init_ucred(&uc, rsd);
+        if (rc) {
+                CERROR("can't init ucred\n");
+                RETURN(rc);
+        }
+
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         de = mds_fid2dentry(mds, &body->fid1, NULL);
         if (IS_ERR(de)) {
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         de = mds_fid2dentry(mds, &body->fid1, NULL);
         if (IS_ERR(de)) {
@@ -1141,10 +1143,10 @@ static int mds_getattr(int offset, struct ptlrpc_request *req)
         GOTO(out_pop, rc);
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         GOTO(out_pop, rc);
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+        mds_exit_ucred(&uc);
         return rc;
 }
 
         return rc;
 }
 
-
 static int mds_obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
                           unsigned long max_age)
 {
 static int mds_obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
                           unsigned long max_age)
 {
@@ -1187,7 +1189,7 @@ out:
         return 0;
 }
 
         return 0;
 }
 
-static int mds_sync(struct ptlrpc_request *req)
+static int mds_sync(struct ptlrpc_request *req, int offset)
 {
         struct obd_device *obd = req->rq_export->exp_obd;
         struct mds_obd *mds = &obd->u.mds;
 {
         struct obd_device *obd = req->rq_export->exp_obd;
         struct mds_obd *mds = &obd->u.mds;
@@ -1195,7 +1197,7 @@ static int mds_sync(struct ptlrpc_request *req)
         int rc, size = sizeof(*body);
         ENTRY;
 
         int rc, size = sizeof(*body);
         ENTRY;
 
-        body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*body));
+        body = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*body));
         if (body == NULL)
                 GOTO(out, rc = -EPROTO);
 
         if (body == NULL)
                 GOTO(out, rc = -EPROTO);
 
@@ -1238,12 +1240,14 @@ out:
  *
  * If we were to take another one here, a deadlock will result, if another
  * thread is already waiting for a PW lock. */
  *
  * If we were to take another one here, a deadlock will result, if another
  * thread is already waiting for a PW lock. */
-static int mds_readpage(struct ptlrpc_request *req)
+static int mds_readpage(struct ptlrpc_request *req, int offset)
 {
         struct obd_device *obd = req->rq_export->exp_obd;
 {
         struct obd_device *obd = req->rq_export->exp_obd;
+        struct mds_obd *mds = &obd->u.mds;
         struct vfsmount *mnt;
         struct dentry *de;
         struct file *file;
         struct vfsmount *mnt;
         struct dentry *de;
         struct file *file;
+        struct mds_req_sec_desc *rsd;
         struct mds_body *body, *repbody;
         struct lvfs_run_ctxt saved;
         int rc, size = sizeof(*repbody);
         struct mds_body *body, *repbody;
         struct lvfs_run_ctxt saved;
         int rc, size = sizeof(*repbody);
@@ -1256,16 +1260,28 @@ static int mds_readpage(struct ptlrpc_request *req)
                 GOTO(out, rc = -ENOMEM);
         }
 
                 GOTO(out, rc = -ENOMEM);
         }
 
-        body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
-        if (body == NULL)
+        rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
+        if (!rsd) {
+                CERROR("Can't unpack security desc\n");
                 GOTO (out, rc = -EFAULT);
                 GOTO (out, rc = -EFAULT);
+        }
+        mds_squash_root(mds, rsd, &req->rq_peer.peer_id.nid); 
+
+        body = lustre_swab_reqbuf(req, offset, sizeof(*body),
+                                  lustre_swab_mds_body);
+        if (body == NULL) {
+                CERROR("Can't unpack body\n");
+                GOTO (out, rc = -EFAULT);
+        }
+
+        rc = mds_init_ucred(&uc, rsd);
+        if (rc) {
+                CERROR("can't init ucred\n");
+                GOTO(out, rc);
+        }
 
 
-        mds_root_squash_body(&obd->u.mds, &req->rq_peer.peer_id.nid, body); 
-        uc.luc_fsuid = body->fsuid;
-        uc.luc_fsgid = body->fsgid;
-        uc.luc_cap = body->capability;
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
-        de = mds_fid2dentry(&obd->u.mds, &body->fid1, &mnt);
+        de = mds_fid2dentry(mds, &body->fid1, &mnt);
         if (IS_ERR(de))
                 GOTO(out_pop, rc = PTR_ERR(de));
 
         if (IS_ERR(de))
                 GOTO(out_pop, rc = PTR_ERR(de));
 
@@ -1304,6 +1320,7 @@ out_file:
         filp_close(file, 0);
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         filp_close(file, 0);
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+        mds_exit_ucred(&uc);
 out:
         req->rq_status = rc;
         RETURN(0);
 out:
         req->rq_status = rc;
         RETURN(0);
@@ -1312,7 +1329,9 @@ out:
 int mds_reint(struct ptlrpc_request *req, int offset,
               struct lustre_handle *lockh)
 {
 int mds_reint(struct ptlrpc_request *req, int offset,
               struct lustre_handle *lockh)
 {
+        struct mds_obd *mds = &req->rq_export->exp_obd->u.mds;
         struct mds_update_record *rec; /* 116 bytes on the stack?  no sir! */
         struct mds_update_record *rec; /* 116 bytes on the stack?  no sir! */
+        struct mds_req_sec_desc *rsd;
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
@@ -1320,15 +1339,29 @@ int mds_reint(struct ptlrpc_request *req, int offset,
         if (rec == NULL)
                 RETURN(-ENOMEM);
 
         if (rec == NULL)
                 RETURN(-ENOMEM);
 
+        rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
+        if (!rsd) {
+                CERROR("Can't unpack security desc\n");
+                GOTO(out, rc = -EFAULT);
+        }
+        mds_squash_root(mds, rsd, &req->rq_peer.peer_id.nid); 
+
         rc = mds_update_unpack(req, offset, rec);
         if (rc || OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_UNPACK)) {
                 CERROR("invalid record\n");
                 GOTO(out, req->rq_status = -EINVAL);
         }
         rc = mds_update_unpack(req, offset, rec);
         if (rc || OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_UNPACK)) {
                 CERROR("invalid record\n");
                 GOTO(out, req->rq_status = -EINVAL);
         }
-        mds_root_squash_rec(&req->rq_export->exp_obd->u.mds,
-                            &req->rq_peer.peer_id.nid, rec);
+
+        rc = mds_init_ucred(&rec->ur_uc, rsd);
+        if (rc) {
+                CERROR("can't init ucred\n");
+                GOTO(out, rc);
+        }
+
         /* rc will be used to interrupt a for loop over multiple records */
         rc = mds_reint_rec(rec, offset, req, lockh);
         /* rc will be used to interrupt a for loop over multiple records */
         rc = mds_reint_rec(rec, offset, req, lockh);
+
+        mds_exit_ucred(&rec->ur_uc);
  out:
         OBD_FREE(rec, sizeof(*rec));
         RETURN(rc);
  out:
         OBD_FREE(rec, sizeof(*rec));
         RETURN(rc);
@@ -1454,9 +1487,14 @@ static int mdt_obj_create(struct ptlrpc_request *req)
 
         MDS_CHECK_RESENT(req, reconstruct_create(req));
 
 
         MDS_CHECK_RESENT(req, reconstruct_create(req));
 
+        /* FIXME don't understand what security context we should
+         * take here. check this -ericm
+         */
         uc.luc_fsuid = body->oa.o_uid;
         uc.luc_fsgid = body->oa.o_gid;
         uc.luc_fsuid = body->oa.o_uid;
         uc.luc_fsgid = body->oa.o_gid;
-
+        uc.luc_uid = body->oa.o_uid;
+        uc.luc_ghash = mds_get_group_entry(mds, body->oa.o_uid);
+        uc.luc_ginfo = NULL;
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         
         repbody = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*repbody));
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         
         repbody = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*repbody));
@@ -1602,6 +1640,7 @@ cleanup:
 
         l_dput(new);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
 
         l_dput(new);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+        mds_put_group_entry(mds, uc.luc_ghash);
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
@@ -1708,6 +1747,73 @@ static int mdt_set_info(struct ptlrpc_request *req)
         RETURN(-EINVAL);
 }
 
         RETURN(-EINVAL);
 }
 
+static int mds_msg_check_version(struct lustre_msg *msg)
+{
+        int rc;
+
+        switch (msg->opc) {
+        case MDS_CONNECT:
+        case MDS_DISCONNECT:
+        case OBD_PING:
+                rc = lustre_msg_check_version(msg, LUSTRE_OBD_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_OBD_VERSION);
+                break;
+        case MDS_STATFS:
+        case MDS_GETSTATUS:
+        case MDS_GETATTR:
+        case MDS_GETATTR_NAME:
+        case MDS_READPAGE:
+        case MDS_REINT:
+        case MDS_CLOSE:
+        case MDS_DONE_WRITING:
+        case MDS_PIN:
+        case MDS_SYNC:
+                rc = lustre_msg_check_version(msg, LUSTRE_MDS_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_MDS_VERSION);
+                break;
+        case LDLM_ENQUEUE:
+        case LDLM_CONVERT:
+        case LDLM_BL_CALLBACK:
+        case LDLM_CP_CALLBACK:
+                rc = lustre_msg_check_version(msg, LUSTRE_DLM_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_DLM_VERSION);
+                break;
+        case OBD_LOG_CANCEL:
+        case LLOG_ORIGIN_HANDLE_OPEN:
+        case LLOG_ORIGIN_HANDLE_NEXT_BLOCK:
+        case LLOG_ORIGIN_HANDLE_PREV_BLOCK:
+        case LLOG_ORIGIN_HANDLE_READ_HEADER:
+        case LLOG_ORIGIN_HANDLE_CLOSE:
+        case LLOG_CATINFO:
+                rc = lustre_msg_check_version(msg, LUSTRE_LOG_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_LOG_VERSION);
+                break;
+        case OST_CREATE:
+        case OST_WRITE:
+        case OST_GET_INFO:
+        case OST_SET_INFO:
+                rc = lustre_msg_check_version(msg, LUSTRE_OBD_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_OBD_VERSION);
+                break;
+        default:
+                CERROR("MDS unknown opcode %d\n", msg->opc);
+                rc = -ENOTSUPP;
+                break;
+        }
+
+        return rc;
+}
+
 int mds_handle(struct ptlrpc_request *req)
 {
         int should_process, fail = OBD_FAIL_MDS_ALL_REPLY_NET;
 int mds_handle(struct ptlrpc_request *req)
 {
         int should_process, fail = OBD_FAIL_MDS_ALL_REPLY_NET;
@@ -1718,6 +1824,12 @@ int mds_handle(struct ptlrpc_request *req)
 
         OBD_FAIL_RETURN(OBD_FAIL_MDS_ALL_REQUEST_NET | OBD_FAIL_ONCE, 0);
 
 
         OBD_FAIL_RETURN(OBD_FAIL_MDS_ALL_REQUEST_NET | OBD_FAIL_ONCE, 0);
 
+        rc = mds_msg_check_version(req->rq_reqmsg);
+        if (rc) {
+                CERROR("MDS drop mal-formed request\n");
+                RETURN(rc);
+        }
+
         LASSERT(current->journal_info == NULL);
         /* XXX identical to OST */
         if (req->rq_reqmsg->opc != MDS_CONNECT) {
         LASSERT(current->journal_info == NULL);
         /* XXX identical to OST */
         if (req->rq_reqmsg->opc != MDS_CONNECT) {
@@ -1792,7 +1904,7 @@ int mds_handle(struct ptlrpc_request *req)
         case MDS_GETATTR:
                 DEBUG_REQ(D_INODE, req, "getattr");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_GETATTR_NET, 0);
         case MDS_GETATTR:
                 DEBUG_REQ(D_INODE, req, "getattr");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_GETATTR_NET, 0);
-                rc = mds_getattr(0, req);
+                rc = mds_getattr(req, MDS_REQ_REC_OFF);
                 break;
 
         case MDS_GETATTR_NAME: {
                 break;
 
         case MDS_GETATTR_NAME: {
@@ -1805,7 +1917,8 @@ int mds_handle(struct ptlrpc_request *req)
                  * want to cancel.
                  */
                 lockh.cookie = 0;
                  * want to cancel.
                  */
                 lockh.cookie = 0;
-                rc = mds_getattr_name(0, req, &lockh, MDS_INODELOCK_UPDATE);
+                rc = mds_getattr_name(req, MDS_REQ_REC_OFF, &lockh,
+                                      MDS_INODELOCK_UPDATE);
                 /* this non-intent call (from an ioctl) is special */
                 req->rq_status = rc;
                 if (rc == 0 && lockh.cookie)
                 /* this non-intent call (from an ioctl) is special */
                 req->rq_status = rc;
                 if (rc == 0 && lockh.cookie)
@@ -1821,7 +1934,7 @@ int mds_handle(struct ptlrpc_request *req)
         case MDS_READPAGE:
                 DEBUG_REQ(D_INODE, req, "readpage");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_READPAGE_NET, 0);
         case MDS_READPAGE:
                 DEBUG_REQ(D_INODE, req, "readpage");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_READPAGE_NET, 0);
-                rc = mds_readpage(req);
+                rc = mds_readpage(req, MDS_REQ_REC_OFF);
 
                 if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_SENDPAGE)) {
                         if (req->rq_reply_state) {
 
                 if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_SENDPAGE)) {
                         if (req->rq_reply_state) {
@@ -1834,7 +1947,8 @@ int mds_handle(struct ptlrpc_request *req)
                 break;
 
         case MDS_REINT: {
                 break;
 
         case MDS_REINT: {
-                __u32 *opcp = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*opcp));
+                __u32 *opcp = lustre_msg_buf(req->rq_reqmsg, MDS_REQ_REC_OFF,
+                                             sizeof (*opcp));
                 __u32  opc;
                 int size[3] = {sizeof(struct mds_body), mds->mds_max_mdsize,
                                mds->mds_max_cookiesize};
                 __u32  opc;
                 int size[3] = {sizeof(struct mds_body), mds->mds_max_mdsize,
                                mds->mds_max_cookiesize};
@@ -1868,7 +1982,7 @@ int mds_handle(struct ptlrpc_request *req)
                 if (rc)
                         break;
 
                 if (rc)
                         break;
 
-                rc = mds_reint(req, 0, NULL);
+                rc = mds_reint(req, MDS_REQ_REC_OFF, NULL);
                 fail = OBD_FAIL_MDS_REINT_NET_REP;
                 break;
         }
                 fail = OBD_FAIL_MDS_REINT_NET_REP;
                 break;
         }
@@ -1876,25 +1990,25 @@ int mds_handle(struct ptlrpc_request *req)
         case MDS_CLOSE:
                 DEBUG_REQ(D_INODE, req, "close");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_CLOSE_NET, 0);
         case MDS_CLOSE:
                 DEBUG_REQ(D_INODE, req, "close");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_CLOSE_NET, 0);
-                rc = mds_close(req);
+                rc = mds_close(req, MDS_REQ_REC_OFF);
                 break;
 
         case MDS_DONE_WRITING:
                 DEBUG_REQ(D_INODE, req, "done_writing");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_DONE_WRITING_NET, 0);
                 break;
 
         case MDS_DONE_WRITING:
                 DEBUG_REQ(D_INODE, req, "done_writing");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_DONE_WRITING_NET, 0);
-                rc = mds_done_writing(req);
+                rc = mds_done_writing(req, MDS_REQ_REC_OFF);
                 break;
 
         case MDS_PIN:
                 DEBUG_REQ(D_INODE, req, "pin");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_PIN_NET, 0);
                 break;
 
         case MDS_PIN:
                 DEBUG_REQ(D_INODE, req, "pin");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_PIN_NET, 0);
-                rc = mds_pin(req);
+                rc = mds_pin(req, MDS_REQ_REC_OFF);
                 break;
 
         case MDS_SYNC:
                 DEBUG_REQ(D_INODE, req, "sync");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_SYNC_NET, 0);
                 break;
 
         case MDS_SYNC:
                 DEBUG_REQ(D_INODE, req, "sync");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_SYNC_NET, 0);
-                rc = mds_sync(req);
+                rc = mds_sync(req, MDS_REQ_REC_OFF);
                 break;
 
         case OBD_PING:
                 break;
 
         case OBD_PING:
@@ -2417,13 +2531,14 @@ static int mds_cleanup(struct obd_device *obd, int flags)
 }
 
 static void fixup_handle_for_resent_req(struct ptlrpc_request *req,
 }
 
 static void fixup_handle_for_resent_req(struct ptlrpc_request *req,
+                                        int offset,
                                         struct ldlm_lock *new_lock,
                                         struct lustre_handle *lockh)
 {
         struct obd_export *exp = req->rq_export;
         struct obd_device *obd = exp->exp_obd;
         struct ldlm_request *dlmreq =
                                         struct ldlm_lock *new_lock,
                                         struct lustre_handle *lockh)
 {
         struct obd_export *exp = req->rq_export;
         struct obd_device *obd = exp->exp_obd;
         struct ldlm_request *dlmreq =
-                lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*dlmreq));
+                lustre_msg_buf(req->rq_reqmsg, offset, sizeof (*dlmreq));
         struct lustre_handle remote_hdl = dlmreq->lock_handle1;
         struct list_head *iter;
 
         struct lustre_handle remote_hdl = dlmreq->lock_handle1;
         struct list_head *iter;
 
@@ -2488,15 +2603,16 @@ static int mds_intent_policy(struct ldlm_namespace *ns,
         struct lustre_handle lockh = { 0 };
         struct ldlm_lock *new_lock;
         int getattr_part = MDS_INODELOCK_UPDATE;
         struct lustre_handle lockh = { 0 };
         struct ldlm_lock *new_lock;
         int getattr_part = MDS_INODELOCK_UPDATE;
-        int rc, offset = 2, repsize[4] = {sizeof(struct ldlm_reply),
-                                          sizeof(struct mds_body),
-                                          mds->mds_max_mdsize,
-                                          mds->mds_max_cookiesize};
+        int rc, repsize[4] = { sizeof(struct ldlm_reply),
+                               sizeof(struct mds_body),
+                               mds->mds_max_mdsize,
+                               mds->mds_max_cookiesize };
+        int offset = MDS_REQ_INTENT_REC_OFF; 
         ENTRY;
 
         LASSERT(req != NULL);
 
         ENTRY;
 
         LASSERT(req != NULL);
 
-        if (req->rq_reqmsg->bufcount <= 1) {
+        if (req->rq_reqmsg->bufcount <= MDS_REQ_INTENT_IT_OFF) {
                 /* No intent was provided */
                 int size = sizeof(struct ldlm_reply);
                 rc = lustre_pack_reply(req, 1, &size, NULL);
                 /* No intent was provided */
                 int size = sizeof(struct ldlm_reply);
                 rc = lustre_pack_reply(req, 1, &size, NULL);
@@ -2504,7 +2620,8 @@ static int mds_intent_policy(struct ldlm_namespace *ns,
                 RETURN(0);
         }
 
                 RETURN(0);
         }
 
-        it = lustre_swab_reqbuf(req, 1, sizeof(*it), lustre_swab_ldlm_intent);
+        it = lustre_swab_reqbuf(req, MDS_REQ_INTENT_IT_OFF, sizeof(*it),
+                                lustre_swab_ldlm_intent);
         if (it == NULL) {
                 CERROR("Intent missing\n");
                 RETURN(req->rq_status = -EFAULT);
         if (it == NULL) {
                 CERROR("Intent missing\n");
                 RETURN(req->rq_status = -EFAULT);
@@ -2519,7 +2636,8 @@ static int mds_intent_policy(struct ldlm_namespace *ns,
         rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
         intent_set_disposition(rep, DISP_IT_EXECD);
 
         rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
         intent_set_disposition(rep, DISP_IT_EXECD);
 
-        fixup_handle_for_resent_req(req, lock, &lockh);
+        fixup_handle_for_resent_req(req, MDS_REQ_INTENT_LOCKREQ_OFF,
+                                    lock, &lockh);
 
         /* execute policy */
         switch ((long)it->opc) {
 
         /* execute policy */
         switch ((long)it->opc) {
@@ -2547,7 +2665,7 @@ static int mds_intent_policy(struct ldlm_namespace *ns,
         case IT_GETATTR:
                 getattr_part |= MDS_INODELOCK_LOOKUP;
         case IT_READDIR:
         case IT_GETATTR:
                 getattr_part |= MDS_INODELOCK_LOOKUP;
         case IT_READDIR:
-                rep->lock_policy_res2 = mds_getattr_name(offset, req, &lockh,
+                rep->lock_policy_res2 = mds_getattr_name(req, offset, &lockh,
                                                          getattr_part);
                 /* FIXME: LDLM can set req->rq_status. MDS sets
                    policy_res{1,2} with disposition and status.
                                                          getattr_part);
                 /* FIXME: LDLM can set req->rq_status. MDS sets
                    policy_res{1,2} with disposition and status.
@@ -2844,6 +2962,8 @@ static int __init mds_init(void)
 {
         struct lprocfs_static_vars lvars;
 
 {
         struct lprocfs_static_vars lvars;
 
+        mds_group_hash_init();
+
         lprocfs_init_multi_vars(0, &lvars);
         class_register_type(&mds_obd_ops, NULL, lvars.module_vars,
                             LUSTRE_MDS_NAME);
         lprocfs_init_multi_vars(0, &lvars);
         class_register_type(&mds_obd_ops, NULL, lvars.module_vars,
                             LUSTRE_MDS_NAME);
@@ -2856,6 +2976,8 @@ static int __init mds_init(void)
 
 static void /*__exit*/ mds_exit(void)
 {
 
 static void /*__exit*/ mds_exit(void)
 {
+        mds_group_hash_cleanup();
+
         class_unregister_type(LUSTRE_MDS_NAME);
         class_unregister_type(LUSTRE_MDT_NAME);
 }
         class_unregister_type(LUSTRE_MDS_NAME);
         class_unregister_type(LUSTRE_MDT_NAME);
 }
index 1cff1c4..27633ae 100644 (file)
@@ -268,8 +268,156 @@ struct lprocfs_vars lprocfs_mds_obd_vars[] = {
         { 0 }
 };
 
         { 0 }
 };
 
+/*
+ * group hash proc entries handler
+ */
+static int lprocfs_wr_group_info(struct file *file, const char *buffer,
+                                 unsigned long count, void *data)
+{
+        struct {
+                int             err;
+                uid_t           uid;
+                uint32_t        ngroups;
+                gid_t          *groups;
+        } param;
+        gid_t   gids_local[NGROUPS_SMALL];
+        gid_t  *gids = NULL;
+
+        if (count != sizeof(param)) {
+                CERROR("invalid data size %lu\n", count);
+                return count;
+        }
+        if (copy_from_user(&param, buffer, count)) {
+                CERROR("broken downcall\n");
+                return count;
+        }
+        if (param.ngroups > NGROUPS_MAX) {
+                CERROR("%d groups?\n", param.ngroups);
+                return count;
+        }
+
+        if (param.ngroups <= NGROUPS_SMALL)
+                gids = gids_local;
+        else {
+                OBD_ALLOC(gids, param.ngroups * sizeof(gid_t));
+                if (!gids) {
+                        CERROR("fail to alloc memory for %d gids\n",
+                                param.ngroups);
+                        return count;
+                }
+        }
+        if (copy_from_user(gids, param.groups,
+                           param.ngroups * sizeof(gid_t))) {
+                CERROR("broken downcall\n");
+                goto out;
+        }
+
+        mds_handle_group_downcall(param.err, param.uid,
+                                  param.ngroups, gids);
+
+out:
+        if (gids && gids != gids_local)
+                OBD_FREE(gids, param.ngroups * sizeof(gid_t));
+        return count;
+}
+static int lprocfs_rd_expire(char *page, char **start, off_t off, int count,
+                             int *eof, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+
+        *eof = 1;
+        return snprintf(page, count, "%d\n", hash->gh_entry_expire);
+}
+static int lprocfs_wr_expire(struct file *file, const char *buffer,
+                             unsigned long count, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+        char buf[32];
+
+        if (copy_from_user(buf, buffer, min(count, 32UL)))
+                return count;
+        buf[31] = 0;
+        sscanf(buf, "%d", &hash->gh_entry_expire);
+        return count;
+}
+static int lprocfs_rd_ac_expire(char *page, char **start, off_t off, int count,
+                                int *eof, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+
+        *eof = 1;
+        return snprintf(page, count, "%d\n", hash->gh_acquire_expire);
+}
+static int lprocfs_wr_ac_expire(struct file *file, const char *buffer,
+                                unsigned long count, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+        char buf[32];
+
+        if (copy_from_user(buf, buffer, min(count, 32UL)))
+                return count;
+        buf[31] = 0;
+        sscanf(buf, "%d", &hash->gh_acquire_expire);
+        return count;
+}
+static int lprocfs_rd_hash_upcall(char *page, char **start, off_t off, int count,
+                                int *eof, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+
+        *eof = 1;
+        return snprintf(page, count, "%s\n", hash->gh_upcall);
+}
+static int lprocfs_wr_hash_upcall(struct file *file, const char *buffer,
+                                  unsigned long count, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+
+        if (count < MDSGRP_UPCALL_MAXPATH) {
+                sscanf(buffer, "%1024s", hash->gh_upcall);
+                hash->gh_upcall[MDSGRP_UPCALL_MAXPATH-1] = 0;
+        }
+        return count;
+}
+static int lprocfs_wr_hash_flush(struct file *file, const char *buffer,
+                                  unsigned long count, void *data)
+{
+        mds_group_hash_flush_idle();
+        return count;
+}
+static int lprocfs_rd_allow_setgroups(char *page, char **start, off_t off,
+                                      int count, int *eof, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+
+        *eof = 1;
+        return snprintf(page, count, "%d\n", hash->gh_allow_setgroups);
+}
+static int lprocfs_wr_allow_setgroups(struct file *file, const char *buffer,
+                                      unsigned long count, void *data)
+{
+        struct mds_grp_hash *hash = __mds_get_global_group_hash();
+        char buf[8];
+        int val;
+
+        if (copy_from_user(buf, buffer, min(count, 8UL)))
+                return count;
+        buf[7] = 0;
+        sscanf(buf, "%d", &val);
+        hash->gh_allow_setgroups = (val != 0);
+        return count;
+}
+
 struct lprocfs_vars lprocfs_mds_module_vars[] = {
         { "num_refs",     lprocfs_rd_numrefs,     0, 0 },
 struct lprocfs_vars lprocfs_mds_module_vars[] = {
         { "num_refs",     lprocfs_rd_numrefs,     0, 0 },
+        { "grp_hash_expire_interval", lprocfs_rd_expire, lprocfs_wr_expire, 0},
+        { "grp_hash_acquire_expire", lprocfs_rd_ac_expire,
+                                     lprocfs_wr_ac_expire, 0},
+        { "grp_hash_upcall", lprocfs_rd_hash_upcall, lprocfs_wr_hash_upcall, 0},
+        { "grp_hash_flush", 0, lprocfs_wr_hash_flush, 0},
+        { "group_info", 0,  lprocfs_wr_group_info,   0 },
+        { "allow_setgroups", lprocfs_rd_allow_setgroups,
+                             lprocfs_wr_allow_setgroups, 0},
         { 0 }
 };
 
         { 0 }
 };
 
@@ -283,8 +431,7 @@ struct lprocfs_vars lprocfs_mdt_module_vars[] = {
         { 0 }
 };
 
         { 0 }
 };
 
-
-#endif
+#endif /* LPROCFS */
 
 struct lprocfs_static_vars lprocfs_array_vars[] = { {lprocfs_mds_module_vars,
                                                      lprocfs_mds_obd_vars},
 
 struct lprocfs_static_vars lprocfs_array_vars[] = { {lprocfs_mds_module_vars,
                                                      lprocfs_mds_obd_vars},
diff --git a/lustre/mds/mds_groups.c b/lustre/mds/mds_groups.c
new file mode 100644 (file)
index 0000000..5231255
--- /dev/null
@@ -0,0 +1,451 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (c) 2004 Cluster File Systems, Inc.
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define DEBUG_SUBSYSTEM S_MDS
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/kmod.h>
+#include <linux/string.h>
+#include <linux/stat.h>
+#include <linux/errno.h>
+#include <linux/version.h>
+#include <linux/unistd.h>
+
+#include <asm/system.h>
+#include <asm/uaccess.h>
+
+#include <linux/fs.h>
+#include <linux/stat.h>
+#include <asm/uaccess.h>
+#include <linux/slab.h>
+#include <asm/segment.h>
+
+#include <portals/list.h>
+#include <linux/obd_support.h>
+#include <linux/lustre_lib.h>
+#include <linux/lustre_mds.h>
+#include "mds_internal.h"
+
+#define GRP_HASH_NEW              0x1
+#define GRP_HASH_ACQUIRING        0x2
+#define GRP_HASH_INVALID          0x4
+#define GRP_HASH_EXPIRED          0x8
+
+#define GRP_IS_NEW(i)          ((i)->ge_flags & GRP_HASH_NEW)
+#define GRP_IS_INVALID(i)      ((i)->ge_flags & GRP_HASH_INVALID)
+#define GRP_IS_ACQUIRING(i)    ((i)->ge_flags & GRP_HASH_ACQUIRING)
+#define GRP_IS_EXPIRED(i)      ((i)->ge_flags & GRP_HASH_EXPIRED)
+#define GRP_IS_VALID(i)        ((i)->ge_flags == 0)
+
+#define GRP_SET_NEW(i)         (i)->ge_flags |= GRP_HASH_NEW
+#define GRP_SET_INVALID(i)     (i)->ge_flags |= GRP_HASH_INVALID
+#define GRP_SET_ACQUIRING(i)   (i)->ge_flags |= GRP_HASH_ACQUIRING
+#define GRP_SET_EXPIRED(i)     (i)->ge_flags |= GRP_HASH_EXPIRED
+#define GRP_SET_VALID(i)       (i)->ge_flags = 0
+
+#define GRP_CLEAR_NEW(i)       (i)->ge_flags &= ~GRP_HASH_NEW
+#define GRP_CLEAR_ACQUIRING(i) (i)->ge_flags &= ~GRP_HASH_ACQUIRING
+#define GRP_CLEAR_INVALID(i)   (i)->ge_flags &= ~GRP_HASH_INVALID
+#define GRP_CLEAR_EXPIRED(i)   (i)->ge_flags &= ~GRP_HASH_EXPIRED
+
+/* 
+ * We need share hash table among the groups of MDSs (which server as the same
+ * lustre file system), maybe MDT? but there's lprocfs problems of putting this
+ * in MDT. so we make it global to the module. which brings the limitation that
+ * one node couldn't running multiple MDS which server as different Lustre FS.
+ * but which maybe not meaningful.
+ */
+static struct mds_grp_hash _group_hash;
+
+struct mds_grp_hash *__mds_get_global_group_hash()
+{
+        return &_group_hash;
+}
+
+static struct mds_grp_hash_entry * alloc_entry(uid_t uid)
+{
+        struct mds_grp_hash_entry *entry;
+
+        OBD_ALLOC(entry, sizeof(*entry));
+        if (!entry)
+                return NULL;
+
+        GRP_SET_NEW(entry);
+        INIT_LIST_HEAD(&entry->ge_hash);
+        entry->ge_uid = uid;
+        atomic_set(&entry->ge_refcount, 0);
+        init_waitqueue_head(&entry->ge_waitq);
+        return entry;
+}
+
+/* protected by hash lock */
+static void free_entry(struct mds_grp_hash_entry *entry)
+{
+        if (entry->ge_group_info)
+                groups_free(entry->ge_group_info);
+        list_del(&entry->ge_hash);
+        CDEBUG(D_OTHER, "destroy mds_grp_entry %p for uid %d\n",
+               entry, entry->ge_uid);
+        OBD_FREE(entry, sizeof(*entry));
+}
+
+static inline void get_entry(struct mds_grp_hash_entry *entry)
+{
+        atomic_inc(&entry->ge_refcount);
+}
+static inline void put_entry(struct mds_grp_hash_entry *entry)
+{
+        if (atomic_dec_and_test(&entry->ge_refcount) &&
+            (GRP_IS_INVALID(entry) || GRP_IS_EXPIRED(entry))) {
+                free_entry(entry);
+        }
+}
+static int check_unlink_entry(struct mds_grp_hash_entry *entry)
+{
+        if (GRP_IS_VALID(entry) &&
+            time_before(jiffies, entry->ge_expire))
+                return 0;
+
+        if (GRP_IS_ACQUIRING(entry) &&
+            time_after(jiffies, entry->ge_acquire_expire)) {
+                GRP_SET_EXPIRED(entry);
+                wake_up_all(&entry->ge_waitq);
+        } else if (!GRP_IS_INVALID(entry)) {
+                GRP_SET_EXPIRED(entry);
+        }
+
+        list_del_init(&entry->ge_hash);
+        if (!atomic_read(&entry->ge_refcount))
+                free_entry(entry);
+        return 1;
+}
+
+static int refresh_entry(struct mds_grp_hash *hash,
+                         struct mds_grp_hash_entry *entry)
+{
+        char *argv[4];
+        char *envp[3];
+        char uidstr[16];
+        int rc;
+        ENTRY;
+
+        snprintf(uidstr, 16, "%d", entry->ge_uid);
+
+        argv[0] = hash->gh_upcall;
+        argv[1] = uidstr;
+        argv[2] = NULL;
+                                                                                                                        
+        envp[0] = "HOME=/";
+        envp[1] = "PATH=/sbin:/usr/sbin";
+        envp[2] = NULL;
+
+        rc = USERMODEHELPER(argv[0], argv, envp);
+        if (rc < 0) {
+                CERROR("Error invoking getgroups upcall %s %s: %d; check "
+                       "/proc/fs/lustre/mds/grp_hash_upcall\n",
+                       argv[0], argv[1], rc);
+        } else {
+                CWARN("Invoked upcall %s %s\n",
+                        argv[0], argv[1]);
+        }
+        RETURN(rc);
+}
+
+struct mds_grp_hash_entry * mds_get_group_entry(struct mds_obd *mds, uid_t uid)
+{
+        struct mds_grp_hash *hash = &_group_hash;
+        struct mds_grp_hash_entry *entry = NULL, *new = NULL, *next;
+        struct list_head *head;
+        wait_queue_t wait;
+        int rc, found;
+        ENTRY;
+
+        LASSERT(hash);
+
+        head = &hash->gh_table[MDSGRP_HASH_INDEX(uid)];
+find_again:
+        found = 0;
+        spin_lock(&hash->gh_lock);
+        list_for_each_entry_safe(entry, next, head, ge_hash) {
+                /* check invalid & expired items */
+                if (check_unlink_entry(entry))
+                        continue;
+                if (entry->ge_uid == uid) {
+                        found = 1;
+                        break;
+                }
+        }
+
+        if (!found) { /* didn't found */
+                if (!new) {
+                        spin_unlock(&hash->gh_lock);
+                        new = alloc_entry(uid);
+                        if (!new) {
+                                CERROR("fail to alloc entry\n");
+                                RETURN(NULL);
+                        }
+                        goto find_again;
+                } else {
+                        list_add(&new->ge_hash, head);
+                        entry = new;
+                }
+        } else {
+                if (new) {
+                        free_entry(new);
+                        new = NULL;
+                }
+                list_move(&entry->ge_hash, head);
+        }
+        get_entry(entry);
+
+        /* acquire for new one */
+        if (GRP_IS_NEW(entry)) {
+                GRP_SET_ACQUIRING(entry);
+                GRP_CLEAR_NEW(entry);
+                entry->ge_acquire_expire = jiffies +
+                                           hash->gh_acquire_expire * HZ;
+                spin_unlock(&hash->gh_lock);
+
+                rc = refresh_entry(hash, entry);
+
+                spin_lock(&hash->gh_lock);
+                if (rc) {
+                        GRP_CLEAR_ACQUIRING(entry);
+                        GRP_SET_INVALID(entry);
+                }
+                /* fall through */
+        }
+        /* someone (and only one) is doing upcall upon
+         * this item, just wait it complete
+         */
+        if (GRP_IS_ACQUIRING(entry)) {
+                init_waitqueue_entry(&wait, current);
+                add_wait_queue(&entry->ge_waitq, &wait);
+                set_current_state(TASK_INTERRUPTIBLE);
+                spin_unlock(&hash->gh_lock);
+
+                schedule_timeout(hash->gh_acquire_expire * HZ);
+
+                spin_lock(&hash->gh_lock);
+                remove_wait_queue(&entry->ge_waitq, &wait);
+                if (GRP_IS_ACQUIRING(entry)) {
+                        /* we're interrupted or upcall failed
+                         * in the middle
+                         */
+                        put_entry(entry);
+                        spin_unlock(&hash->gh_lock);
+                        RETURN(NULL);
+                }
+                /* fall through */
+        }
+
+        /* invalid means error, don't need to try again */
+        if (GRP_IS_INVALID(entry)) {
+                put_entry(entry);
+                spin_unlock(&hash->gh_lock);
+                RETURN(NULL);
+        }
+
+        /* check expired 
+         * We can't refresh the existed one because some
+         * memory might be shared by multiple processes.
+         */
+        if (check_unlink_entry(entry)) {
+                /* if expired, try again. but if this entry is
+                 * created by me but too quickly turn to expired
+                 * without any error, should at least give a
+                 * chance to use it once.
+                 */
+                if (entry != new) {
+                        put_entry(entry);
+                        spin_unlock(&hash->gh_lock);
+                        new = NULL;
+                        goto find_again;
+                }
+        }
+        
+        /* Now we know it's good */
+        spin_unlock(&hash->gh_lock);
+        RETURN(entry);
+}
+
+
+void mds_put_group_entry(struct mds_obd *mds, struct mds_grp_hash_entry *entry)
+{
+        struct mds_grp_hash *hash = &_group_hash;
+        ENTRY;
+
+        if (!entry) {
+                EXIT;
+                return;
+        }
+
+        spin_lock(&hash->gh_lock);
+        LASSERT(atomic_read(&entry->ge_refcount) > 0);
+        put_entry(entry);
+        spin_unlock(&hash->gh_lock);
+        EXIT;
+}
+
+static int entry_set_group_info(struct mds_grp_hash_entry *entry,
+                                __u32 ngroups, gid_t *groups)
+{
+        struct group_info *ginfo;
+        ENTRY;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
+        if (ngroups > NGROUPS)
+                ngroups = NGROUPS;
+#endif
+
+        if (ngroups > NGROUPS_MAX) {
+                CERROR("too many (%d) supp groups\n", ngroups); 
+                RETURN(-EINVAL);
+        }
+
+        ginfo = groups_alloc(ngroups);
+        if (!ginfo) {
+                CERROR("can't alloc group_info for %d groups\n", ngroups);
+                RETURN(-ENOMEM);
+        }
+        groups_from_buffer(ginfo, groups);
+
+        entry->ge_group_info = ginfo;
+        RETURN(0);
+}
+
+int mds_handle_group_downcall(int err, uid_t uid, __u32 ngroups, gid_t *groups)
+{
+        struct mds_grp_hash *hash = &_group_hash;
+        struct mds_grp_hash_entry *entry = NULL;
+        struct list_head *head;
+        int found = 0, rc = 0;
+        ENTRY;
+
+        LASSERT(hash);
+
+        head = &hash->gh_table[MDSGRP_HASH_INDEX(uid)];
+
+        spin_lock(&hash->gh_lock);
+        list_for_each_entry(entry, head, ge_hash) {
+                if (entry->ge_uid == uid) {
+                        found = 1;
+                        break;
+                }
+        }
+        if (!found) {
+                /* haven't found, it's possible */
+                spin_unlock(&hash->gh_lock);
+                RETURN(-EINVAL);
+        }
+        if (err) {
+                GRP_SET_INVALID(entry);
+                GOTO(out, rc = -EINVAL);
+        }
+
+        if (!GRP_IS_ACQUIRING(entry) ||
+            GRP_IS_INVALID(entry) ||
+            GRP_IS_EXPIRED(entry)) {
+                CERROR("found a stale entry %p(uid %d) in ioctl\n",
+                        entry, entry->ge_uid);
+                GOTO(out, rc = -EINVAL);
+        }
+
+        atomic_inc(&entry->ge_refcount);
+        spin_unlock(&hash->gh_lock);
+        rc = entry_set_group_info(entry, ngroups, groups);
+        spin_lock(&hash->gh_lock);
+        atomic_dec(&entry->ge_refcount);
+        if (rc) {
+                GRP_SET_INVALID(entry);
+                list_del_init(&entry->ge_hash);
+                GOTO(out, rc);
+        }
+        entry->ge_acquisition_time = LTIME_S(CURRENT_TIME);
+        entry->ge_expire = jiffies + hash->gh_entry_expire * HZ;
+        GRP_SET_VALID(entry);
+        CDEBUG(D_OTHER, "created mds_grp_entry %p for uid %d\n",
+               entry, entry->ge_uid);
+out:
+        wake_up_all(&entry->ge_waitq);
+        spin_unlock(&hash->gh_lock);
+        RETURN(rc);
+}
+
+static void mds_flush_group_hash(struct mds_grp_hash *hash, int force)
+{
+        struct mds_grp_hash_entry *entry, *next;
+        int i;
+        ENTRY;
+
+        spin_lock(&hash->gh_lock);
+        for (i = 0; i < MDSGRP_HASH_SIZE; i++) {
+                list_for_each_entry_safe(entry, next,
+                                         &hash->gh_table[i], ge_hash) {
+                        if (!force && atomic_read(&entry->ge_refcount)) {
+                                GRP_SET_EXPIRED(entry);
+                                continue;
+                        }
+                        LASSERT(!atomic_read(&entry->ge_refcount));
+                        free_entry(entry);
+                }
+        }
+        spin_unlock(&hash->gh_lock);
+        EXIT;
+}
+
+void mds_group_hash_flush_idle()
+{
+        mds_flush_group_hash(&_group_hash, 0);
+}
+
+int mds_allow_setgroups(void)
+{
+        return _group_hash.gh_allow_setgroups;
+}
+
+int mds_group_hash_init()
+{
+        struct mds_grp_hash *hash;
+        int i;
+        ENTRY;
+
+        hash = &_group_hash;
+
+        spin_lock_init(&hash->gh_lock);
+        for (i = 0; i < MDSGRP_HASH_SIZE; i++)
+                INIT_LIST_HEAD(&hash->gh_table[i]);
+        /* set default value, proc tunable */
+        sprintf(hash->gh_upcall, "%s", "/sbin/l_getgroups");
+        hash->gh_entry_expire = 5 * 60;
+        hash->gh_acquire_expire = 5;
+        hash->gh_allow_setgroups = 0;
+
+        RETURN(0);
+}
+
+void mds_group_hash_cleanup()
+{
+        mds_flush_group_hash(&_group_hash, 1);
+}
index 4c39219..d713031 100644 (file)
@@ -82,8 +82,11 @@ int mds_lock_new_child(struct obd_device *obd, struct inode *inode,
                        struct lustre_handle *child_lockh);
 
 /* mds/mds_lib.c */
                        struct lustre_handle *child_lockh);
 
 /* mds/mds_lib.c */
+void groups_from_buffer(struct group_info *ginfo, __u32 *gids);
 int mds_update_unpack(struct ptlrpc_request *, int offset,
                       struct mds_update_record *);
 int mds_update_unpack(struct ptlrpc_request *, int offset,
                       struct mds_update_record *);
+int mds_init_ucred(struct lvfs_ucred *ucred, struct mds_req_sec_desc *rsd);
+void mds_exit_ucred(struct lvfs_ucred *ucred);
 
 /* mds/mds_unlink_open.c */
 int mds_open_unlink_rename(struct mds_update_record *rec,
 
 /* mds/mds_unlink_open.c */
 int mds_open_unlink_rename(struct mds_update_record *rec,
@@ -125,11 +128,12 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
 int mds_query_write_access(struct inode *inode);
 int mds_open(struct mds_update_record *rec, int offset,
              struct ptlrpc_request *req, struct lustre_handle *);
 int mds_query_write_access(struct inode *inode);
 int mds_open(struct mds_update_record *rec, int offset,
              struct ptlrpc_request *req, struct lustre_handle *);
-int mds_pin(struct ptlrpc_request *req);
-int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
-                  struct mds_file_data *mfd, int unlink_orphan);
-int mds_close(struct ptlrpc_request *req);
-int mds_done_writing(struct ptlrpc_request *req);
+int mds_pin(struct ptlrpc_request *req, int offset);
+int mds_mfd_close(struct ptlrpc_request *req, int offset,
+                  struct obd_device *obd, struct mds_file_data *mfd,
+                  int unlink_orphan);
+int mds_close(struct ptlrpc_request *req, int offset);
+int mds_done_writing(struct ptlrpc_request *req, int offset);
 
 
 /* mds/mds_fs.c */
 
 
 /* mds/mds_fs.c */
@@ -142,6 +146,8 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa,
                     struct lov_stripe_md *ea, struct obd_trans_info *oti);
 
 /* mds/handler.c */
                     struct lov_stripe_md *ea, struct obd_trans_info *oti);
 
 /* mds/handler.c */
+void mds_squash_root(struct mds_obd *mds, struct mds_req_sec_desc *rsd,
+                     ptl_nid_t *peernid);
 int mds_handle(struct ptlrpc_request *req);
 extern struct lvfs_callback_ops mds_lvfs_ops;
 int mds_lov_clean(struct obd_device *obd);
 int mds_handle(struct ptlrpc_request *req);
 extern struct lvfs_callback_ops mds_lvfs_ops;
 int mds_lov_clean(struct obd_device *obd);
@@ -179,5 +185,19 @@ void mds_unlock_slave_objs(struct obd_device *, struct dentry *,
 int mds_lock_and_check_slave(int, struct ptlrpc_request *, struct lustre_handle *);
 int mds_convert_mea_ea(struct obd_device *, struct inode *, struct lov_mds_md *, int);
 
 int mds_lock_and_check_slave(int, struct ptlrpc_request *, struct lustre_handle *);
 int mds_convert_mea_ea(struct obd_device *, struct inode *, struct lov_mds_md *, int);
 
+/* mds_groups.c */
+int mds_group_hash_init(void);
+void mds_group_hash_cleanup(void);
+void mds_group_hash_flush_idle(void);
+int mds_allow_setgroups(void);
+
+extern char mds_getgroups_upcall[PATH_MAX];
+extern int mds_grp_hash_entry_expire;
+extern int mds_grp_hash_acquire_expire;
+
+struct mds_grp_hash *__mds_get_global_group_hash(void);
+struct mds_grp_hash_entry * mds_get_group_entry(struct mds_obd *mds, uid_t uid);
+void mds_put_group_entry(struct mds_obd *mds, struct mds_grp_hash_entry *entry);
+int mds_handle_group_downcall(int err, uid_t uid, __u32 ngroups, gid_t *groups);
 
 #endif /* _MDS_INTERNAL_H */
 
 #endif /* _MDS_INTERNAL_H */
index 2fe77d2..fde51b0 100644 (file)
 #include <linux/lustre_smfs.h>
 #include <linux/lustre_snap.h>
 
 #include <linux/lustre_smfs.h>
 #include <linux/lustre_snap.h>
 
+#include "mds_internal.h"
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
+struct group_info *groups_alloc(int ngroups)
+{
+        struct group_info *ginfo;
+
+        LASSERT(ngroups <= NGROUPS_SMALL);
+
+        OBD_ALLOC(ginfo, sizeof(*ginfo) + 1 * sizeof(gid_t *));
+        if (!ginfo)
+                return NULL;
+        ginfo->ngroups = ngroups;
+        ginfo->nblocks = 1;
+        ginfo->blocks[0] = ginfo->small_block;
+        atomic_set(&ginfo->usage, 1);
+
+        return ginfo;
+}
+
+void groups_free(struct group_info *ginfo)
+{
+        LASSERT(ginfo->ngroups <= NGROUPS_SMALL);
+        LASSERT(ginfo->nblocks == 1);
+        LASSERT(ginfo->blocks[0] == ginfo->small_block);
+
+        OBD_FREE(ginfo, sizeof(*ginfo) + 1 * sizeof(gid_t *));
+}
+
+/* for 2.4 the group number is small, so simply search the
+ * whole array.
+ */
+int groups_search(struct group_info *ginfo, gid_t grp)
+{
+        int i;
+
+        if (!ginfo)
+                return 0;
+
+        for (i = 0; i < ginfo->ngroups; i++)
+                if (GROUP_AT(ginfo, i) == grp)
+                        return 1;
+        return 0;
+}
+
+#else /* >= 2.6.4 */
+
+void groups_sort(struct group_info *ginfo)
+{
+        int base, max, stride;
+        int gidsetsize = ginfo->ngroups;
+
+        for (stride = 1; stride < gidsetsize; stride = 3 * stride + 1)
+                ; /* nothing */
+        stride /= 3;
+
+        while (stride) {
+                max = gidsetsize - stride;
+                for (base = 0; base < max; base++) {
+                        int left = base;
+                        int right = left + stride;
+                        gid_t tmp = GROUP_AT(ginfo, right);
+                                                                                                    
+                        while (left >= 0 && GROUP_AT(ginfo, left) > tmp) {
+                                GROUP_AT(ginfo, right) =
+                                    GROUP_AT(ginfo, left);
+                                right = left;
+                                left -= stride;
+                        }
+                        GROUP_AT(ginfo, right) = tmp;
+                }
+                stride /= 3;
+        }
+}
+
+int groups_search(struct group_info *ginfo, gid_t grp)
+{
+        int left, right;
+
+        if (!ginfo)
+                return 0;
+
+        left = 0;
+        right = ginfo->ngroups;
+        while (left < right) {
+                int mid = (left + right) / 2;
+                int cmp = grp - GROUP_AT(ginfo, mid);
+                if (cmp > 0)
+                        left = mid + 1;
+                else if (cmp < 0)
+                        right = mid;
+                else
+                        return 1;
+        }
+        return 0;
+}
+
+#endif
+
+void groups_from_buffer(struct group_info *ginfo, __u32 *gids)
+{
+        int i, ngroups = ginfo->ngroups;
+
+        for (i = 0; i < ginfo->nblocks; i++) {
+                int count = min(NGROUPS_PER_BLOCK, ngroups);
+
+                memcpy(ginfo->blocks[i], gids, count * sizeof(__u32));
+                gids += NGROUPS_PER_BLOCK;
+                ngroups -= count;
+        }
+}
+
 void mds_pack_dentry2fid(struct ll_fid *fid, struct dentry *dentry)
 {
         fid->id = dentry->d_inum;
 void mds_pack_dentry2fid(struct ll_fid *fid, struct dentry *dentry)
 {
         fid->id = dentry->d_inum;
@@ -70,6 +182,10 @@ void mds_pack_dentry2body(struct mds_body *b, struct dentry *dentry)
 void mds_pack_inode2fid(struct obd_device *obd, struct ll_fid *fid,
                                 struct inode *inode)
 {
 void mds_pack_inode2fid(struct obd_device *obd, struct ll_fid *fid,
                                 struct inode *inode)
 {
+        if (!obd || !fid || !inode) {
+                printk("obd %p, fid %p, inode %p\n", obd, fid, inode);
+                LBUG();
+        }
         fid->id = inode->i_ino;
         fid->generation = inode->i_generation;
         fid->f_type = (S_IFMT & inode->i_mode);
         fid->id = inode->i_ino;
         fid->generation = inode->i_generation;
         fid->f_type = (S_IFMT & inode->i_mode);
@@ -109,7 +225,6 @@ void mds_pack_inode2body(struct obd_device *obd, struct mds_body *b,
                 b->nlink = inode->i_nlink;
         }
         b->generation = inode->i_generation;
                 b->nlink = inode->i_nlink;
         }
         b->generation = inode->i_generation;
-        b->suppgid = -1;
         b->mds = obd->u.mds.mds_num;
 }
 
         b->mds = obd->u.mds.mds_num;
 }
 
@@ -126,11 +241,6 @@ static int mds_setattr_unpack(struct ptlrpc_request *req, int offset,
         if (rec == NULL)
                 RETURN (-EFAULT);
 
         if (rec == NULL)
                 RETURN (-EFAULT);
 
-        r->_ur_fsuid = rec->sa_fsuid;
-        r->_ur_fsgid = rec->sa_fsgid;
-        r->_ur_cap = rec->sa_cap;
-        r->_ur_suppgid1 = rec->sa_suppgid;
-        r->_ur_suppgid2 = -1;
         r->ur_fid1 = &rec->sa_fid;
         attr->ia_valid = rec->sa_valid;
         attr->ia_mode = rec->sa_mode;
         r->ur_fid1 = &rec->sa_fid;
         attr->ia_valid = rec->sa_valid;
         attr->ia_mode = rec->sa_mode;
@@ -173,17 +283,12 @@ static int mds_create_unpack(struct ptlrpc_request *req, int offset,
         if (rec == NULL)
                 RETURN (-EFAULT);
 
         if (rec == NULL)
                 RETURN (-EFAULT);
 
-        r->_ur_fsuid = rec->cr_fsuid;
-        r->_ur_fsgid = rec->cr_fsgid;
-        r->_ur_cap = rec->cr_cap;
         r->ur_fid1 = &rec->cr_fid;
         r->ur_fid2 = &rec->cr_replayfid;
         r->ur_mode = rec->cr_mode;
         r->ur_rdev = rec->cr_rdev;
         r->ur_time = rec->cr_time;
         r->ur_flags = rec->cr_flags;
         r->ur_fid1 = &rec->cr_fid;
         r->ur_fid2 = &rec->cr_replayfid;
         r->ur_mode = rec->cr_mode;
         r->ur_rdev = rec->cr_rdev;
         r->ur_time = rec->cr_time;
         r->ur_flags = rec->cr_flags;
-        r->_ur_suppgid1 = rec->cr_suppgid;
-        r->_ur_suppgid2 = -1;
 
         LASSERT_REQSWAB (req, offset + 1);
         r->ur_name = lustre_msg_string (req->rq_reqmsg, offset + 1, 0);
 
         LASSERT_REQSWAB (req, offset + 1);
         r->ur_name = lustre_msg_string (req->rq_reqmsg, offset + 1, 0);
@@ -229,11 +334,6 @@ static int mds_link_unpack(struct ptlrpc_request *req, int offset,
         if (rec == NULL)
                 RETURN (-EFAULT);
 
         if (rec == NULL)
                 RETURN (-EFAULT);
 
-        r->_ur_fsuid = rec->lk_fsuid;
-        r->_ur_fsgid = rec->lk_fsgid;
-        r->_ur_cap = rec->lk_cap;
-        r->_ur_suppgid1 = rec->lk_suppgid1;
-        r->_ur_suppgid2 = rec->lk_suppgid2;
         r->ur_fid1 = &rec->lk_fid1;
         r->ur_fid2 = &rec->lk_fid2;
         r->ur_time = rec->lk_time;
         r->ur_fid1 = &rec->lk_fid1;
         r->ur_fid2 = &rec->lk_fid2;
         r->ur_time = rec->lk_time;
@@ -257,12 +357,7 @@ static int mds_unlink_unpack(struct ptlrpc_request *req, int offset,
         if (rec == NULL)
                 RETURN(-EFAULT);
 
         if (rec == NULL)
                 RETURN(-EFAULT);
 
-        r->_ur_fsuid = rec->ul_fsuid;
-        r->_ur_fsgid = rec->ul_fsgid;
-        r->_ur_cap = rec->ul_cap;
         r->ur_mode = rec->ul_mode;
         r->ur_mode = rec->ul_mode;
-        r->_ur_suppgid1 = rec->ul_suppgid;
-        r->_ur_suppgid2 = -1;
         r->ur_fid1 = &rec->ul_fid1;
         r->ur_fid2 = &rec->ul_fid2;
         r->ur_time = rec->ul_time;
         r->ur_fid1 = &rec->ul_fid1;
         r->ur_fid2 = &rec->ul_fid2;
         r->ur_time = rec->ul_time;
@@ -282,15 +377,10 @@ static int mds_rename_unpack(struct ptlrpc_request *req, int offset,
         ENTRY;
 
         rec = lustre_swab_reqbuf (req, offset, sizeof (*rec),
         ENTRY;
 
         rec = lustre_swab_reqbuf (req, offset, sizeof (*rec),
-                                  lustre_swab_mds_rec_unlink);
+                                  lustre_swab_mds_rec_rename);
         if (rec == NULL)
                 RETURN(-EFAULT);
 
         if (rec == NULL)
                 RETURN(-EFAULT);
 
-        r->_ur_fsuid = rec->rn_fsuid;
-        r->_ur_fsgid = rec->rn_fsgid;
-        r->_ur_cap = rec->rn_cap;
-        r->_ur_suppgid1 = rec->rn_suppgid1;
-        r->_ur_suppgid2 = rec->rn_suppgid2;
         r->ur_fid1 = &rec->rn_fid1;
         r->ur_fid2 = &rec->rn_fid2;
         r->ur_time = rec->rn_time;
         r->ur_fid1 = &rec->rn_fid1;
         r->ur_fid2 = &rec->rn_fid2;
         r->ur_time = rec->rn_time;
@@ -320,17 +410,12 @@ static int mds_open_unpack(struct ptlrpc_request *req, int offset,
         if (rec == NULL)
                 RETURN (-EFAULT);
 
         if (rec == NULL)
                 RETURN (-EFAULT);
 
-        r->_ur_fsuid = rec->cr_fsuid;
-        r->_ur_fsgid = rec->cr_fsgid;
-        r->_ur_cap = rec->cr_cap;
         r->ur_fid1 = &rec->cr_fid;
         r->ur_fid2 = &rec->cr_replayfid;
         r->ur_mode = rec->cr_mode;
         r->ur_rdev = rec->cr_rdev;
         r->ur_time = rec->cr_time;
         r->ur_flags = rec->cr_flags;
         r->ur_fid1 = &rec->cr_fid;
         r->ur_fid2 = &rec->cr_replayfid;
         r->ur_mode = rec->cr_mode;
         r->ur_rdev = rec->cr_rdev;
         r->ur_time = rec->cr_time;
         r->ur_flags = rec->cr_flags;
-        r->_ur_suppgid1 = rec->cr_suppgid;
-        r->_ur_suppgid2 = -1;
 
         LASSERT_REQSWAB (req, offset + 1);
         r->ur_name = lustre_msg_string (req->rq_reqmsg, offset + 1, 0);
 
         LASSERT_REQSWAB (req, offset + 1);
         r->ur_name = lustre_msg_string (req->rq_reqmsg, offset + 1, 0);
@@ -389,3 +474,115 @@ int mds_update_unpack(struct ptlrpc_request *req, int offset,
         rc = mds_unpackers[opcode](req, offset, rec);
         RETURN(rc);
 }
         rc = mds_unpackers[opcode](req, offset, rec);
         RETURN(rc);
 }
+
+static inline void drop_ucred_ginfo(struct lvfs_ucred *ucred)
+{
+        if (ucred->luc_ginfo) {
+                put_group_info(ucred->luc_ginfo);
+                ucred->luc_ginfo = NULL;
+        }
+}
+
+/*
+ * root could set any group_info if we allowed setgroups, while
+ * normal user only could 'reduce' their group members -- which
+ * is somewhat expensive.
+ */
+int mds_init_ucred(struct lvfs_ucred *ucred, struct mds_req_sec_desc *rsd)
+{
+        struct group_info *gnew;
+
+        ENTRY;
+        LASSERT(ucred);
+        LASSERT(rsd);
+
+        ucred->luc_fsuid = rsd->rsd_fsuid;
+        ucred->luc_fsgid = rsd->rsd_fsgid;
+        ucred->luc_cap = rsd->rsd_cap;
+        ucred->luc_uid = rsd->rsd_uid;
+        ucred->luc_ghash = mds_get_group_entry(NULL, rsd->rsd_uid);
+        ucred->luc_ginfo = NULL;
+
+        if (ucred->luc_ghash && ucred->luc_ghash->ge_group_info) {
+                ucred->luc_ginfo = ucred->luc_ghash->ge_group_info;
+                get_group_info(ucred->luc_ginfo);
+        }
+
+        /* everything is done if we don't allow setgroups */
+        if (!mds_allow_setgroups())
+                RETURN(0);
+
+        if (rsd->rsd_ngroups > LUSTRE_MAX_GROUPS) {
+                CERROR("client provide too many groups: %d\n",
+                rsd->rsd_ngroups);
+                drop_ucred_ginfo(ucred);
+                mds_put_group_entry(NULL, ucred->luc_ghash);
+                RETURN(-EFAULT);
+        }
+
+        if (ucred->luc_uid == 0) {
+                if (rsd->rsd_ngroups == 0) {
+                        drop_ucred_ginfo(ucred);
+                        RETURN(0);
+                }
+
+                gnew = groups_alloc(rsd->rsd_ngroups);
+                if (!gnew) {
+                        CERROR("out of memory\n");
+                        drop_ucred_ginfo(ucred);
+                        mds_put_group_entry(NULL, ucred->luc_ghash);
+                        RETURN(-ENOMEM);
+                }
+                groups_from_buffer(gnew, rsd->rsd_groups);
+                /* can't rely on client to sort them */
+                groups_sort(gnew);
+
+                drop_ucred_ginfo(ucred);
+                ucred->luc_ginfo = gnew;
+        } else {
+                struct group_info *ginfo;
+                __u32 set = 0, cur = 0;
+
+                /* if no group info in hash, we don't
+                 * bother createing new
+                 */
+                if (!ucred->luc_ginfo)
+                        RETURN(0);
+
+                /* Note: freeing a group_info count on 'nblocks' instead of
+                 * 'ngroups', thus we can safely alloc enough buffer and reduce
+                 * and ngroups number later.
+                 */
+                gnew = groups_alloc(rsd->rsd_ngroups);
+                if (!gnew) {
+                        CERROR("out of memory\n");
+                        drop_ucred_ginfo(ucred);
+                        mds_put_group_entry(NULL, ucred->luc_ghash);
+                        RETURN(-ENOMEM);
+                }
+
+                ginfo = ucred->luc_ginfo;
+                while (cur < rsd->rsd_ngroups) {
+                        if (groups_search(ginfo, rsd->rsd_groups[cur]))
+                                GROUP_AT(gnew, set++) = rsd->rsd_groups[cur];
+                        cur++;
+                }
+                gnew->ngroups = set;
+
+                put_group_info(ucred->luc_ginfo);
+                ucred->luc_ginfo = gnew;
+        }
+        RETURN(0);
+}
+
+void mds_exit_ucred(struct lvfs_ucred *ucred)
+{
+        ENTRY;
+
+        if (ucred->luc_ginfo)
+                put_group_info(ucred->luc_ginfo);
+        if (ucred->luc_ghash)
+                mds_put_group_entry(NULL, ucred->luc_ghash);
+
+        EXIT;
+}
index 30ae15b..0500bfe 100644 (file)
@@ -1016,11 +1016,19 @@ int mds_lock_and_check_slave(int offset, struct ptlrpc_request *req,
         struct dentry *dentry = NULL;
         struct lvfs_run_ctxt saved;
         int cleanup_phase = 0;
         struct dentry *dentry = NULL;
         struct lvfs_run_ctxt saved;
         int cleanup_phase = 0;
+        struct mds_req_sec_desc *rsd;
         struct mds_body *body;
         struct lvfs_ucred uc;
         int rc, update_mode;
         ENTRY;
 
         struct mds_body *body;
         struct lvfs_ucred uc;
         int rc, update_mode;
         ENTRY;
 
+        rsd = lustre_swab_mds_secdesc(req, MDS_REQ_SECDESC_OFF);
+        if (!rsd) {
+                CERROR("Can't unpack security desc\n");
+                GOTO(cleanup, rc = -EFAULT);
+        }
+        mds_squash_root(&obd->u.mds, rsd, &req->rq_peer.peer_id.nid); 
+
         body = lustre_swab_reqbuf(req, offset, sizeof(*body),
                                   lustre_swab_mds_body);
         if (body == NULL) {
         body = lustre_swab_reqbuf(req, offset, sizeof(*body),
                                   lustre_swab_mds_body);
         if (body == NULL) {
@@ -1041,11 +1049,12 @@ int mds_lock_and_check_slave(int offset, struct ptlrpc_request *req,
 
         LASSERT(S_ISDIR(dentry->d_inode->i_mode));
 
 
         LASSERT(S_ISDIR(dentry->d_inode->i_mode));
 
-        uc.luc_fsuid = body->fsuid;
-        uc.luc_fsgid = body->fsgid;
-        uc.luc_cap = body->capability;
-        uc.luc_suppgid1 = body->suppgid;
-        uc.luc_suppgid2 = -1;
+        rc = mds_init_ucred(&uc, rsd);
+        if (rc) {
+                CERROR("can't init ucred\n");
+                GOTO(cleanup, rc);
+        }
+
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
 
         rc = 0;
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
 
         rc = 0;
@@ -1059,6 +1068,7 @@ cleanup:
                         ldlm_lock_decref(lockh, LCK_EX);
                 l_dput(dentry);
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
                         ldlm_lock_decref(lockh, LCK_EX);
                 l_dput(dentry);
                 pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+                mds_exit_ucred(&uc);
         default:
                 break;
         }
         default:
                 break;
         }
index 07ea3d8..5ee66bc 100644 (file)
@@ -491,7 +491,7 @@ static void reconstruct_open(struct mds_update_record *rec, int offset,
         int put_child = 1;
         ENTRY;
 
         int put_child = 1;
         ENTRY;
 
-        LASSERT(offset == 2);                  /* only called via intent */
+        LASSERT(offset == 3); /* only called via intent */
         rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
         body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body));
 
         rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
         body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body));
 
@@ -742,7 +742,7 @@ static int mds_open_by_fid(struct ptlrpc_request *req, struct ll_fid *fid,
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int mds_pin(struct ptlrpc_request *req)
+int mds_pin(struct ptlrpc_request *req, int offset)
 {
         struct obd_device *obd = req->rq_export->exp_obd;
         struct mds_body *request_body, *reply_body;
 {
         struct obd_device *obd = req->rq_export->exp_obd;
         struct mds_body *request_body, *reply_body;
@@ -750,7 +750,8 @@ int mds_pin(struct ptlrpc_request *req)
         int rc, size = sizeof(*reply_body);
         ENTRY;
 
         int rc, size = sizeof(*reply_body);
         ENTRY;
 
-        request_body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*request_body));
+        request_body = lustre_msg_buf(req->rq_reqmsg, offset,
+                                      sizeof(*request_body));
 
         rc = lustre_pack_reply(req, 1, &size, NULL);
         if (rc)
 
         rc = lustre_pack_reply(req, 1, &size, NULL);
         if (rc)
@@ -832,10 +833,10 @@ int mds_open(struct mds_update_record *rec, int offset,
         parent_lockh[0].cookie = 0;
         parent_lockh[1].cookie = 0;
 
         parent_lockh[0].cookie = 0;
         parent_lockh[1].cookie = 0;
 
-        if (offset == 2) { /* intent */
+        if (offset == 3) { /* intent */
                 rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
                 body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body));
                 rep = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*rep));
                 body = lustre_msg_buf(req->rq_repmsg, 1, sizeof (*body));
-        } else if (offset == 0) { /* non-intent reint */
+        } else if (offset == 1) { /* non-intent reint */
                 body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
         } else {
                 body = NULL;
                 body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
         } else {
                 body = NULL;
@@ -868,7 +869,7 @@ int mds_open(struct mds_update_record *rec, int offset,
                 LASSERT(!rec->ur_fid2->id);
         }
 
                 LASSERT(!rec->ur_fid2->id);
         }
 
-        LASSERT(offset == 2); /* If we got here, we must be called via intent */
+        LASSERT(offset == 3); /* If we got here, we must be called via intent */
 
         med = &req->rq_export->exp_mds_data;
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OPEN_PACK)) {
 
         med = &req->rq_export->exp_mds_data;
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OPEN_PACK)) {
@@ -1180,8 +1181,9 @@ got_child:
  * (it will not even _have_ an entry in last_rcvd anymore).
  *
  * Returns EAGAIN if the client needs to get more data and re-close. */
  * (it will not even _have_ an entry in last_rcvd anymore).
  *
  * Returns EAGAIN if the client needs to get more data and re-close. */
-int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
-                  struct mds_file_data *mfd, int unlink_orphan)
+int mds_mfd_close(struct ptlrpc_request *req, int offset,
+                  struct obd_device *obd, struct mds_file_data *mfd,
+                  int unlink_orphan)
 {
         struct inode *inode = mfd->mfd_dentry->d_inode;
         char fidname[LL_FID_NAMELEN];
 {
         struct inode *inode = mfd->mfd_dentry->d_inode;
         char fidname[LL_FID_NAMELEN];
@@ -1197,7 +1199,7 @@ int mds_mfd_close(struct ptlrpc_request *req, struct obd_device *obd,
         ENTRY;
 
         if (req && req->rq_reqmsg != NULL)
         ENTRY;
 
         if (req && req->rq_reqmsg != NULL)
-                request_body = lustre_msg_buf(req->rq_reqmsg, 0,
+                request_body = lustre_msg_buf(req->rq_reqmsg, offset,
                                               sizeof(*request_body));
         if (req && req->rq_repmsg != NULL)
                 reply_body = lustre_msg_buf(req->rq_repmsg, 0,
                                               sizeof(*request_body));
         if (req && req->rq_repmsg != NULL)
                 reply_body = lustre_msg_buf(req->rq_repmsg, 0,
@@ -1361,7 +1363,7 @@ out:
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-int mds_close(struct ptlrpc_request *req)
+int mds_close(struct ptlrpc_request *req, int offset)
 {
         struct mds_export_data *med = &req->rq_export->exp_mds_data;
         struct obd_device *obd = req->rq_export->exp_obd;
 {
         struct mds_export_data *med = &req->rq_export->exp_mds_data;
         struct obd_device *obd = req->rq_export->exp_obd;
@@ -1387,12 +1389,13 @@ int mds_close(struct ptlrpc_request *req)
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                 DEBUG_REQ(D_HA, req, "close replay\n");
                 memcpy(lustre_msg_buf(req->rq_repmsg, 2, 0),
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                 DEBUG_REQ(D_HA, req, "close replay\n");
                 memcpy(lustre_msg_buf(req->rq_repmsg, 2, 0),
-                       lustre_msg_buf(req->rq_reqmsg, 1, 0),
+                       lustre_msg_buf(req->rq_reqmsg, offset + 1, 0),
                        req->rq_repmsg->buflens[2]);
         }
 
 
                        req->rq_repmsg->buflens[2]);
         }
 
 
-        body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
+        body = lustre_swab_reqbuf(req, offset, sizeof(*body),
+                                  lustre_swab_mds_body);
         if (body == NULL) {
                 CERROR("Can't unpack body\n");
                 req->rq_status = -EFAULT;
         if (body == NULL) {
                 CERROR("Can't unpack body\n");
                 req->rq_status = -EFAULT;
@@ -1424,7 +1427,7 @@ int mds_close(struct ptlrpc_request *req)
         spin_unlock(&med->med_open_lock);
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         spin_unlock(&med->med_open_lock);
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        req->rq_status = mds_mfd_close(req, obd, mfd, 1);
+        req->rq_status = mds_mfd_close(req, offset, obd, mfd, 1);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_CLOSE_PACK)) {
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_CLOSE_PACK)) {
@@ -1438,7 +1441,7 @@ int mds_close(struct ptlrpc_request *req)
         RETURN(0);
 }
 
         RETURN(0);
 }
 
-int mds_done_writing(struct ptlrpc_request *req)
+int mds_done_writing(struct ptlrpc_request *req, int offset)
 {
         struct mds_body *body;
         int rc, size = sizeof(struct mds_body);
 {
         struct mds_body *body;
         int rc, size = sizeof(struct mds_body);
@@ -1446,7 +1449,8 @@ int mds_done_writing(struct ptlrpc_request *req)
 
         MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
 
 
         MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
 
-        body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_mds_body);
+        body = lustre_swab_reqbuf(req, offset, sizeof(*body),
+                                  lustre_swab_mds_body);
         if (body == NULL) {
                 CERROR("Can't unpack body\n");
                 req->rq_status = -EFAULT;
         if (body == NULL) {
                 CERROR("Can't unpack body\n");
                 req->rq_status = -EFAULT;
index 1b88793..a8af3c6 100644 (file)
@@ -393,7 +393,7 @@ static int mds_reint_setattr(struct mds_update_record *rec, int offset,
         int rc = 0, cleanup_phase = 0, err, locked = 0;
         ENTRY;
 
         int rc = 0, cleanup_phase = 0, err, locked = 0;
         ENTRY;
 
-        LASSERT(offset == 0);
+        LASSERT(offset == 1);
 
         DEBUG_REQ(D_INODE, req, "setattr "LPU64"/%u %x", rec->ur_fid1->id,
                   rec->ur_fid1->generation, rec->ur_iattr.ia_valid);
 
         DEBUG_REQ(D_INODE, req, "setattr "LPU64"/%u %x", rec->ur_fid1->id,
                   rec->ur_fid1->generation, rec->ur_iattr.ia_valid);
@@ -553,7 +553,7 @@ static void reconstruct_reint_create(struct mds_update_record *rec, int offset,
         LASSERT(!IS_ERR(child));
         if ((child->d_flags & DCACHE_CROSS_REF)) {
                 LASSERTF(child->d_inode == NULL, "BUG 3869\n");
         LASSERT(!IS_ERR(child));
         if ((child->d_flags & DCACHE_CROSS_REF)) {
                 LASSERTF(child->d_inode == NULL, "BUG 3869\n");
-                body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
+                body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
                 mds_pack_dentry2fid(&body->fid1, child);
                 mds_pack_dentry2body(body, child);
                 body->valid |= OBD_MD_MDS;
                 mds_pack_dentry2fid(&body->fid1, child);
                 mds_pack_dentry2body(body, child);
                 body->valid |= OBD_MD_MDS;
@@ -563,7 +563,7 @@ static void reconstruct_reint_create(struct mds_update_record *rec, int offset,
                           rec->ur_name, rec->ur_mode);
                 LASSERTF(child->d_inode != NULL, "BUG 3869\n");
         } else {
                           rec->ur_name, rec->ur_mode);
                 LASSERTF(child->d_inode != NULL, "BUG 3869\n");
         } else {
-                body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
+                body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
                 mds_pack_inode2fid(req2obd(req), &body->fid1, child->d_inode);
                 mds_pack_inode2body(req2obd(req), body, child->d_inode);
         }
                 mds_pack_inode2fid(req2obd(req), &body->fid1, child->d_inode);
                 mds_pack_inode2body(req2obd(req), body, child->d_inode);
         }
@@ -591,7 +591,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
         int mea_size;
         ENTRY;
 
         int mea_size;
         ENTRY;
 
-        LASSERT(offset == 0);
+        LASSERT(offset == 1);
         LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name, LUSTRE_MDS_NAME));
 
         DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %s mode %o",
         LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name, LUSTRE_MDS_NAME));
 
         DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %s mode %o",
@@ -773,8 +773,8 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                         LASSERT(rc == 0);
 
                         /* fill reply */
                         LASSERT(rc == 0);
 
                         /* fill reply */
-                        body = lustre_msg_buf(req->rq_repmsg,
-                                              offset, sizeof (*body));
+                        body = lustre_msg_buf(req->rq_repmsg, 0,
+                                              sizeof (*body));
                         body->valid |= OBD_MD_FLID | OBD_MD_MDS;
                         body->fid1.id = oa->o_id;
                         body->fid1.mds = i;
                         body->valid |= OBD_MD_FLID | OBD_MD_MDS;
                         body->fid1.id = oa->o_id;
                         body->fid1.mds = i;
@@ -882,7 +882,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                 else
                         MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
 
                 else
                         MDS_UPDATE_COUNTER(mds, MDS_CREATE_COUNT);
 
-                body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
+                body = lustre_msg_buf(req->rq_repmsg, 0, sizeof (*body));
                 mds_pack_inode2fid(obd, &body->fid1, inode);
                 mds_pack_inode2body(obd, body, inode);
         }
                 mds_pack_inode2fid(obd, &body->fid1, inode);
                 mds_pack_inode2body(obd, body, inode);
         }
@@ -1564,7 +1564,7 @@ static int mds_reint_unlink_remote(struct mds_update_record *rec, int offset,
         void *handle;
         ENTRY;
 
         void *handle;
         ENTRY;
 
-        LASSERT(offset == 0 || offset == 2);
+        LASSERT(offset == 1 || offset == 3);
 
         DEBUG_REQ(D_INODE, req, "unlink %*s (remote inode %u/%u/%u)",
                   rec->ur_namelen - 1, rec->ur_name, (unsigned)dchild->d_mdsnum,
 
         DEBUG_REQ(D_INODE, req, "unlink %*s (remote inode %u/%u/%u)",
                   rec->ur_namelen - 1, rec->ur_name, (unsigned)dchild->d_mdsnum,
@@ -1641,7 +1641,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
         int update_mode;
         ENTRY;
 
         int update_mode;
         ENTRY;
 
-        LASSERT(offset == 0 || offset == 2);
+        LASSERT(offset == 1 || offset == 3);
 
         DEBUG_REQ(D_INODE, req, "parent ino "LPU64"/%u, child %s",
                   rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name);
 
         DEBUG_REQ(D_INODE, req, "parent ino "LPU64"/%u, child %s",
                   rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name);
@@ -1650,9 +1650,10 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
 
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                 DEBUG_REQ(D_HA, req, "unlink replay\n");
 
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                 DEBUG_REQ(D_HA, req, "unlink replay\n");
-                memcpy(lustre_msg_buf(req->rq_repmsg, offset + 2, 0),
-                       lustre_msg_buf(req->rq_reqmsg, 2, 0),
-                       req->rq_repmsg->buflens[offset + 2]);
+                LASSERT(offset == 1); /* should not come from intent */
+                memcpy(lustre_msg_buf(req->rq_repmsg, 2, 0),
+                       lustre_msg_buf(req->rq_reqmsg, offset + 2, 0),
+                       req->rq_repmsg->buflens[2]);
         }
 
         MDS_UPDATE_COUNTER(mds, MDS_UNLINK_COUNT);
         }
 
         MDS_UPDATE_COUNTER(mds, MDS_UNLINK_COUNT);
@@ -1759,8 +1760,10 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset,
         OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_UNLINK_WRITE, dparent->d_inode->i_sb);
 
         /* ldlm_reply in buf[0] if called via intent */
         OBD_FAIL_WRITE(OBD_FAIL_MDS_REINT_UNLINK_WRITE, dparent->d_inode->i_sb);
 
         /* ldlm_reply in buf[0] if called via intent */
-        if (offset)
+        if (offset == 3)
                 offset = 1;
                 offset = 1;
+        else
+                offset = 0;
 
         body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
         LASSERT(body != NULL);
 
         body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
         LASSERT(body != NULL);
@@ -2101,7 +2104,7 @@ static int mds_reint_link(struct mds_update_record *rec, int offset,
         int update_mode = 0;
         ENTRY;
 
         int update_mode = 0;
         ENTRY;
 
-        LASSERT(offset == 0);
+        LASSERT(offset == 1);
 
         DEBUG_REQ(D_INODE, req, "original "LPU64"/%u to "LPU64"/%u %s",
                   rec->ur_fid1->id, rec->ur_fid1->generation,
 
         DEBUG_REQ(D_INODE, req, "original "LPU64"/%u to "LPU64"/%u %s",
                   rec->ur_fid1->id, rec->ur_fid1->generation,
@@ -2742,7 +2745,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset,
         void *handle = NULL;
         ENTRY;
 
         void *handle = NULL;
         ENTRY;
 
-        LASSERT(offset == 0);
+        LASSERT(offset == 1);
 
         DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u %s to "LPU64"/%u %s",
                   rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
 
         DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u %s to "LPU64"/%u %s",
                   rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
@@ -2753,7 +2756,7 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset,
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                 DEBUG_REQ(D_HA, req, "rename replay\n");
                 memcpy(lustre_msg_buf(req->rq_repmsg, 2, 0),
         if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
                 DEBUG_REQ(D_HA, req, "rename replay\n");
                 memcpy(lustre_msg_buf(req->rq_repmsg, 2, 0),
-                       lustre_msg_buf(req->rq_reqmsg, 3, 0),
+                       lustre_msg_buf(req->rq_reqmsg, offset + 3, 0),
                        req->rq_repmsg->buflens[2]);
         }
 
                        req->rq_repmsg->buflens[2]);
         }
 
index 0dff689..6d39b2b 100644 (file)
@@ -49,11 +49,28 @@ static int mgmt_ping(struct ptlrpc_request *req)
         return lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg);
 }
 
         return lustre_pack_msg(0, NULL, NULL, &req->rq_replen, &req->rq_repmsg);
 }
 
+static int mgmt_msg_check_version(struct lustre_msg *msg)
+{
+        if (lustre_msg_check_version(msg, LUSTRE_OBD_VERSION)) {
+                CERROR("bad opc %u version %08x, expecting %08x\n",
+                       msg->opc, msg->version, LUSTRE_OBD_VERSION);
+                return -EINVAL;
+        }
+
+        return 0;
+}
+
 static int mgmt_handler(struct ptlrpc_request *req)
 {
         int rc;
         ENTRY;
 
 static int mgmt_handler(struct ptlrpc_request *req)
 {
         int rc;
         ENTRY;
 
+        rc = mgmt_msg_check_version(req->rq_reqmsg);
+        if (rc) {
+                CERROR("MGMT drop mal-formed request\n");
+                RETURN(rc);
+        }
+
         switch (req->rq_reqmsg->opc) {
         case OBD_PING:
                 DEBUG_REQ(D_RPCTRACE, req, "ping");
         switch (req->rq_reqmsg->opc) {
         case OBD_PING:
                 DEBUG_REQ(D_RPCTRACE, req, "ping");
index c1a80c4..c4048fb 100644 (file)
@@ -110,7 +110,8 @@ static int oscc_internal_create(struct osc_creator *oscc)
         oscc->oscc_flags |= OSCC_FLAG_CREATING;
         spin_unlock(&oscc->oscc_lock);
 
         oscc->oscc_flags |= OSCC_FLAG_CREATING;
         spin_unlock(&oscc->oscc_lock);
 
-        request = ptlrpc_prep_req(oscc->oscc_obd->u.cli.cl_import, OST_CREATE,
+        request = ptlrpc_prep_req(oscc->oscc_obd->u.cli.cl_import,
+                                  LUSTRE_OBD_VERSION, OST_CREATE,
                                   1, &size, NULL);
         if (request == NULL) {
                 spin_lock(&oscc->oscc_lock);
                                   1, &size, NULL);
         if (request == NULL) {
                 spin_lock(&oscc->oscc_lock);
index 1f84b4b..b2172ce 100644 (file)
@@ -184,8 +184,8 @@ static int osc_getattr_async(struct obd_export *exp, struct obdo *oa,
         struct osc_getattr_async_args *aa;
         ENTRY;
 
         struct osc_getattr_async_args *aa;
         ENTRY;
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_GETATTR, 1,
-                                  &size, NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_GETATTR, 1, &size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -211,8 +211,8 @@ static int osc_getattr(struct obd_export *exp, struct obdo *oa,
         int rc, size = sizeof(*body);
         ENTRY;
 
         int rc, size = sizeof(*body);
         ENTRY;
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_GETATTR, 1,
-                                  &size, NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_GETATTR, 1, &size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -257,8 +257,8 @@ static int osc_setattr(struct obd_export *exp, struct obdo *oa,
 
         LASSERT(!(oa->o_valid & OBD_MD_FLGROUP) || oa->o_gr > 0);
 
 
         LASSERT(!(oa->o_valid & OBD_MD_FLGROUP) || oa->o_gr > 0);
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_SETATTR, 1, &size,
-                                  NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_SETATTR, 1, &size, NULL);
         if (!request)
                RETURN(-ENOMEM);
 
         if (!request)
                RETURN(-ENOMEM);
 
@@ -303,8 +303,8 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa,
                         RETURN(rc);
         }
 
                         RETURN(rc);
         }
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_CREATE, 1, &size,
-                                  NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_CREATE, 1, &size, NULL);
         if (!request)
                 GOTO(out, rc = -ENOMEM);
 
         if (!request)
                 GOTO(out, rc = -ENOMEM);
 
@@ -381,8 +381,8 @@ static int osc_punch(struct obd_export *exp, struct obdo *oa,
                 RETURN(-EINVAL);
         }
 
                 RETURN(-EINVAL);
         }
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_PUNCH, 1, &size,
-                                  NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_PUNCH, 1, &size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -428,8 +428,8 @@ static int osc_sync(struct obd_export *exp, struct obdo *oa,
                 RETURN(-EINVAL);
         }
 
                 RETURN(-EINVAL);
         }
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_SYNC, 1, &size,
-                                  NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_SYNC, 1, &size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -475,8 +475,8 @@ static int osc_destroy(struct obd_export *exp, struct obdo *oa,
                 RETURN(-EINVAL);
         }
 
                 RETURN(-EINVAL);
         }
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_DESTROY, 1,
-                                  &size, NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_DESTROY, 1, &size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -729,7 +729,7 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa,
         size[1] = sizeof(*ioobj);
         size[2] = niocount * sizeof(*niobuf);
 
         size[1] = sizeof(*ioobj);
         size[2] = niocount * sizeof(*niobuf);
 
-        req = ptlrpc_prep_req(imp, opc, 3, size, NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, opc, 3, size, NULL);
         if (req == NULL)
                 return (-ENOMEM);
 
         if (req == NULL)
                 return (-ENOMEM);
 
@@ -2073,8 +2073,8 @@ static int sanosc_brw_read(struct obd_export *exp, struct obdo *oa,
         size[1] = sizeof(struct obd_ioobj);
         size[2] = page_count * sizeof(*nioptr);
 
         size[1] = sizeof(struct obd_ioobj);
         size[2] = page_count * sizeof(*nioptr);
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_SAN_READ, 3,
-                                  size, NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_SAN_READ, 3, size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -2202,8 +2202,8 @@ static int sanosc_brw_write(struct obd_export *exp, struct obdo *oa,
         size[1] = sizeof(struct obd_ioobj);
         size[2] = page_count * sizeof(*nioptr);
 
         size[1] = sizeof(struct obd_ioobj);
         size[2] = page_count * sizeof(*nioptr);
 
-        request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_SAN_WRITE,
-                                  3, size, NULL);
+        request = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                  OST_SAN_WRITE, 3, size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -2532,7 +2532,8 @@ static int osc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
          * during mount that would help a bit).  Having relative timestamps
          * is not so great if request processing is slow, while absolute
          * timestamps are not ideal because they need time synchronization. */
          * during mount that would help a bit).  Having relative timestamps
          * is not so great if request processing is slow, while absolute
          * timestamps are not ideal because they need time synchronization. */
-        request = ptlrpc_prep_req(obd->u.cli.cl_import, OST_STATFS,0,NULL,NULL);
+        request = ptlrpc_prep_req(obd->u.cli.cl_import, LUSTRE_OBD_VERSION,
+                                  OST_STATFS, 0, NULL, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         if (!request)
                 RETURN(-ENOMEM);
 
@@ -2716,8 +2717,8 @@ static int osc_get_info(struct obd_export *exp, obd_count keylen,
                 obd_id *reply;
                 char *bufs[1] = {key};
                 int rc;
                 obd_id *reply;
                 char *bufs[1] = {key};
                 int rc;
-                req = ptlrpc_prep_req(class_exp2cliimp(exp), OST_GET_INFO, 1,
-                                      &keylen, bufs);
+                req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OBD_VERSION,
+                                      OST_GET_INFO, 1, &keylen, bufs);
                 if (req == NULL)
                         RETURN(-ENOMEM);
 
                 if (req == NULL)
                         RETURN(-ENOMEM);
 
index d96936e..0ed4b80 100644 (file)
@@ -923,7 +923,61 @@ static int ost_filter_recovery_request(struct ptlrpc_request *req,
         }
 }
 
         }
 }
 
+int ost_msg_check_version(struct lustre_msg *msg)
+{
+        int rc;
 
 
+        switch(msg->opc) {
+        case OST_CONNECT:
+        case OST_DISCONNECT:
+        case OBD_PING:
+                rc = lustre_msg_check_version(msg, LUSTRE_OBD_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_OBD_VERSION);
+                break;
+        case OST_CREATE:
+        case OST_DESTROY:
+        case OST_GETATTR:
+        case OST_SETATTR:
+        case OST_WRITE:
+        case OST_READ:
+        case OST_SAN_READ:
+        case OST_SAN_WRITE:
+        case OST_PUNCH:
+        case OST_STATFS:
+        case OST_SYNC:
+        case OST_SET_INFO:
+        case OST_GET_INFO:
+                rc = lustre_msg_check_version(msg, LUSTRE_OBD_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_OST_VERSION);
+                break;
+        case LDLM_ENQUEUE:
+        case LDLM_CONVERT:
+        case LDLM_CANCEL:
+        case LDLM_BL_CALLBACK:
+        case LDLM_CP_CALLBACK:
+                rc = lustre_msg_check_version(msg, LUSTRE_DLM_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_DLM_VERSION);
+                break;
+        case OBD_LOG_CANCEL:
+        case LLOG_ORIGIN_CONNECT:
+                rc = lustre_msg_check_version(msg, LUSTRE_LOG_VERSION);
+                if (rc)
+                        CERROR("bad opc %u version %08x, expecting %08x\n",
+                               msg->opc, msg->version, LUSTRE_LOG_VERSION);
+                break;
+        default:
+                CERROR("OST unexpected opcode %d\n", msg->opc);
+                rc = -ENOTSUPP;
+                break;
+        }
+        return rc;
+}
 
 int ost_handle(struct ptlrpc_request *req)
 {
 
 int ost_handle(struct ptlrpc_request *req)
 {
@@ -934,6 +988,13 @@ int ost_handle(struct ptlrpc_request *req)
         ENTRY;
 
         LASSERT(current->journal_info == NULL);
         ENTRY;
 
         LASSERT(current->journal_info == NULL);
+
+        rc = ost_msg_check_version(req->rq_reqmsg);
+        if (rc) {
+                CERROR("OST drop mal-formed request\n");
+                RETURN(rc);
+        }
+
         /* XXX identical to MDS */
         if (req->rq_reqmsg->opc != OST_CONNECT) {
                 struct obd_device *obd;
         /* XXX identical to MDS */
         if (req->rq_reqmsg->opc != OST_CONNECT) {
                 struct obd_device *obd;
index 4b1c5ad..633d64f 100644 (file)
@@ -135,9 +135,11 @@ int ptlbd_cl_connect(struct lustre_handle *conn, struct obd_device *obd,
                 RETURN(rc);
         exp = class_conn2export(conn);
 
                 RETURN(rc);
         exp = class_conn2export(conn);
 
-        request = ptlrpc_prep_req(imp, PTLBD_CONNECT, 3, size, tmp);
+        request = ptlrpc_prep_req(imp, LUSTRE_PBD_VERSION, PTLBD_CONNECT,
+                                  3, size, tmp);
         if (!request)
                 GOTO(out_disco, rc = -ENOMEM);
         if (!request)
                 GOTO(out_disco, rc = -ENOMEM);
+
         request->rq_send_state = LUSTRE_IMP_NEW;
         request->rq_replen = lustre_msg_size(0, NULL);
 
         request->rq_send_state = LUSTRE_IMP_NEW;
         request->rq_replen = lustre_msg_size(0, NULL);
 
@@ -176,7 +178,8 @@ int ptlbd_cl_disconnect(struct obd_export *exp, int failover)
         if (!obd)
                 RETURN(-EINVAL);
 
         if (!obd)
                 RETURN(-EINVAL);
 
-        request = ptlrpc_prep_req(imp, PTLBD_DISCONNECT, 0, NULL, NULL);
+        request = ptlrpc_prep_req(imp, LUSTRE_PBD_VERSION, PTLBD_DISCONNECT,
+                                  0, NULL, NULL);
         if (!request)
                 GOTO(out_req, rc = -ENOMEM);
 
         if (!request)
                 GOTO(out_req, rc = -ENOMEM);
 
index d740710..d4e4747 100644 (file)
@@ -54,7 +54,7 @@ int ptlbd_send_rw_req(struct ptlbd_obd *ptlbd, ptlbd_cmd_t cmd,
         size[0] = sizeof(struct ptlbd_op);
         size[1] = page_count * sizeof(struct ptlbd_niob);
 
         size[0] = sizeof(struct ptlbd_op);
         size[1] = page_count * sizeof(struct ptlbd_niob);
 
-        req = ptlrpc_prep_req(imp, cmd, 2, size, NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_PBD_VERSION, cmd, 2, size, NULL);
         if (!req)
                 RETURN(rc = 1);                  /* need to return error cnt */
 
         if (!req)
                 RETURN(rc = 1);                  /* need to return error cnt */
 
@@ -127,7 +127,7 @@ int ptlbd_send_flush_req(struct ptlbd_obd *ptlbd, ptlbd_cmd_t cmd)
 
         size[0] = sizeof(struct ptlbd_op);
 
 
         size[0] = sizeof(struct ptlbd_op);
 
-        req = ptlrpc_prep_req(imp, cmd, 1, size, NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_PBD_VERSION, cmd, 1, size, NULL);
         if (!req)
                 RETURN(-ENOMEM); 
 
         if (!req)
                 RETURN(-ENOMEM); 
 
index 8540c9f..678934d 100644 (file)
@@ -181,8 +181,9 @@ void ptlrpc_free_bulk(struct ptlrpc_bulk_desc *desc)
         EXIT;
 }
 
         EXIT;
 }
 
-struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, int opcode,
-                                       int count, int *lengths, char **bufs)
+struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, __u32 version,
+                                       int opcode, int count, int *lengths,
+                                       char **bufs)
 {
         struct ptlrpc_request *request;
         int rc;
 {
         struct ptlrpc_request *request;
         int rc;
@@ -202,6 +203,7 @@ struct ptlrpc_request *ptlrpc_prep_req(struct obd_import *imp, int opcode,
                 OBD_FREE(request, sizeof(*request));
                 RETURN(NULL);
         }
                 OBD_FREE(request, sizeof(*request));
                 RETURN(NULL);
         }
+        request->rq_reqmsg->version |= version;
 
         if (imp->imp_server_timeout)
                 request->rq_timeout = obd_timeout / 2;
 
         if (imp->imp_server_timeout)
                 request->rq_timeout = obd_timeout / 2;
index 117b353..5fdf812 100644 (file)
@@ -308,7 +308,8 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid)
 
         }
 
 
         }
 
-        request = ptlrpc_prep_req(imp, imp->imp_connect_op, 4, size, tmp);
+        request = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION,
+                                  imp->imp_connect_op, 4, size, tmp);
         if (!request)
                 GOTO(out, rc = -ENOMEM);
 
         if (!request)
                 GOTO(out, rc = -ENOMEM);
 
@@ -505,7 +506,7 @@ static int signal_completed_replay(struct obd_import *imp)
         LASSERT(atomic_read(&imp->imp_replay_inflight) == 0);
         atomic_inc(&imp->imp_replay_inflight);
 
         LASSERT(atomic_read(&imp->imp_replay_inflight) == 0);
         atomic_inc(&imp->imp_replay_inflight);
 
-        req = ptlrpc_prep_req(imp, OBD_PING, 0, NULL, NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, OBD_PING, 0, NULL, NULL);
         if (!req)
                 RETURN(-ENOMEM);
 
         if (!req)
                 RETURN(-ENOMEM);
 
@@ -633,7 +634,8 @@ int ptlrpc_disconnect_import(struct obd_import *imp)
         }
         spin_unlock_irqrestore(&imp->imp_lock, flags);
 
         }
         spin_unlock_irqrestore(&imp->imp_lock, flags);
 
-        request = ptlrpc_prep_req(imp, rq_opc, 0, NULL, NULL);
+        request = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, rq_opc,
+                                  0, NULL, NULL);
         if (request) {
                 /* For non-replayable connections, don't attempt
                    reconnect if this fails */
         if (request) {
                 /* For non-replayable connections, don't attempt
                    reconnect if this fails */
index b562c0c..aa9107a 100644 (file)
@@ -75,7 +75,8 @@ static int llog_client_open(struct llog_ctxt *ctxt, struct llog_handle **res,
                 bufcount++;
         }
 
                 bufcount++;
         }
 
-        req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_OPEN, bufcount, size,tmp);
+        req = ptlrpc_prep_req(imp, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_OPEN,
+                              bufcount, size,tmp);
         if (!req)
                 GOTO(err_free, rc = -ENOMEM);
 
         if (!req)
                 GOTO(err_free, rc = -ENOMEM);
 
@@ -115,11 +116,12 @@ static int llog_client_prev_block(struct llog_handle *loghandle,
         int repsize[2] = {sizeof (*body)};
         int rc;
         ENTRY;
         int repsize[2] = {sizeof (*body)};
         int rc;
         ENTRY;
-                                                                                                                             
-        req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_PREV_BLOCK, 1,&size,NULL);
+
+        req = ptlrpc_prep_req(imp, LUSTRE_LOG_VERSION,
+                              LLOG_ORIGIN_HANDLE_PREV_BLOCK, 1, &size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
-                                                                                                                             
+
         body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
         body->lgd_logid = loghandle->lgh_id;
         body->lgd_ctxt_idx = loghandle->lgh_ctxt->loc_idx - 1;
         body = lustre_msg_buf(req->rq_reqmsg, 0, sizeof (*body));
         body->lgd_logid = loghandle->lgh_id;
         body->lgd_ctxt_idx = loghandle->lgh_ctxt->loc_idx - 1;
@@ -127,27 +129,26 @@ static int llog_client_prev_block(struct llog_handle *loghandle,
         body->lgd_index = prev_idx;
         body->lgd_len = len;
         repsize[1] = len;
         body->lgd_index = prev_idx;
         body->lgd_len = len;
         repsize[1] = len;
-                                                                                                                             
+
         req->rq_replen = lustre_msg_size(2, repsize);
         rc = ptlrpc_queue_wait(req);
         if (rc)
                 GOTO(out, rc);
         req->rq_replen = lustre_msg_size(2, repsize);
         rc = ptlrpc_queue_wait(req);
         if (rc)
                 GOTO(out, rc);
-                                                                                                                             
+
         body = lustre_swab_repbuf(req, 0, sizeof(*body),
                                  lustre_swab_llogd_body);
         if (body == NULL) {
                 CERROR ("Can't unpack llogd_body\n");
                 GOTO(out, rc =-EFAULT);
         }
         body = lustre_swab_repbuf(req, 0, sizeof(*body),
                                  lustre_swab_llogd_body);
         if (body == NULL) {
                 CERROR ("Can't unpack llogd_body\n");
                 GOTO(out, rc =-EFAULT);
         }
-                                                                                                                             
+
         ptr = lustre_msg_buf(req->rq_repmsg, 1, len);
         if (ptr == NULL) {
                 CERROR ("Can't unpack bitmap\n");
                 GOTO(out, rc =-EFAULT);
         }
         ptr = lustre_msg_buf(req->rq_repmsg, 1, len);
         if (ptr == NULL) {
                 CERROR ("Can't unpack bitmap\n");
                 GOTO(out, rc =-EFAULT);
         }
-                                                                                                                             
+
         memcpy(buf, ptr, len);
         memcpy(buf, ptr, len);
-                                                                                                                             
 out:
         if (req)
                 ptlrpc_req_finished(req);
 out:
         if (req)
                 ptlrpc_req_finished(req);
@@ -167,7 +168,8 @@ static int llog_client_next_block(struct llog_handle *loghandle,
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
-        req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_NEXT_BLOCK, 1,&size,NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_LOG_VERSION,
+                              LLOG_ORIGIN_HANDLE_NEXT_BLOCK, 1, &size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
@@ -223,7 +225,8 @@ static int llog_client_read_header(struct llog_handle *handle)
         int rc;
         ENTRY;
 
         int rc;
         ENTRY;
 
-        req = ptlrpc_prep_req(imp, LLOG_ORIGIN_HANDLE_READ_HEADER,1,&size,NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_LOG_VERSION,
+                              LLOG_ORIGIN_HANDLE_READ_HEADER, 1, &size, NULL);
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
         if (!req)
                 GOTO(out, rc = -ENOMEM);
 
index 9671976..47205a5 100644 (file)
@@ -79,12 +79,12 @@ int llog_origin_connect(struct llog_ctxt *ctxt, int count,
         LASSERT(ctxt->loc_imp);
         imp = ctxt->loc_imp;
 
         LASSERT(ctxt->loc_imp);
         imp = ctxt->loc_imp;
 
-        request = ptlrpc_prep_req(imp, LLOG_ORIGIN_CONNECT, 1, &size, NULL);
+        request = ptlrpc_prep_req(imp, LUSTRE_LOG_VERSION, LLOG_ORIGIN_CONNECT,
+                                  1, &size, NULL);
         if (!request)
                 RETURN(-ENOMEM);
 
         req_body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof(*req_body));
         if (!request)
                 RETURN(-ENOMEM);
 
         req_body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof(*req_body));
-
         req_body->lgdc_gen = ctxt->loc_gen;
         req_body->lgdc_logid = ctxt->loc_handle->lgh_id;
         req_body->lgdc_ctxt_idx = ctxt->loc_idx + 1;
         req_body->lgdc_gen = ctxt->loc_gen;
         req_body->lgdc_logid = ctxt->loc_handle->lgh_id;
         req_body->lgdc_ctxt_idx = ctxt->loc_idx + 1;
index 9e23211..cb7944d 100644 (file)
@@ -44,6 +44,14 @@ int lustre_msg_swabbed(struct lustre_msg *msg)
         return (msg->magic == __swab32(PTLRPC_MSG_MAGIC));
 }
 
         return (msg->magic == __swab32(PTLRPC_MSG_MAGIC));
 }
 
+int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
+{
+        if (!lustre_msg_swabbed(msg))
+                return (msg->version & LUSTRE_VERSION_MASK) != version;
+
+        return (__swab32(msg->version) & LUSTRE_VERSION_MASK) != version;
+}
+
 void lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs)
 {
         char *ptr;
 void lustre_init_msg (struct lustre_msg *msg, int count, int *lens, char **bufs)
 {
         char *ptr;
@@ -199,7 +207,7 @@ int lustre_unpack_msg(struct lustre_msg *m, int len)
                 RETURN (-EINVAL);
         }
 
                 RETURN (-EINVAL);
         }
 
-        if (m->version != PTLRPC_MSG_VERSION) {
+        if ((m->version & ~LUSTRE_VERSION_MASK) != PTLRPC_MSG_VERSION) {
                 CERROR("wrong lustre_msg version %#08x\n", m->version);
                 RETURN (-EINVAL);
         }
                 CERROR("wrong lustre_msg version %#08x\n", m->version);
                 RETURN (-EINVAL);
         }
@@ -385,15 +393,11 @@ void *mdc_create_pack(struct lustre_msg *msg, int offset,
         rec = lustre_msg_buf(msg, offset, sizeof (*rec));
 
         rec->cr_opcode = REINT_CREATE;
         rec = lustre_msg_buf(msg, offset, sizeof (*rec));
 
         rec->cr_opcode = REINT_CREATE;
-        rec->cr_fsuid = current->fsuid;
-        rec->cr_fsgid = current->fsgid;
-        rec->cr_cap = current->cap_effective;
         rec->cr_fid = op_data->fid1;
         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
         rec->cr_mode = mode;
         rec->cr_rdev = rdev;
         rec->cr_time = op_data->mod_time;
         rec->cr_fid = op_data->fid1;
         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
         rec->cr_mode = mode;
         rec->cr_rdev = rdev;
         rec->cr_time = op_data->mod_time;
-        rec->cr_suppgid = op_data->ctxt.gid1;
 
         tmp = lustre_msg_buf(msg, offset + 1, op_data->namelen + 1);
         LOGL0(op_data->name, op_data->namelen, tmp);
 
         tmp = lustre_msg_buf(msg, offset + 1, op_data->namelen + 1);
         LOGL0(op_data->name, op_data->namelen, tmp);
@@ -405,17 +409,14 @@ void *mdc_create_pack(struct lustre_msg *msg, int offset,
         return ((void*)tmp + size_round(datalen));
 }
 
         return ((void*)tmp + size_round(datalen));
 }
 
-void *mdc_setattr_pack(struct lustre_msg *msg, struct mdc_op_data *data,
-                       struct iattr *iattr, void *ea, int ealen,
-                       void *ea2, int ea2len)
+void *mdc_setattr_pack(struct lustre_msg *msg, int offset,
+                       struct mdc_op_data *data, struct iattr *iattr,
+                       void *ea, int ealen, void *ea2, int ea2len)
 {
 {
-        struct mds_rec_setattr *rec = lustre_msg_buf(msg, 0, sizeof (*rec));
+        struct mds_rec_setattr *rec = lustre_msg_buf(msg, offset, sizeof(*rec));
         char *tmp = NULL;
 
         rec->sa_opcode = REINT_SETATTR;
         char *tmp = NULL;
 
         rec->sa_opcode = REINT_SETATTR;
-        rec->sa_fsuid = current->fsuid;
-        rec->sa_fsgid = current->fsgid;
-        rec->sa_cap = current->cap_effective;
         rec->sa_fid = data->fid1;
 
         if (iattr) {
         rec->sa_fid = data->fid1;
 
         if (iattr) {
@@ -428,14 +429,6 @@ void *mdc_setattr_pack(struct lustre_msg *msg, struct mdc_op_data *data,
                 rec->sa_mtime = LTIME_S(iattr->ia_mtime);
                 rec->sa_ctime = LTIME_S(iattr->ia_ctime);
                 rec->sa_attr_flags = iattr->ia_attr_flags;
                 rec->sa_mtime = LTIME_S(iattr->ia_mtime);
                 rec->sa_ctime = LTIME_S(iattr->ia_ctime);
                 rec->sa_attr_flags = iattr->ia_attr_flags;
-                if ((iattr->ia_valid & ATTR_GID) && in_group_p(iattr->ia_gid))
-                        rec->sa_suppgid = iattr->ia_gid;
-                else if ((iattr->ia_valid & ATTR_MODE) &&
-                         in_group_p(iattr->ia_gid))
-                        rec->sa_suppgid = data->ctxt.gid1;
-                else if ((iattr->ia_valid & (ATTR_MTIME|ATTR_CTIME)) &&
-                         data->ctxt.gid1 != -1)
-                        rec->sa_suppgid = data->ctxt.gid1;
         }
         tmp = (char*)rec + size_round(sizeof(*rec));
                 
         }
         tmp = (char*)rec + size_round(sizeof(*rec));
                 
@@ -465,11 +458,7 @@ void *mdc_unlink_pack(struct lustre_msg *msg, int offset,
         LASSERT (rec != NULL);
 
         rec->ul_opcode = REINT_UNLINK;
         LASSERT (rec != NULL);
 
         rec->ul_opcode = REINT_UNLINK;
-        rec->ul_fsuid = current->fsuid;
-        rec->ul_fsgid = current->fsgid;
-        rec->ul_cap = current->cap_effective;
         rec->ul_mode = data->create_mode;
         rec->ul_mode = data->create_mode;
-        rec->ul_suppgid = data->ctxt.gid1;
         rec->ul_fid1 = data->fid1;
         rec->ul_fid2 = data->fid2;
         rec->ul_time = data->mod_time;
         rec->ul_fid1 = data->fid1;
         rec->ul_fid2 = data->fid2;
         rec->ul_time = data->mod_time;
@@ -489,11 +478,6 @@ void *mdc_link_pack(struct lustre_msg *msg, int offset,
         rec = lustre_msg_buf(msg, offset, sizeof (*rec));
 
         rec->lk_opcode = REINT_LINK;
         rec = lustre_msg_buf(msg, offset, sizeof (*rec));
 
         rec->lk_opcode = REINT_LINK;
-        rec->lk_fsuid = current->fsuid;
-        rec->lk_fsgid = current->fsgid;
-        rec->lk_cap = current->cap_effective;
-        rec->lk_suppgid1 = data->ctxt.gid1;
-        rec->lk_suppgid2 = data->ctxt.gid2;
         rec->lk_fid1 = data->fid1;
         rec->lk_fid2 = data->fid2;
         rec->lk_time = data->mod_time;
         rec->lk_fid1 = data->fid1;
         rec->lk_fid2 = data->fid2;
         rec->lk_time = data->mod_time;
@@ -515,17 +499,6 @@ void *mdc_rename_pack(struct lustre_msg *msg, int offset,
 
         /* XXX do something about time, uid, gid */
         rec->rn_opcode = REINT_RENAME;
 
         /* XXX do something about time, uid, gid */
         rec->rn_opcode = REINT_RENAME;
-        rec->rn_fsuid = current->fsuid;
-        rec->rn_fsgid = current->fsgid;
-        rec->rn_cap = current->cap_effective;
-        if (in_group_p(data->ctxt.gid1))
-                rec->rn_suppgid1 = data->ctxt.gid1;
-        else
-                rec->rn_suppgid1 = -1;
-        if (in_group_p(data->ctxt.gid2))
-                rec->rn_suppgid2 = data->ctxt.gid2;
-        else
-                rec->rn_suppgid2 = -1;
         rec->rn_fid1 = data->fid1;
         rec->rn_fid2 = data->fid2;
         rec->rn_time = data->mod_time;
         rec->rn_fid1 = data->fid1;
         rec->rn_fid2 = data->fid2;
         rec->rn_time = data->mod_time;
@@ -600,6 +573,47 @@ void lustre_swab_mds_status_req (struct mds_status_req *r)
         __swab32s (&r->repbuf);
 }
 
         __swab32s (&r->repbuf);
 }
 
+/* 
+ * because sec_desc is variable buffer, we must check it by hand
+ */
+struct mds_req_sec_desc *lustre_swab_mds_secdesc(struct ptlrpc_request *req,
+                                                 int offset)
+{
+        struct mds_req_sec_desc *rsd;
+        struct lustre_msg *m;
+        __u32 i;
+
+        LASSERT_REQSWAB(req, offset);
+
+        m = req->rq_reqmsg;
+        rsd = lustre_msg_buf(m, offset, sizeof(*rsd));
+        if (!rsd)
+                return NULL;
+
+        if (lustre_msg_swabbed(m)) {
+                __swab32s(&rsd->rsd_uid);
+                __swab32s(&rsd->rsd_gid);
+                __swab32s(&rsd->rsd_fsuid);
+                __swab32s(&rsd->rsd_fsgid);
+                __swab32s(&rsd->rsd_cap);
+                __swab32s(&rsd->rsd_ngroups);
+        }
+
+        if (m->buflens[offset] !=
+            sizeof(*rsd) + rsd->rsd_ngroups * sizeof(__u32)) {
+                CERROR("bufflen %u while contains %u groups\n",
+                        m->buflens[offset], rsd->rsd_ngroups);
+                return NULL;
+        }
+
+        if (lustre_msg_swabbed(m)) {
+                for (i = 0; i < rsd->rsd_ngroups; i++)
+                        __swab32s(&rsd->rsd_groups[i]);
+        }
+
+        return rsd;
+}
+
 void lustre_swab_mds_body (struct mds_body *b)
 {
         lustre_swab_ll_fid (&b->fid1);
 void lustre_swab_mds_body (struct mds_body *b)
 {
         lustre_swab_ll_fid (&b->fid1);
@@ -609,9 +623,6 @@ void lustre_swab_mds_body (struct mds_body *b)
         __swab64s (&b->blocks);
         __swab32s (&b->ino);
         __swab32s (&b->valid);
         __swab64s (&b->blocks);
         __swab32s (&b->ino);
         __swab32s (&b->valid);
-        __swab32s (&b->fsuid);
-        __swab32s (&b->fsgid);
-        __swab32s (&b->capability);
         __swab32s (&b->mode);
         __swab32s (&b->uid);
         __swab32s (&b->gid);
         __swab32s (&b->mode);
         __swab32s (&b->uid);
         __swab32s (&b->gid);
@@ -622,8 +633,8 @@ void lustre_swab_mds_body (struct mds_body *b)
         __swab32s (&b->rdev);
         __swab32s (&b->nlink);
         __swab32s (&b->generation);
         __swab32s (&b->rdev);
         __swab32s (&b->nlink);
         __swab32s (&b->generation);
-        __swab32s (&b->suppgid);
         __swab32s (&b->eadatasize);
         __swab32s (&b->eadatasize);
+        __swab32s (&b->mds);
 }
 void lustre_swab_clonefs_info (struct clonefs_info *clone)
 {
 }
 void lustre_swab_clonefs_info (struct clonefs_info *clone)
 {
@@ -633,10 +644,6 @@ void lustre_swab_clonefs_info (struct clonefs_info *clone)
 void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa)
 {
         __swab32s (&sa->sa_opcode);
 void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa)
 {
         __swab32s (&sa->sa_opcode);
-        __swab32s (&sa->sa_fsuid);
-        __swab32s (&sa->sa_fsgid);
-        __swab32s (&sa->sa_cap);
-        __swab32s (&sa->sa_suppgid);
         __swab32s (&sa->sa_valid);
         lustre_swab_ll_fid (&sa->sa_fid);
         __swab32s (&sa->sa_mode);
         __swab32s (&sa->sa_valid);
         lustre_swab_ll_fid (&sa->sa_fid);
         __swab32s (&sa->sa_mode);
@@ -652,26 +659,17 @@ void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa)
 void lustre_swab_mds_rec_create (struct mds_rec_create *cr)
 {
         __swab32s (&cr->cr_opcode);
 void lustre_swab_mds_rec_create (struct mds_rec_create *cr)
 {
         __swab32s (&cr->cr_opcode);
-        __swab32s (&cr->cr_fsuid);
-        __swab32s (&cr->cr_fsgid);
-        __swab32s (&cr->cr_cap);
         __swab32s (&cr->cr_flags); /* for use with open */
         __swab32s (&cr->cr_mode);
         lustre_swab_ll_fid (&cr->cr_fid);
         lustre_swab_ll_fid (&cr->cr_replayfid);
         __swab64s (&cr->cr_time);
         __swab64s (&cr->cr_rdev);
         __swab32s (&cr->cr_flags); /* for use with open */
         __swab32s (&cr->cr_mode);
         lustre_swab_ll_fid (&cr->cr_fid);
         lustre_swab_ll_fid (&cr->cr_replayfid);
         __swab64s (&cr->cr_time);
         __swab64s (&cr->cr_rdev);
-        __swab32s (&cr->cr_suppgid);
 }
 
 void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
 {
         __swab32s (&lk->lk_opcode);
 }
 
 void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
 {
         __swab32s (&lk->lk_opcode);
-        __swab32s (&lk->lk_fsuid);
-        __swab32s (&lk->lk_fsgid);
-        __swab32s (&lk->lk_cap);
-        __swab32s (&lk->lk_suppgid1);
-        __swab32s (&lk->lk_suppgid2);
         lustre_swab_ll_fid (&lk->lk_fid1);
         lustre_swab_ll_fid (&lk->lk_fid2);
 }
         lustre_swab_ll_fid (&lk->lk_fid1);
         lustre_swab_ll_fid (&lk->lk_fid2);
 }
@@ -679,10 +677,6 @@ void lustre_swab_mds_rec_link (struct mds_rec_link *lk)
 void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
 {
         __swab32s (&ul->ul_opcode);
 void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
 {
         __swab32s (&ul->ul_opcode);
-        __swab32s (&ul->ul_fsuid);
-        __swab32s (&ul->ul_fsgid);
-        __swab32s (&ul->ul_cap);
-        __swab32s (&ul->ul_suppgid);
         __swab32s (&ul->ul_mode);
         lustre_swab_ll_fid (&ul->ul_fid1);
         lustre_swab_ll_fid (&ul->ul_fid2);
         __swab32s (&ul->ul_mode);
         lustre_swab_ll_fid (&ul->ul_fid1);
         lustre_swab_ll_fid (&ul->ul_fid2);
@@ -691,11 +685,6 @@ void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul)
 void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn)
 {
         __swab32s (&rn->rn_opcode);
 void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn)
 {
         __swab32s (&rn->rn_opcode);
-        __swab32s (&rn->rn_fsuid);
-        __swab32s (&rn->rn_fsgid);
-        __swab32s (&rn->rn_cap);
-        __swab32s (&rn->rn_suppgid1);
-        __swab32s (&rn->rn_suppgid2);
         lustre_swab_ll_fid (&rn->rn_fid1);
         lustre_swab_ll_fid (&rn->rn_fid2);
 }
         lustre_swab_ll_fid (&rn->rn_fid1);
         lustre_swab_ll_fid (&rn->rn_fid2);
 }
@@ -837,7 +826,7 @@ void lustre_swab_llogd_conn_body (struct llogd_conn_body *d)
 void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
 void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
-         * running on Linux firefly.localdomain 2.6.7 #1 Wed Jun 16 10:50:27 EEST 2004 i686 i686 i386
+         * running on Linux build 2.4.24-cmd #1 SMP Wed Aug 18 14:24:44 MDT 2004 i686 i686 i386 GNU/L
          * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
 
 
          * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
 
 
@@ -1152,6 +1141,14 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct obdo, o_easize));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_easize));
                  (long long)(int)offsetof(struct obdo, o_easize));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_easize));
+        LASSERTF((int)offsetof(struct obdo, o_mds) == 104, " found %lld\n",
+                 (long long)(int)offsetof(struct obdo, o_mds));
+        LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct obdo *)0)->o_mds));
+        LASSERTF((int)offsetof(struct obdo, o_padding) == 108, " found %lld\n",
+                 (long long)(int)offsetof(struct obdo, o_padding));
+        LASSERTF((int)sizeof(((struct obdo *)0)->o_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct obdo *)0)->o_padding));
         LASSERTF((int)offsetof(struct obdo, o_inline) == 112, " found %lld\n",
                  (long long)(int)offsetof(struct obdo, o_inline));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n",
         LASSERTF((int)offsetof(struct obdo, o_inline) == 112, " found %lld\n",
                  (long long)(int)offsetof(struct obdo, o_inline));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n",
@@ -1398,7 +1395,7 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf));
 
         /* Checks for struct mds_body */
                  (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf));
 
         /* Checks for struct mds_body */
-        LASSERTF((int)sizeof(struct mds_body) == 152, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_body) == 136, " found %lld\n",
                  (long long)(int)sizeof(struct mds_body));
         LASSERTF((int)offsetof(struct mds_body, fid1) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, fid1));
                  (long long)(int)sizeof(struct mds_body));
         LASSERTF((int)offsetof(struct mds_body, fid1) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, fid1));
@@ -1432,66 +1429,54 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct mds_body, valid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->valid));
                  (long long)(int)offsetof(struct mds_body, valid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->valid));
-        LASSERTF((int)offsetof(struct mds_body, fsuid) == 88, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, fsuid));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->fsuid));
-        LASSERTF((int)offsetof(struct mds_body, fsgid) == 92, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, fsgid));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->fsgid));
-        LASSERTF((int)offsetof(struct mds_body, capability) == 96, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, capability));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->capability) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->capability));
-        LASSERTF((int)offsetof(struct mds_body, mode) == 100, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, mode) == 88, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, mode));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mode));
                  (long long)(int)offsetof(struct mds_body, mode));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mode));
-        LASSERTF((int)offsetof(struct mds_body, uid) == 104, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, uid) == 92, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, uid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->uid));
                  (long long)(int)offsetof(struct mds_body, uid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->uid));
-        LASSERTF((int)offsetof(struct mds_body, gid) == 108, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, gid) == 96, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, gid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->gid));
                  (long long)(int)offsetof(struct mds_body, gid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->gid));
-        LASSERTF((int)offsetof(struct mds_body, mtime) == 112, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, mtime) == 100, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, mtime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mtime));
                  (long long)(int)offsetof(struct mds_body, mtime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mtime));
-        LASSERTF((int)offsetof(struct mds_body, ctime) == 116, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, ctime) == 104, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, ctime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->ctime));
                  (long long)(int)offsetof(struct mds_body, ctime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->ctime));
-        LASSERTF((int)offsetof(struct mds_body, atime) == 120, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, atime) == 108, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, atime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->atime));
                  (long long)(int)offsetof(struct mds_body, atime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->atime));
-        LASSERTF((int)offsetof(struct mds_body, flags) == 124, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, flags) == 112, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, flags));
         LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->flags));
                  (long long)(int)offsetof(struct mds_body, flags));
         LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->flags));
-        LASSERTF((int)offsetof(struct mds_body, rdev) == 128, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, rdev) == 116, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, rdev));
         LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->rdev));
                  (long long)(int)offsetof(struct mds_body, rdev));
         LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->rdev));
-        LASSERTF((int)offsetof(struct mds_body, nlink) == 132, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, nlink) == 120, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, nlink));
         LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->nlink));
                  (long long)(int)offsetof(struct mds_body, nlink));
         LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->nlink));
-        LASSERTF((int)offsetof(struct mds_body, generation) == 136, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, generation) == 124, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, generation));
         LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->generation));
                  (long long)(int)offsetof(struct mds_body, generation));
         LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->generation));
-        LASSERTF((int)offsetof(struct mds_body, suppgid) == 140, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, suppgid));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->suppgid));
-        LASSERTF((int)offsetof(struct mds_body, eadatasize) == 144, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, eadatasize) == 128, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, eadatasize));
         LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->eadatasize));
                  (long long)(int)offsetof(struct mds_body, eadatasize));
         LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->eadatasize));
+        LASSERTF((int)offsetof(struct mds_body, mds) == 132, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_body, mds));
+        LASSERTF((int)sizeof(((struct mds_body *)0)->mds) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_body *)0)->mds));
         LASSERTF(FMODE_READ == 1, " found %lld\n",
                  (long long)FMODE_READ);
         LASSERTF(FMODE_WRITE == 2, " found %lld\n",
         LASSERTF(FMODE_READ == 1, " found %lld\n",
                  (long long)FMODE_READ);
         LASSERTF(FMODE_WRITE == 2, " found %lld\n",
@@ -1516,233 +1501,157 @@ void lustre_assert_wire_constants(void)
                  (long long)MDS_OPEN_HAS_EA);
 
         /* Checks for struct mds_rec_setattr */
                  (long long)MDS_OPEN_HAS_EA);
 
         /* Checks for struct mds_rec_setattr */
-        LASSERTF((int)sizeof(struct mds_rec_setattr) == 96, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_setattr) == 80, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_setattr));
         LASSERTF((int)offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode));
                  (long long)(int)sizeof(struct mds_rec_setattr));
         LASSERTF((int)offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_cap));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_suppgid) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_suppgid));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_valid) == 20, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_valid) == 4, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_valid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_valid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fid) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fid) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_fid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_fid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mode) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mode) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_uid) == 52, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_uid) == 36, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_uid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_uid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_gid) == 56, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_gid) == 40, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_gid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_gid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_attr_flags) == 60, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_attr_flags) == 44, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_size) == 64, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_size) == 48, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_size));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_size));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_atime) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_atime) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_atime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_atime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mtime) == 80, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mtime) == 64, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mtime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mtime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_ctime) == 88, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_ctime) == 72, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_ctime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime));
 
         /* Checks for struct mds_rec_create */
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_ctime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime));
 
         /* Checks for struct mds_rec_create */
-        LASSERTF((int)sizeof(struct mds_rec_create) == 96, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_create) == 80, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_create));
         LASSERTF((int)offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode));
                  (long long)(int)sizeof(struct mds_rec_create));
         LASSERTF((int)offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_cap));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_flags) == 16, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_flags) == 4, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags));
                  (long long)(int)offsetof(struct mds_rec_create, cr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_mode) == 20, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_mode) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_mode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode));
                  (long long)(int)offsetof(struct mds_rec_create, cr_mode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_fid) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_padding) == 12, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_rec_create, cr_padding));
+        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_padding));
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_fid) == 16, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_fid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid));
                  (long long)(int)offsetof(struct mds_rec_create, cr_fid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_replayfid) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_replayfid) == 40, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_replayfid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid));
                  (long long)(int)offsetof(struct mds_rec_create, cr_replayfid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_time) == 64, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_time));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time));
                  (long long)(int)offsetof(struct mds_rec_create, cr_time));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_rdev) == 80, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_rdev) == 72, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_rdev));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev));
                  (long long)(int)offsetof(struct mds_rec_create, cr_rdev));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_suppgid) == 88, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_suppgid));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_suppgid));
 
         /* Checks for struct mds_rec_link */
 
         /* Checks for struct mds_rec_link */
-        LASSERTF((int)sizeof(struct mds_rec_link) == 80, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_link) == 64, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_link));
         LASSERTF((int)offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode));
                  (long long)(int)sizeof(struct mds_rec_link));
         LASSERTF((int)offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_cap));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_suppgid1) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_suppgid1));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_suppgid2) == 20, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_suppgid2));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid1) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_padding) == 4, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_rec_link, lk_padding));
+        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_padding));
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid1) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1));
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid2) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid2) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2));
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_time) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_time));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time));
 
         /* Checks for struct mds_rec_unlink */
                  (long long)(int)offsetof(struct mds_rec_link, lk_time));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time));
 
         /* Checks for struct mds_rec_unlink */
-        LASSERTF((int)sizeof(struct mds_rec_unlink) == 80, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_unlink) == 64, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_unlink));
         LASSERTF((int)offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode));
                  (long long)(int)sizeof(struct mds_rec_unlink));
         LASSERTF((int)offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_cap));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_suppgid) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_suppgid));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_mode) == 20, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_mode) == 4, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_mode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode));
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_mode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid1) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid1) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1));
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid2) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid2) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2));
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_time) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_time));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time));
 
         /* Checks for struct mds_rec_rename */
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_time));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time));
 
         /* Checks for struct mds_rec_rename */
-        LASSERTF((int)sizeof(struct mds_rec_rename) == 80, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_rename) == 64, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_rename));
         LASSERTF((int)offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode));
                  (long long)(int)sizeof(struct mds_rec_rename));
         LASSERTF((int)offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_cap));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_suppgid1) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_suppgid1));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_suppgid2) == 20, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_suppgid2));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid1) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_padding) == 4, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_rec_rename, rn_padding));
+        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_padding));
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid1) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1));
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid2) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid2) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2));
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_time) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_time));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time));
                  (long long)(int)offsetof(struct mds_rec_rename, rn_time));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time));
@@ -2305,3 +2214,4 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx));
 }
         LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx));
 }
+
index 2659d7e..7fab9b9 100644 (file)
@@ -44,20 +44,18 @@ int ptlrpc_ping(struct obd_import *imp)
         int rc = 0;
         ENTRY;
 
         int rc = 0;
         ENTRY;
 
-        req = ptlrpc_prep_req(imp, OBD_PING, 0, NULL,
-                              NULL);
+        req = ptlrpc_prep_req(imp, LUSTRE_OBD_VERSION, OBD_PING, 0, NULL, NULL);
         if (req) {
                 DEBUG_REQ(D_HA, req, "pinging %s->%s",
                           imp->imp_obd->obd_uuid.uuid,
                           imp->imp_target_uuid.uuid);
                 req->rq_no_resend = req->rq_no_delay = 1;
         if (req) {
                 DEBUG_REQ(D_HA, req, "pinging %s->%s",
                           imp->imp_obd->obd_uuid.uuid,
                           imp->imp_target_uuid.uuid);
                 req->rq_no_resend = req->rq_no_delay = 1;
-                req->rq_replen = lustre_msg_size(0, 
-                                                 NULL);
+                req->rq_replen = lustre_msg_size(0, NULL);
                 ptlrpcd_add_req(req);
         } else {
                 CERROR("OOM trying to ping %s->%s\n",
                 ptlrpcd_add_req(req);
         } else {
                 CERROR("OOM trying to ping %s->%s\n",
-                          imp->imp_obd->obd_uuid.uuid,
-                          imp->imp_target_uuid.uuid);
+                       imp->imp_obd->obd_uuid.uuid,
+                       imp->imp_target_uuid.uuid);
                 rc = -ENOMEM;
         }
 
                 rc = -ENOMEM;
         }
 
index cfd1ad2..430eba3 100644 (file)
@@ -147,6 +147,7 @@ EXPORT_SYMBOL(ptlrpc_daemonize);
 
 /* pack_generic.c */
 EXPORT_SYMBOL(lustre_msg_swabbed);
 
 /* pack_generic.c */
 EXPORT_SYMBOL(lustre_msg_swabbed);
+EXPORT_SYMBOL(lustre_msg_check_version);
 EXPORT_SYMBOL(lustre_pack_request);
 EXPORT_SYMBOL(lustre_pack_reply);
 EXPORT_SYMBOL(lustre_free_reply_state);
 EXPORT_SYMBOL(lustre_pack_request);
 EXPORT_SYMBOL(lustre_pack_reply);
 EXPORT_SYMBOL(lustre_free_reply_state);
@@ -167,6 +168,7 @@ EXPORT_SYMBOL(lustre_swab_ost_last_id);
 EXPORT_SYMBOL(lustre_swab_ost_lvb);
 EXPORT_SYMBOL(lustre_swab_ll_fid);
 EXPORT_SYMBOL(lustre_swab_mds_status_req);
 EXPORT_SYMBOL(lustre_swab_ost_lvb);
 EXPORT_SYMBOL(lustre_swab_ll_fid);
 EXPORT_SYMBOL(lustre_swab_mds_status_req);
+EXPORT_SYMBOL(lustre_swab_mds_secdesc);
 EXPORT_SYMBOL(lustre_swab_mds_body);
 EXPORT_SYMBOL(lustre_swab_mds_rec_setattr);
 EXPORT_SYMBOL(lustre_swab_mds_rec_create);
 EXPORT_SYMBOL(lustre_swab_mds_body);
 EXPORT_SYMBOL(lustre_swab_mds_rec_setattr);
 EXPORT_SYMBOL(lustre_swab_mds_rec_create);
index 305789f..c317270 100644 (file)
@@ -341,7 +341,8 @@ static int log_commit_thread(void *arg)
                                 continue;
                         }
 
                                 continue;
                         }
 
-                        request = ptlrpc_prep_req(import, OBD_LOG_CANCEL, 1,
+                        request = ptlrpc_prep_req(import, LUSTRE_LOG_VERSION,
+                                                  OBD_LOG_CANCEL, 1,
                                                   &llcd->llcd_cookiebytes,
                                                   bufs);
                         up(&llcd->llcd_ctxt->loc_sem);
                                                   &llcd->llcd_cookiebytes,
                                                   bufs);
                         up(&llcd->llcd_ctxt->loc_sem);
index 8238b4c..7bc87d7 100644 (file)
@@ -103,7 +103,7 @@ static int mds_rec_setattr_pack(char *buffer, struct dentry *dentry,
         msg = (struct lustre_msg *)(buffer + sizeof(*mkpi));
         lustre_init_msg(msg, mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
 
         msg = (struct lustre_msg *)(buffer + sizeof(*mkpi));
         lustre_init_msg(msg, mkpi->mpi_bufcount, mkpi->mpi_size, NULL);
 
-        tmp = mdc_setattr_pack(msg, &op_data, iattr, ea, ealen, NULL, 0);
+        tmp = mdc_setattr_pack(msg, 0, &op_data, iattr, ea, ealen, NULL, 0);
 
         /*There are maybe some better ways
          *to set the time attr FIXME WANGDI later
 
         /*There are maybe some better ways
          *to set the time attr FIXME WANGDI later
diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh
new file mode 100644 (file)
index 0000000..09431e4
--- /dev/null
@@ -0,0 +1,272 @@
+#!/bin/bash
+#
+# Run select tests by setting ONLY, or as arguments to the script.
+# Skip specific tests by setting EXCEPT.
+#
+# e.g. ONLY="22 23" or ONLY="`seq 32 39`" or EXCEPT="31"
+set -e
+
+ONLY=${ONLY:-"$*"}
+ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-""}
+# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
+
+[ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
+
+SRCDIR=`dirname $0`
+export PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
+
+TMP=${TMP:-/tmp}
+FSTYPE=${FSTYPE:-ext3}
+
+CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
+CREATETEST=${CREATETEST:-createtest}
+LFS=${LFS:-lfs}
+LSTRIPE=${LSTRIPE:-"$LFS setstripe"}
+LFIND=${LFIND:-"$LFS find"}
+LVERIFY=${LVERIFY:-ll_dirstripe_verify}
+LCTL=${LCTL:-lctl}
+MCREATE=${MCREATE:-mcreate}
+OPENFILE=${OPENFILE:-openfile}
+OPENUNLINK=${OPENUNLINK:-openunlink}
+TOEXCL=${TOEXCL:-toexcl}
+TRUNCATE=${TRUNCATE:-truncate}
+MUNLINK=${MUNLINK:-munlink}
+SOCKETSERVER=${SOCKETSERVER:-socketserver}
+SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
+IOPENTEST1=${IOPENTEST1:-iopentest1}
+IOPENTEST2=${IOPENTEST2:-iopentest2}
+
+if [ $UID -ne 0 ]; then
+       RUNAS_ID="$UID"
+       RUNAS=""
+else
+       RUNAS_ID=${RUNAS_ID:-500}
+       RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
+fi
+
+export NAME=${NAME:-local}
+
+SAVE_PWD=$PWD
+
+clean() {
+       echo -n "cln.."
+       sh llmountcleanup.sh > /dev/null || exit 20
+       I_MOUNTED=no
+}
+CLEAN=${CLEAN:-clean}
+
+start() {
+       echo -n "mnt.."
+       sh llrmount.sh > /dev/null || exit 10
+       I_MOUNTED=yes
+       echo "done"
+}
+START=${START:-start}
+
+log() {
+       echo "$*"
+       lctl mark "$*" 2> /dev/null || true
+}
+
+trace() {
+       log "STARTING: $*"
+       strace -o $TMP/$1.strace -ttt $*
+       RC=$?
+       log "FINISHED: $*: rc $RC"
+       return 1
+}
+TRACE=${TRACE:-""}
+
+check_kernel_version() {
+       VERSION_FILE=/proc/fs/lustre/kernel_version
+       WANT_VER=$1
+       [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1
+       GOT_VER=`cat $VERSION_FILE`
+       [ $GOT_VER -ge $WANT_VER ] && return 0
+       log "test needs at least kernel version $WANT_VER, running $GOT_VER"
+       return 1
+}
+
+run_one() {
+       if ! mount | grep -q $DIR; then
+               $START
+       fi
+       echo -1 >/proc/sys/portals/debug        
+       log "== test $1: $2"
+       export TESTNAME=test_$1
+       test_$1 || error "test_$1: exit with rc=$?"
+       unset TESTNAME
+       pass
+       cd $SAVE_PWD
+       $CLEAN
+}
+
+build_test_filter() {
+        for O in $ONLY; do
+            eval ONLY_${O}=true
+        done
+        for E in $EXCEPT $ALWAYS_EXCEPT; do
+            eval EXCEPT_${E}=true
+        done
+}
+
+_basetest() {
+    echo $*
+}
+
+basetest() {
+    IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
+}
+
+run_test() {
+         base=`basetest $1`
+         if [ "$ONLY" ]; then
+                 testname=ONLY_$1
+                 if [ ${!testname}x != x ]; then
+                       run_one $1 "$2"
+                       return $?
+                 fi
+                 testname=ONLY_$base
+                 if [ ${!testname}x != x ]; then
+                         run_one $1 "$2"
+                         return $?
+                 fi
+                 echo -n "."
+                 return 0
+       fi
+        testname=EXCEPT_$1
+        if [ ${!testname}x != x ]; then
+                 echo "skipping excluded test $1"
+                 return 0
+        fi
+        testname=EXCEPT_$base
+        if [ ${!testname}x != x ]; then
+                 echo "skipping excluded test $1 (base $base)"
+                 return 0
+        fi
+        run_one $1 "$2"
+       return $?
+}
+
+[ "$SANITYLOG" ] && rm -f $SANITYLOG || true
+
+error() { 
+       log "FAIL: $@"
+       if [ "$SANITYLOG" ]; then
+               echo "FAIL: $TESTNAME $@" >> $SANITYLOG
+       else
+               exit 1
+       fi
+}
+
+pass() { 
+       echo PASS
+}
+
+MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
+if [ -z "$MOUNT" ]; then
+       sh llmount.sh
+       MOUNT="`mount | awk '/^'$NAME' .* lustre_lite / { print $3 }'`"
+       [ -z "$MOUNT" ] && error "NAME=$NAME not mounted"
+       I_MOUNTED=yes
+fi
+
+[ `echo $MOUNT | wc -w` -gt 1 ] && error "NAME=$NAME mounted more than once"
+
+DIR=${DIR:-$MOUNT}
+[ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99
+
+OSTCOUNT=`cat /proc/fs/lustre/llite/fs0/lov/numobd`
+STRIPECOUNT=`cat /proc/fs/lustre/llite/fs0/lov/stripecount`
+STRIPESIZE=`cat /proc/fs/lustre/llite/fs0/lov/stripesize`
+
+build_test_filter
+
+test_0() {
+       touch $DIR/f
+       $CHECKSTAT -t file $DIR/f || error
+       rm $DIR/f
+       $CHECKSTAT -a $DIR/f || error
+}
+run_test 0 "touch .../f ; rm .../f ============================="
+
+mdsdevice(){
+        lctl << EOF
+        dl
+        quit
+EOF
+}
+
+mynidstr(){
+        lctl << EOF
+        network tcp
+        mynid
+        quit
+EOF
+}
+
+test_1(){
+        mdsnum=`mdsdevice|awk ' $3=="mds" {print $1}'`
+       if [ ! -z "$mdsnum" ];then
+        mynid=`mynidstr|awk '{print $4}'`
+        mkdir $DIR/test_0a_dir1
+        touch $DIR/test_0a_file1
+        ln -s $DIR/test_0a_file1 $DIR/test_0a_filelink1
+        chmod 0777 $DIR
+        lctl << EOF
+        device $mdsnum 
+        root_squash 500:500
+        root_squash
+        quit
+EOF
+        mkdir $DIR/test_0a_dir2
+        touch $DIR/test_0a_file2
+        ln -s $DIR/test_0a_file2 $DIR/test_0a_filelink2
+        $CHECKSTAT -t dir   -u 500  $DIR/test_0a_dir2 || error
+        $CHECKSTAT -t file  -u 500  $DIR/test_0a_file2 || error
+        $CHECKSTAT -t link  -u 500  $DIR/test_0a_filelink2 || error
+        lctl << EOF
+        device $mdsnum 
+        root_squash 500:500 $mynid
+        root_squash
+        quit
+EOF
+        mkdir $DIR/test_0a_dir3
+        touch $DIR/test_0a_file3
+        ln -s $DIR/test_0a_file3 $DIR/test_0a_filelink3
+        $CHECKSTAT -t dir -u root  $DIR/test_0a_dir3 || error
+        $CHECKSTAT -t file -u root $DIR/test_0a_file3 || error
+        $CHECKSTAT -t link -u root $DIR/test_0a_filelink3 || error
+        lctl << EOF
+        device $mdsnum 
+        root_squash root:root
+        root_squash
+        quit
+EOF
+        mkdir $DIR/test_0a_dir4
+        touch $DIR/test_0a_file4
+        ln -s $DIR/test_0a_file4 $DIR/test_0a_filelink4
+        $CHECKSTAT -t dir -u root  $DIR/test_0a_dir4 || error
+        $CHECKSTAT -t file -u root $DIR/test_0a_file4 || error
+        $CHECKSTAT -t link -u root $DIR/test_0a_filelink4 || error
+        rm -rf $DIR/test_0a*
+        chmod 0755 $DIR
+       fi
+}
+
+run_test 1 "test root_squash ============================"
+
+TMPDIR=$OLDTMPDIR
+TMP=$OLDTMP
+HOME=$OLDHOME
+
+log "cleanup: ======================================================"
+if [ "`mount | grep ^$NAME`" ]; then
+       rm -rf $DIR/[Rdfs][1-9]*
+       if [ "$I_MOUNTED" = "yes" ]; then
+               sh llmountcleanup.sh || error
+       fi
+fi
+
+echo '=========================== finished ==============================='
+[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
index 7c8f2cc..ed4a78e 100644 (file)
@@ -203,69 +203,6 @@ test_0() {
        $CHECKSTAT -a $DIR/f || error
 }
 run_test 0 "touch .../f ; rm .../f ============================="
        $CHECKSTAT -a $DIR/f || error
 }
 run_test 0 "touch .../f ; rm .../f ============================="
-#bug3270 root_squash check
-mdsdevice(){
-        lctl << EOF
-        dl
-        quit
-EOF
-}
-mynidstr(){
-        lctl << EOF
-        network tcp
-        mynid
-        quit
-EOF
-}
-test_0a(){
-        mdsnum=`mdsdevice|awk ' $3=="mds" {print $1}'`
-       if [ ! -z "$mdsnum" ];then
-        mynid=`mynidstr|awk '{print $4}'`
-        mkdir $DIR/test_0a_dir1
-        touch $DIR/test_0a_file1
-        ln -s $DIR/test_0a_file1 $DIR/test_0a_filelink1
-       chmod 0777 $DIR
-        lctl << EOF
-        device $mdsnum 
-        root_squash 500:500
-        root_squash
-        quit
-EOF
-        mkdir $DIR/test_0a_dir2
-        touch $DIR/test_0a_file2
-        ln -s $DIR/test_0a_file2 $DIR/test_0a_filelink2
-        $CHECKSTAT -t dir   -u 500  $DIR/test_0a_dir2 || error
-        $CHECKSTAT -t file  -u 500  $DIR/test_0a_file2 || error
-        $CHECKSTAT -t link  -u 500  $DIR/test_0a_filelink2 || error
-        lctl << EOF
-        device $mdsnum 
-        root_squash 500:500 $mynid
-        root_squash
-        quit
-EOF
-        mkdir $DIR/test_0a_dir3
-        touch $DIR/test_0a_file3
-        ln -s $DIR/test_0a_file3 $DIR/test_0a_filelink3
-        $CHECKSTAT -t dir -u root  $DIR/test_0a_dir3 || error
-        $CHECKSTAT -t file -u root $DIR/test_0a_file3 || error
-        $CHECKSTAT -t link -u root $DIR/test_0a_filelink3 || error
-        lctl << EOF
-        device $mdsnum 
-        root_squash root:root
-        root_squash
-        quit
-EOF
-        mkdir $DIR/test_0a_dir4
-        touch $DIR/test_0a_file4
-        ln -s $DIR/test_0a_file4 $DIR/test_0a_filelink4
-        $CHECKSTAT -t dir -u root  $DIR/test_0a_dir4 || error
-        $CHECKSTAT -t file -u root $DIR/test_0a_file4 || error
-        $CHECKSTAT -t link -u root $DIR/test_0a_filelink4 || error
-        rm -rf $DIR/test_0a*
-       fi
-}
-
-run_test 0a "test root_squash ============================"
 
 test_1a() {
        mkdir $DIR/d1
 
 test_1a() {
        mkdir $DIR/d1
index 1f7a8b5..56c6d6f 100644 (file)
@@ -8,7 +8,7 @@ AM_LDFLAGS := -L$(top_builddir)/portals/utils
 
 if UTILS
 rootsbin_SCRIPTS = mount.lustre
 
 if UTILS
 rootsbin_SCRIPTS = mount.lustre
-sbin_PROGRAMS = lctl obdio obdbarrier lload wirecheck wiretest llmount
+sbin_PROGRAMS = lctl obdio obdbarrier lload wirecheck wiretest llmount l_getgroups
 sbin_SCRIPTS = lconf lmc llanalyze llstat.pl llobdstat.pl lactive load_ldap.sh lrun
 sbin_SCRIPTS += lwizard
 bin_SCRIPTS = lfind lstripe
 sbin_SCRIPTS = lconf lmc llanalyze llstat.pl llobdstat.pl lactive load_ldap.sh lrun
 sbin_SCRIPTS += lwizard
 bin_SCRIPTS = lfind lstripe
@@ -32,6 +32,7 @@ obdbarrier_SOURCES = obdbarrier.c obdiolib.c obdiolib.h
 lfs_SOURCES = lfs.c 
 llmount_SOURCES = llmount.c 
 llmount_LDADD = $(LIBREADLINE) -lptlctl
 lfs_SOURCES = lfs.c 
 llmount_SOURCES = llmount.c 
 llmount_LDADD = $(LIBREADLINE) -lptlctl
+l_getgroups_SOURCES = l_getgroups.c
 
 EXTRA_DIST = $(bin_SCRIPTS) $(sbin_SCRIPTS)
 
 
 EXTRA_DIST = $(bin_SCRIPTS) $(sbin_SCRIPTS)
 
diff --git a/lustre/utils/l_getgroups.c b/lustre/utils/l_getgroups.c
new file mode 100644 (file)
index 0000000..2f9b7d0
--- /dev/null
@@ -0,0 +1,122 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2004 Cluster File Systems, Inc.
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <grp.h>
+
+/*
+ * return:
+ *  0:      fail to insert (found identical)
+ *  1:      inserted
+ */
+int insert_sort(gid_t *groups, int size, gid_t grp)
+{
+        int i;
+        gid_t save;
+
+        for (i = 0; i < size; i++) {
+                if (groups[i] == grp)
+                        return 0;
+                if (groups[i] > grp)
+                        break;
+        }
+
+        for (; i <= size; i++) {
+                save = groups[i];
+                groups[i] = grp;
+                grp = save;
+        }
+        return 1;
+}
+
+int get_groups_local(uid_t uid, int *ngroups, gid_t **groups)
+{
+        int     maxgroups;
+        int     i, size = 0;
+        struct passwd *pw;
+        struct group  *gr;
+
+        *ngroups = 0;
+        *groups = NULL;
+        maxgroups = sysconf(_SC_NGROUPS_MAX);
+        *groups = malloc(maxgroups * sizeof(gid_t));
+        if (!*groups)
+                return -ENOMEM;
+
+        pw = getpwuid(uid);
+        if (!pw)
+                return -errno;
+
+        while ((gr = getgrent())) {
+                if (!gr->gr_mem)
+                        continue;
+                for (i = 0; gr->gr_mem[i]; i++) {
+                        if (strcmp(gr->gr_mem[i], pw->pw_name))
+                                continue;
+                        size += insert_sort(*groups, size, gr->gr_gid);
+                        break;
+                }
+                if (size == maxgroups)
+                        break;
+        }
+        endgrent();
+        *ngroups = size;
+        return 0;
+}
+
+int main (int argc, char **argv)
+{
+        int     fd, rc;
+        struct {
+                uint32_t err;
+                uint32_t uid;
+                uint32_t ngroups;
+                gid_t   *groups;
+        } ioc_data;
+        char    *pathname = "/proc/fs/lustre/mds/group_info";
+
+        if (argc != 2) {
+                printf("bad parameter\n");
+                return -EINVAL;
+        }
+
+        ioc_data.uid = atoi(argv[1]);
+
+        fd = open(pathname, O_WRONLY);
+        if (fd < 0) {
+                rc = -errno;
+                printf("can't open device %s\n", pathname);
+                return rc;
+        }
+
+        ioc_data.err = get_groups_local(ioc_data.uid, &ioc_data.ngroups, &ioc_data.groups);
+
+        rc = write(fd, &ioc_data, sizeof(ioc_data));
+        return (rc != sizeof(ioc_data));
+}
index f2c97aa..13ed741 100755 (executable)
@@ -1682,6 +1682,15 @@ class MDSDEV(Module):
                         setup ="%s %s %s %s %s %s" %(realdev, self.fstype, 
                                                self.name, mountfsoptions,
                                                self.master_mds, self.cachetype))
                         setup ="%s %s %s %s %s %s" %(realdev, self.fstype, 
                                                self.name, mountfsoptions,
                                                self.master_mds, self.cachetype))
+
+            if development_mode():
+                procentry = "/proc/fs/lustre/mds/grp_hash_upcall"
+                upcall = os.path.abspath(os.path.dirname(sys.argv[0]) + "/l_getgroups")
+                if not (os.access(procentry, os.R_OK) and os.access(upcall, os.R_OK)):
+                    print "MDS Warning: failed to set group-hash upcall"
+                else:
+                    run("echo ", upcall, " > ", procentry)
+
         except CommandError, e:
             if e.rc == 2:
                 panic("MDS is missing the config log. Need to run " +
         except CommandError, e:
             if e.rc == 2:
                 panic("MDS is missing the config log. Need to run " +
index 254c96e..35d9211 100644 (file)
@@ -116,6 +116,8 @@ check_obdo(void)
         CHECK_MEMBER(obdo, o_valid);
         CHECK_MEMBER(obdo, o_misc);
         CHECK_MEMBER(obdo, o_easize);
         CHECK_MEMBER(obdo, o_valid);
         CHECK_MEMBER(obdo, o_misc);
         CHECK_MEMBER(obdo, o_easize);
+        CHECK_MEMBER(obdo, o_mds);
+        CHECK_MEMBER(obdo, o_padding);
         CHECK_MEMBER(obdo, o_inline);
 
         CHECK_VALUE(OBD_MD_FLID);
         CHECK_MEMBER(obdo, o_inline);
 
         CHECK_VALUE(OBD_MD_FLID);
@@ -260,9 +262,6 @@ check_mds_body(void)
         CHECK_MEMBER(mds_body, io_epoch);
         CHECK_MEMBER(mds_body, ino);
         CHECK_MEMBER(mds_body, valid);
         CHECK_MEMBER(mds_body, io_epoch);
         CHECK_MEMBER(mds_body, ino);
         CHECK_MEMBER(mds_body, valid);
-        CHECK_MEMBER(mds_body, fsuid);
-        CHECK_MEMBER(mds_body, fsgid);
-        CHECK_MEMBER(mds_body, capability);
         CHECK_MEMBER(mds_body, mode);
         CHECK_MEMBER(mds_body, uid);
         CHECK_MEMBER(mds_body, gid);
         CHECK_MEMBER(mds_body, mode);
         CHECK_MEMBER(mds_body, uid);
         CHECK_MEMBER(mds_body, gid);
@@ -273,8 +272,8 @@ check_mds_body(void)
         CHECK_MEMBER(mds_body, rdev);
         CHECK_MEMBER(mds_body, nlink);
         CHECK_MEMBER(mds_body, generation);
         CHECK_MEMBER(mds_body, rdev);
         CHECK_MEMBER(mds_body, nlink);
         CHECK_MEMBER(mds_body, generation);
-        CHECK_MEMBER(mds_body, suppgid);
         CHECK_MEMBER(mds_body, eadatasize);
         CHECK_MEMBER(mds_body, eadatasize);
+        CHECK_MEMBER(mds_body, mds);
 
         CHECK_VALUE(FMODE_READ);
         CHECK_VALUE(FMODE_WRITE);
 
         CHECK_VALUE(FMODE_READ);
         CHECK_VALUE(FMODE_WRITE);
@@ -295,10 +294,6 @@ check_mds_rec_setattr(void)
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_setattr);
         CHECK_MEMBER(mds_rec_setattr, sa_opcode);
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_setattr);
         CHECK_MEMBER(mds_rec_setattr, sa_opcode);
-        CHECK_MEMBER(mds_rec_setattr, sa_fsuid);
-        CHECK_MEMBER(mds_rec_setattr, sa_fsgid);
-        CHECK_MEMBER(mds_rec_setattr, sa_cap);
-        CHECK_MEMBER(mds_rec_setattr, sa_suppgid);
         CHECK_MEMBER(mds_rec_setattr, sa_valid);
         CHECK_MEMBER(mds_rec_setattr, sa_fid);
         CHECK_MEMBER(mds_rec_setattr, sa_mode);
         CHECK_MEMBER(mds_rec_setattr, sa_valid);
         CHECK_MEMBER(mds_rec_setattr, sa_fid);
         CHECK_MEMBER(mds_rec_setattr, sa_mode);
@@ -317,16 +312,13 @@ check_mds_rec_create(void)
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_create);
         CHECK_MEMBER(mds_rec_create, cr_opcode);
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_create);
         CHECK_MEMBER(mds_rec_create, cr_opcode);
-        CHECK_MEMBER(mds_rec_create, cr_fsuid);
-        CHECK_MEMBER(mds_rec_create, cr_fsgid);
-        CHECK_MEMBER(mds_rec_create, cr_cap);
         CHECK_MEMBER(mds_rec_create, cr_flags);
         CHECK_MEMBER(mds_rec_create, cr_mode);
         CHECK_MEMBER(mds_rec_create, cr_flags);
         CHECK_MEMBER(mds_rec_create, cr_mode);
+        CHECK_MEMBER(mds_rec_create, cr_padding);
         CHECK_MEMBER(mds_rec_create, cr_fid);
         CHECK_MEMBER(mds_rec_create, cr_replayfid);
         CHECK_MEMBER(mds_rec_create, cr_time);
         CHECK_MEMBER(mds_rec_create, cr_rdev);
         CHECK_MEMBER(mds_rec_create, cr_fid);
         CHECK_MEMBER(mds_rec_create, cr_replayfid);
         CHECK_MEMBER(mds_rec_create, cr_time);
         CHECK_MEMBER(mds_rec_create, cr_rdev);
-        CHECK_MEMBER(mds_rec_create, cr_suppgid);
 }
 
 void
 }
 
 void
@@ -335,11 +327,7 @@ check_mds_rec_link(void)
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_link);
         CHECK_MEMBER(mds_rec_link, lk_opcode);
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_link);
         CHECK_MEMBER(mds_rec_link, lk_opcode);
-        CHECK_MEMBER(mds_rec_link, lk_fsuid);
-        CHECK_MEMBER(mds_rec_link, lk_fsgid);
-        CHECK_MEMBER(mds_rec_link, lk_cap);
-        CHECK_MEMBER(mds_rec_link, lk_suppgid1);
-        CHECK_MEMBER(mds_rec_link, lk_suppgid2);
+        CHECK_MEMBER(mds_rec_link, lk_padding);
         CHECK_MEMBER(mds_rec_link, lk_fid1);
         CHECK_MEMBER(mds_rec_link, lk_fid2);
         CHECK_MEMBER(mds_rec_link, lk_time);
         CHECK_MEMBER(mds_rec_link, lk_fid1);
         CHECK_MEMBER(mds_rec_link, lk_fid2);
         CHECK_MEMBER(mds_rec_link, lk_time);
@@ -351,10 +339,6 @@ check_mds_rec_unlink(void)
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_unlink);
         CHECK_MEMBER(mds_rec_unlink, ul_opcode);
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_unlink);
         CHECK_MEMBER(mds_rec_unlink, ul_opcode);
-        CHECK_MEMBER(mds_rec_unlink, ul_fsuid);
-        CHECK_MEMBER(mds_rec_unlink, ul_fsgid);
-        CHECK_MEMBER(mds_rec_unlink, ul_cap);
-        CHECK_MEMBER(mds_rec_unlink, ul_suppgid);
         CHECK_MEMBER(mds_rec_unlink, ul_mode);
         CHECK_MEMBER(mds_rec_unlink, ul_fid1);
         CHECK_MEMBER(mds_rec_unlink, ul_fid2);
         CHECK_MEMBER(mds_rec_unlink, ul_mode);
         CHECK_MEMBER(mds_rec_unlink, ul_fid1);
         CHECK_MEMBER(mds_rec_unlink, ul_fid2);
@@ -367,11 +351,7 @@ check_mds_rec_rename(void)
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_rename);
         CHECK_MEMBER(mds_rec_rename, rn_opcode);
         BLANK_LINE();
         CHECK_STRUCT(mds_rec_rename);
         CHECK_MEMBER(mds_rec_rename, rn_opcode);
-        CHECK_MEMBER(mds_rec_rename, rn_fsuid);
-        CHECK_MEMBER(mds_rec_rename, rn_fsgid);
-        CHECK_MEMBER(mds_rec_rename, rn_cap);
-        CHECK_MEMBER(mds_rec_rename, rn_suppgid1);
-        CHECK_MEMBER(mds_rec_rename, rn_suppgid2);
+        CHECK_MEMBER(mds_rec_rename, rn_padding);
         CHECK_MEMBER(mds_rec_rename, rn_fid1);
         CHECK_MEMBER(mds_rec_rename, rn_fid2);
         CHECK_MEMBER(mds_rec_rename, rn_time);
         CHECK_MEMBER(mds_rec_rename, rn_fid1);
         CHECK_MEMBER(mds_rec_rename, rn_fid2);
         CHECK_MEMBER(mds_rec_rename, rn_time);
index 3189c7e..2cb4bb7 100644 (file)
@@ -25,7 +25,7 @@ int main()
 void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
 void lustre_assert_wire_constants(void)
 {
         /* Wire protocol assertions generated by 'wirecheck'
-         * running on Linux firefly.localdomain 2.6.7 #1 Wed Jun 16 10:50:27 EEST 2004 i686 i686 i386
+         * running on Linux build 2.4.24-cmd #1 SMP Wed Aug 18 14:24:44 MDT 2004 i686 i686 i386 GNU/L
          * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
 
 
          * with gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) */
 
 
@@ -266,7 +266,7 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)sizeof(((struct lustre_msg *)0)->buflens[7]));
 
         /* Checks for struct obdo */
                  (long long)(int)sizeof(((struct lustre_msg *)0)->buflens[7]));
 
         /* Checks for struct obdo */
-        LASSERTF((int)sizeof(struct obdo) == 172, " found %lld\n",
+        LASSERTF((int)sizeof(struct obdo) == 176, " found %lld\n",
                  (long long)(int)sizeof(struct obdo));
         LASSERTF((int)offsetof(struct obdo, o_id) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct obdo, o_id));
                  (long long)(int)sizeof(struct obdo));
         LASSERTF((int)offsetof(struct obdo, o_id) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct obdo, o_id));
@@ -340,7 +340,15 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct obdo, o_easize));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_easize));
                  (long long)(int)offsetof(struct obdo, o_easize));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_easize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_easize));
-        LASSERTF((int)offsetof(struct obdo, o_inline) == 108, " found %lld\n",
+        LASSERTF((int)offsetof(struct obdo, o_mds) == 104, " found %lld\n",
+                 (long long)(int)offsetof(struct obdo, o_mds));
+        LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct obdo *)0)->o_mds));
+        LASSERTF((int)offsetof(struct obdo, o_padding) == 108, " found %lld\n",
+                 (long long)(int)offsetof(struct obdo, o_padding));
+        LASSERTF((int)sizeof(((struct obdo *)0)->o_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct obdo *)0)->o_padding));
+        LASSERTF((int)offsetof(struct obdo, o_inline) == 112, " found %lld\n",
                  (long long)(int)offsetof(struct obdo, o_inline));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_inline));
                  (long long)(int)offsetof(struct obdo, o_inline));
         LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 64, " found %lld\n",
                  (long long)(int)sizeof(((struct obdo *)0)->o_inline));
@@ -550,11 +558,11 @@ void lustre_assert_wire_constants(void)
                  (long long)OBD_BRW_FROM_GRANT);
 
         /* Checks for struct ost_body */
                  (long long)OBD_BRW_FROM_GRANT);
 
         /* Checks for struct ost_body */
-        LASSERTF((int)sizeof(struct ost_body) == 172, " found %lld\n",
+        LASSERTF((int)sizeof(struct ost_body) == 176, " found %lld\n",
                  (long long)(int)sizeof(struct ost_body));
         LASSERTF((int)offsetof(struct ost_body, oa) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct ost_body, oa));
                  (long long)(int)sizeof(struct ost_body));
         LASSERTF((int)offsetof(struct ost_body, oa) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct ost_body, oa));
-        LASSERTF((int)sizeof(((struct ost_body *)0)->oa) == 172, " found %lld\n",
+        LASSERTF((int)sizeof(((struct ost_body *)0)->oa) == 176, " found %lld\n",
                  (long long)(int)sizeof(((struct ost_body *)0)->oa));
 
         /* Checks for struct ll_fid */
                  (long long)(int)sizeof(((struct ost_body *)0)->oa));
 
         /* Checks for struct ll_fid */
@@ -586,7 +594,7 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf));
 
         /* Checks for struct mds_body */
                  (long long)(int)sizeof(((struct mds_status_req *)0)->repbuf));
 
         /* Checks for struct mds_body */
-        LASSERTF((int)sizeof(struct mds_body) == 152, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_body) == 136, " found %lld\n",
                  (long long)(int)sizeof(struct mds_body));
         LASSERTF((int)offsetof(struct mds_body, fid1) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, fid1));
                  (long long)(int)sizeof(struct mds_body));
         LASSERTF((int)offsetof(struct mds_body, fid1) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, fid1));
@@ -620,66 +628,54 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct mds_body, valid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->valid));
                  (long long)(int)offsetof(struct mds_body, valid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->valid));
-        LASSERTF((int)offsetof(struct mds_body, fsuid) == 88, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, fsuid));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->fsuid));
-        LASSERTF((int)offsetof(struct mds_body, fsgid) == 92, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, fsgid));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->fsgid));
-        LASSERTF((int)offsetof(struct mds_body, capability) == 96, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, capability));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->capability) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->capability));
-        LASSERTF((int)offsetof(struct mds_body, mode) == 100, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, mode) == 88, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, mode));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mode));
                  (long long)(int)offsetof(struct mds_body, mode));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mode));
-        LASSERTF((int)offsetof(struct mds_body, uid) == 104, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, uid) == 92, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, uid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->uid));
                  (long long)(int)offsetof(struct mds_body, uid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->uid));
-        LASSERTF((int)offsetof(struct mds_body, gid) == 108, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, gid) == 96, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, gid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->gid));
                  (long long)(int)offsetof(struct mds_body, gid));
         LASSERTF((int)sizeof(((struct mds_body *)0)->gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->gid));
-        LASSERTF((int)offsetof(struct mds_body, mtime) == 112, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, mtime) == 100, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, mtime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mtime));
                  (long long)(int)offsetof(struct mds_body, mtime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->mtime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->mtime));
-        LASSERTF((int)offsetof(struct mds_body, ctime) == 116, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, ctime) == 104, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, ctime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->ctime));
                  (long long)(int)offsetof(struct mds_body, ctime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->ctime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->ctime));
-        LASSERTF((int)offsetof(struct mds_body, atime) == 120, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, atime) == 108, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, atime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->atime));
                  (long long)(int)offsetof(struct mds_body, atime));
         LASSERTF((int)sizeof(((struct mds_body *)0)->atime) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->atime));
-        LASSERTF((int)offsetof(struct mds_body, flags) == 124, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, flags) == 112, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, flags));
         LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->flags));
                  (long long)(int)offsetof(struct mds_body, flags));
         LASSERTF((int)sizeof(((struct mds_body *)0)->flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->flags));
-        LASSERTF((int)offsetof(struct mds_body, rdev) == 128, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, rdev) == 116, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, rdev));
         LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->rdev));
                  (long long)(int)offsetof(struct mds_body, rdev));
         LASSERTF((int)sizeof(((struct mds_body *)0)->rdev) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->rdev));
-        LASSERTF((int)offsetof(struct mds_body, nlink) == 132, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, nlink) == 120, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, nlink));
         LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->nlink));
                  (long long)(int)offsetof(struct mds_body, nlink));
         LASSERTF((int)sizeof(((struct mds_body *)0)->nlink) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->nlink));
-        LASSERTF((int)offsetof(struct mds_body, generation) == 136, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, generation) == 124, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, generation));
         LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->generation));
                  (long long)(int)offsetof(struct mds_body, generation));
         LASSERTF((int)sizeof(((struct mds_body *)0)->generation) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->generation));
-        LASSERTF((int)offsetof(struct mds_body, suppgid) == 140, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_body, suppgid));
-        LASSERTF((int)sizeof(((struct mds_body *)0)->suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_body *)0)->suppgid));
-        LASSERTF((int)offsetof(struct mds_body, eadatasize) == 144, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_body, eadatasize) == 128, " found %lld\n",
                  (long long)(int)offsetof(struct mds_body, eadatasize));
         LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->eadatasize));
                  (long long)(int)offsetof(struct mds_body, eadatasize));
         LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_body *)0)->eadatasize));
+        LASSERTF((int)offsetof(struct mds_body, mds) == 132, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_body, mds));
+        LASSERTF((int)sizeof(((struct mds_body *)0)->mds) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_body *)0)->mds));
         LASSERTF(FMODE_READ == 1, " found %lld\n",
                  (long long)FMODE_READ);
         LASSERTF(FMODE_WRITE == 2, " found %lld\n",
         LASSERTF(FMODE_READ == 1, " found %lld\n",
                  (long long)FMODE_READ);
         LASSERTF(FMODE_WRITE == 2, " found %lld\n",
@@ -704,233 +700,157 @@ void lustre_assert_wire_constants(void)
                  (long long)MDS_OPEN_HAS_EA);
 
         /* Checks for struct mds_rec_setattr */
                  (long long)MDS_OPEN_HAS_EA);
 
         /* Checks for struct mds_rec_setattr */
-        LASSERTF((int)sizeof(struct mds_rec_setattr) == 96, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_setattr) == 80, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_setattr));
         LASSERTF((int)offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode));
                  (long long)(int)sizeof(struct mds_rec_setattr));
         LASSERTF((int)offsetof(struct mds_rec_setattr, sa_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_cap));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_suppgid) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_setattr, sa_suppgid));
-        LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_suppgid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_valid) == 20, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_valid) == 4, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_valid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_valid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_valid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_valid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fid) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_fid) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_fid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_fid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_fid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mode) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mode) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mode));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mode));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_uid) == 52, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_uid) == 36, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_uid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_uid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_uid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_uid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_gid) == 56, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_gid) == 40, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_gid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_gid));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_gid) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_gid));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_attr_flags) == 60, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_attr_flags) == 44, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_attr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_attr_flags));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_size) == 64, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_size) == 48, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_size));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_size));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_size) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_size));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_atime) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_atime) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_atime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_atime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_atime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_atime));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mtime) == 80, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_mtime) == 64, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mtime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime));
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_mtime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_mtime));
-        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_ctime) == 88, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_setattr, sa_ctime) == 72, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_ctime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime));
 
         /* Checks for struct mds_rec_create */
                  (long long)(int)offsetof(struct mds_rec_setattr, sa_ctime));
         LASSERTF((int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_setattr *)0)->sa_ctime));
 
         /* Checks for struct mds_rec_create */
-        LASSERTF((int)sizeof(struct mds_rec_create) == 96, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_create) == 80, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_create));
         LASSERTF((int)offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode));
                  (long long)(int)sizeof(struct mds_rec_create));
         LASSERTF((int)offsetof(struct mds_rec_create, cr_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_cap));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_flags) == 16, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_flags) == 4, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags));
                  (long long)(int)offsetof(struct mds_rec_create, cr_flags));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_flags) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_flags));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_mode) == 20, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_mode) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_mode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode));
                  (long long)(int)offsetof(struct mds_rec_create, cr_mode));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_mode));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_fid) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_padding) == 12, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_rec_create, cr_padding));
+        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_padding));
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_fid) == 16, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_fid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid));
                  (long long)(int)offsetof(struct mds_rec_create, cr_fid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_fid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_fid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_replayfid) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_replayfid) == 40, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_replayfid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid));
                  (long long)(int)offsetof(struct mds_rec_create, cr_replayfid));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_replayfid) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_replayfid));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_time) == 64, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_time));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time));
                  (long long)(int)offsetof(struct mds_rec_create, cr_time));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_time));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_rdev) == 80, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_create, cr_rdev) == 72, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_create, cr_rdev));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev));
                  (long long)(int)offsetof(struct mds_rec_create, cr_rdev));
         LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_rdev) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_rdev));
-        LASSERTF((int)offsetof(struct mds_rec_create, cr_suppgid) == 88, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_create, cr_suppgid));
-        LASSERTF((int)sizeof(((struct mds_rec_create *)0)->cr_suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_create *)0)->cr_suppgid));
 
         /* Checks for struct mds_rec_link */
 
         /* Checks for struct mds_rec_link */
-        LASSERTF((int)sizeof(struct mds_rec_link) == 80, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_link) == 64, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_link));
         LASSERTF((int)offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode));
                  (long long)(int)sizeof(struct mds_rec_link));
         LASSERTF((int)offsetof(struct mds_rec_link, lk_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_cap));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_suppgid1) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_suppgid1));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid1));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_suppgid2) == 20, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_link, lk_suppgid2));
-        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_suppgid2));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid1) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_padding) == 4, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_rec_link, lk_padding));
+        LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_padding));
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid1) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1));
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid1));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid2) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_fid2) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2));
                  (long long)(int)offsetof(struct mds_rec_link, lk_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_fid2));
-        LASSERTF((int)offsetof(struct mds_rec_link, lk_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_link, lk_time) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_link, lk_time));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time));
 
         /* Checks for struct mds_rec_unlink */
                  (long long)(int)offsetof(struct mds_rec_link, lk_time));
         LASSERTF((int)sizeof(((struct mds_rec_link *)0)->lk_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_link *)0)->lk_time));
 
         /* Checks for struct mds_rec_unlink */
-        LASSERTF((int)sizeof(struct mds_rec_unlink) == 80, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_unlink) == 64, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_unlink));
         LASSERTF((int)offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode));
                  (long long)(int)sizeof(struct mds_rec_unlink));
         LASSERTF((int)offsetof(struct mds_rec_unlink, ul_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_cap));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_suppgid) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_unlink, ul_suppgid));
-        LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_suppgid));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_mode) == 20, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_mode) == 4, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_mode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode));
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_mode));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_mode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_mode));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid1) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid1) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1));
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid1));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid2) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_fid2) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2));
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_fid2));
-        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_unlink, ul_time) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_time));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time));
 
         /* Checks for struct mds_rec_rename */
                  (long long)(int)offsetof(struct mds_rec_unlink, ul_time));
         LASSERTF((int)sizeof(((struct mds_rec_unlink *)0)->ul_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_unlink *)0)->ul_time));
 
         /* Checks for struct mds_rec_rename */
-        LASSERTF((int)sizeof(struct mds_rec_rename) == 80, " found %lld\n",
+        LASSERTF((int)sizeof(struct mds_rec_rename) == 64, " found %lld\n",
                  (long long)(int)sizeof(struct mds_rec_rename));
         LASSERTF((int)offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode));
                  (long long)(int)sizeof(struct mds_rec_rename));
         LASSERTF((int)offsetof(struct mds_rec_rename, rn_opcode) == 0, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_opcode));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_opcode) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_opcode));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fsuid) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_fsuid));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsuid));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fsgid) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_fsgid));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fsgid));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_cap) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_cap));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_cap) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_cap));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_suppgid1) == 16, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_suppgid1));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid1));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_suppgid2) == 20, " found %lld\n",
-                 (long long)(int)offsetof(struct mds_rec_rename, rn_suppgid2));
-        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_suppgid2));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid1) == 24, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_padding) == 4, " found %lld\n",
+                 (long long)(int)offsetof(struct mds_rec_rename, rn_padding));
+        LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_padding) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_padding));
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid1) == 8, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1));
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid1));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid1) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid1));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid2) == 48, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_fid2) == 32, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2));
                  (long long)(int)offsetof(struct mds_rec_rename, rn_fid2));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_fid2) == 24, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_fid2));
-        LASSERTF((int)offsetof(struct mds_rec_rename, rn_time) == 72, " found %lld\n",
+        LASSERTF((int)offsetof(struct mds_rec_rename, rn_time) == 56, " found %lld\n",
                  (long long)(int)offsetof(struct mds_rec_rename, rn_time));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time));
                  (long long)(int)offsetof(struct mds_rec_rename, rn_time));
         LASSERTF((int)sizeof(((struct mds_rec_rename *)0)->rn_time) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct mds_rec_rename *)0)->rn_time));
@@ -1493,3 +1413,4 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx));
 }
         LASSERTF((int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx) == 4, " found %lld\n",
                  (long long)(int)sizeof(((struct llogd_conn_body *)0)->lgdc_ctxt_idx));
 }
+