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);
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,
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);
}
#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)
/*
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>
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)
{
#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
* 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,
__u64 io_epoch;
__u32 ino; /* make this a __u64 */
__u32 valid;
- __u32 fsuid;
- __u32 fsgid;
- __u32 capability;
__u32 mode;
__u32 uid;
__u32 gid;
__u32 rdev;
__u32 nlink; /* #bytes to read in the case of MDS_READPAGE */
__u32 generation;
- __u32 suppgid;
__u32 eadatasize;
__u32 mds;
};
struct mea *mea;
};
-struct ll_uctxt {
- __u32 gid1;
- __u32 gid2;
-};
-
struct mdc_op_data {
struct ll_fid fid1;
struct ll_fid fid2;
- struct ll_uctxt ctxt;
__u64 mod_time;
const char *name;
int namelen;
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;
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_padding;
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;
- __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 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;
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;
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,
{
LASSERT(i1);
- ll_i2uctxt(&data->ctxt, i1, i2);
ll_inode2fid(&data->fid1, i1);
/* it could be directory with mea */
#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
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 *);
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,
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);
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);
/* 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,
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);
#define LL_FID_NAMELEN (16 + 1 + 8 + 1)
#if defined __KERNEL__
+#include <linux/lustre_compat25.h>
#include <linux/lvfs_linux.h>
#endif
#include <lvfs_user_fs.h>
#endif
+struct mds_grp_hash_entry;
+
/* 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_suppgid1;
- __u32 luc_suppgid2;
+ __u32 luc_uid;
};
struct lvfs_callback_ops {
#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;
+ 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
- int pid;
- __u32 magic;
+ int pid;
+ __u32 magic;
#endif
};
*/
};
-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 *,
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,
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,
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);
#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);
}
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);
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);
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");
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;
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
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
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;
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;
- } 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 */
- 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;
/* Continue as normal. */
if (!req_passed_in) {
- int buffers = 1;
- if (lvb_len > 0)
- buffers = 2;
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;
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);
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;
struct ldlm_request *body;
struct ldlm_reply *reply;
int buffers = 1;
- int size[2];
+ int size[2] = {0, sizeof(*body)};
int flags;
/*
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;
- 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;
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;
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 */
- 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
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;
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);
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);
+
req->rq_replen = lustre_msg_size(1, &size);
rc = ptlrpc_queue_wait(req);
{
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 };
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)
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)) {
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,
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);
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,
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) {
/* 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);
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,
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) {
(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);
/* 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);
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;
(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++) {
/* 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);
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);
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,
(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);
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) {
/* 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))) {
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,
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)
- 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)
- 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
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;
obj = lmv_grab_obj(obd, mfid);
LASSERT(obj != NULL);
- uctxt.gid1 = 0;
- uctxt.gid2 = 0;
master_lock_mode = 0;
lmv_lock_obj(obj);
}
/* 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) {
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);
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);
-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);
-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);
-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);
#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;
# 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
-#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
+ }
+}
/* push / pop to root of obd store */
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_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_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);
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);
}
/*
#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_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);
#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;
- 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->suppgid = -1;
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
/* 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));
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,
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));
- b->fsuid = current->fsuid;
- b->fsgid = current->fsgid;
- b->capability = current->cap_effective;
b->valid = valid;
b->flags = flags;
- b->suppgid = data->ctxt.gid1;
b->fid1 = data->fid1;
b->fid2 = data->fid2;
{
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));
}
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);
- LASSERT(ctxt);
LASSERT(f1);
- data->ctxt = *ctxt;
data->fid1 = *f1;
if (f2)
data->fid2 = *f2;
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};
- 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;
- 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);
+ 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;
- 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);
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 */
- 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;
- 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;
- 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 */
- 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 */
- 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;
- 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);
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;
- 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 */
- 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 */
- 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 */
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,
/* 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;
}
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);
- 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. */
}
* 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,
* 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,
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);
+ size[0] = mdc_get_secdesc_size();
if (ealen > 0) {
- bufcount = 2;
+ bufcount++;
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);
+ 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_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);
{
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;
+ size[0] = mdc_get_secdesc_size();
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);
+ 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(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);
}
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);
{
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;
-
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);
+
+ mdc_pack_secdesc(req, size[0]);
*request = req;
size[0] = sizeof(struct mds_body);
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)
{
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;
- 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);
- 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);
{
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;
- 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);
- 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;
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 */
{
struct ptlrpc_request *req;
struct mds_body *body;
- int rc, size = sizeof(*body);
+ int rc, size[2] = {0, sizeof(*body)};
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);
- 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_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);
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) {
- size[bufcount++] = ea_size;
+ repsize[bufcount++] = 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);
{
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.
*/
- 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);
- 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;
- mdc_pack_req_body(req);
rc = mdc_getattr_common(exp, ea_size, req);
if (rc != 0) {
{
struct ptlrpc_request *req;
struct mds_body *body;
- int rc, size[2] = {sizeof(*body), namelen};
+ int rc, size[3] = {0, sizeof(*body), namelen};
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);
- 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;
- mdc_pack_req_body(req);
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);
/* 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));
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));
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 */
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,
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);
+ //mdc_pack_secdesc(req, reqsize[0]);
+
/* Ensure that this close's handle is fixed up during replay. */
LASSERT(och != NULL);
mod = och->och_mod;
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;
{
struct ptlrpc_request *req;
struct mds_body *body;
- int rc, size = sizeof(*body);
+ int rc, size[2] = {0, sizeof(*body)};
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);
- 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;
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);
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);
- 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;
+ 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);
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) {
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);
* 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);
{
struct ptlrpc_request *req;
struct mds_body *body;
- int rc, size = sizeof(*body);
+ int rc, size[2] = {0, sizeof(*body)};
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);
- 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;
- 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);
{
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);
- 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);
- 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;
{
struct ptlrpc_request *req;
struct mds_body *body;
- int size = sizeof(*body);
+ int size[2] = {0, sizeof(*body)};
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);
+ //mdc_pack_secdesc(req, size[0]);
+
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));
- 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)
__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);
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);
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)
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@
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
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)
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)
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,
- (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? */
- 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_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;
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 mds_obd *mds = &obd->u.mds;
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;
- 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;
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);
}
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));
- 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);
#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;
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;
}
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,
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);
}
}
}
- 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:
l_dput(dchild);
case 1:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+ mds_exit_ucred(&uc);
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_req_sec_desc *rsd;
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);
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)) {
GOTO(out_pop, rc);
out_pop:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+ mds_exit_ucred(&uc);
return rc;
}
-
static int mds_obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
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;
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 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 mds_obd *mds = &obd->u.mds;
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);
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);
+ }
+ 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);
- 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));
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);
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_req_sec_desc *rsd;
int rc;
ENTRY;
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);
}
- 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);
+
+ mds_exit_ucred(&rec->ur_uc);
out:
OBD_FREE(rec, sizeof(*rec));
RETURN(rc);
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_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));
l_dput(new);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+ mds_put_group_entry(mds, uc.luc_ghash);
RETURN(rc);
}
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;
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) {
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: {
* 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)
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) {
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};
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;
}
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);
- 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);
- 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);
- rc = mds_sync(req);
+ rc = mds_sync(req, MDS_REQ_REC_OFF);
break;
case OBD_PING:
}
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 =
- 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 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);
- 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);
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);
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) {
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.
{
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);
static void /*__exit*/ mds_exit(void)
{
+ mds_group_hash_cleanup();
+
class_unregister_type(LUSTRE_MDS_NAME);
class_unregister_type(LUSTRE_MDT_NAME);
}
{ 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(¶m, 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 },
+ { "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 }
};
-
-#endif
+#endif /* LPROCFS */
struct lprocfs_static_vars lprocfs_array_vars[] = { {lprocfs_mds_module_vars,
lprocfs_mds_obd_vars},
--- /dev/null
+/* -*- 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);
+}
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_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,
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 */
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_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 */
#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_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);
b->nlink = inode->i_nlink;
}
b->generation = inode->i_generation;
- b->suppgid = -1;
b->mds = obd->u.mds.mds_num;
}
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;
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_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);
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;
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_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;
ENTRY;
rec = lustre_swab_reqbuf (req, offset, sizeof (*rec),
- lustre_swab_mds_rec_unlink);
+ lustre_swab_mds_rec_rename);
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;
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_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);
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;
+}
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;
+ 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) {
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;
ldlm_lock_decref(lockh, LCK_EX);
l_dput(dentry);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
+ mds_exit_ucred(&uc);
default:
break;
}
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));
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;
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)
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));
- } 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;
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)) {
* (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];
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,
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;
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]);
}
- 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;
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)) {
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);
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;
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);
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;
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);
}
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(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;
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);
}
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,
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);
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);
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;
+ else
+ offset = 0;
body = lustre_msg_buf(req->rq_repmsg, offset, sizeof (*body));
LASSERT(body != NULL);
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,
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,
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]);
}
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;
+ 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");
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
* 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);
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);
}
}
+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)
{
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;
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);
+
request->rq_send_state = LUSTRE_IMP_NEW;
request->rq_replen = lustre_msg_size(0, NULL);
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);
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 */
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);
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;
OBD_FREE(request, sizeof(*request));
RETURN(NULL);
}
+ request->rq_reqmsg->version |= version;
if (imp->imp_server_timeout)
request->rq_timeout = obd_timeout / 2;
}
- 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);
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);
}
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 */
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);
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);
-
+
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->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);
-
+
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);
}
-
+
memcpy(buf, ptr, len);
-
out:
if (req)
ptlrpc_req_finished(req);
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);
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);
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));
-
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;
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;
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);
}
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_suppgid = op_data->ctxt.gid1;
tmp = lustre_msg_buf(msg, offset + 1, op_data->namelen + 1);
LOGL0(op_data->name, op_data->namelen, tmp);
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;
- 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_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));
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_suppgid = data->ctxt.gid1;
rec->ul_fid1 = data->fid1;
rec->ul_fid2 = data->fid2;
rec->ul_time = data->mod_time;
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;
/* 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;
__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);
__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->rdev);
__swab32s (&b->nlink);
__swab32s (&b->generation);
- __swab32s (&b->suppgid);
__swab32s (&b->eadatasize);
+ __swab32s (&b->mds);
}
void lustre_swab_clonefs_info (struct clonefs_info *clone)
{
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);
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_suppgid);
}
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);
}
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);
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);
}
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) */
(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",
(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)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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
+ 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",
(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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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));
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));
}
+
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;
- 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",
- imp->imp_obd->obd_uuid.uuid,
- imp->imp_target_uuid.uuid);
+ imp->imp_obd->obd_uuid.uuid,
+ imp->imp_target_uuid.uuid);
rc = -ENOMEM;
}
/* 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_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);
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);
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
--- /dev/null
+#!/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
$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
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
lfs_SOURCES = lfs.c
llmount_SOURCES = llmount.c
llmount_LDADD = $(LIBREADLINE) -lptlctl
+l_getgroups_SOURCES = l_getgroups.c
EXTRA_DIST = $(bin_SCRIPTS) $(sbin_SCRIPTS)
--- /dev/null
+/* -*- 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));
+}
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 " +
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(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, 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, mds);
CHECK_VALUE(FMODE_READ);
CHECK_VALUE(FMODE_WRITE);
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);
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_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_suppgid);
}
void
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);
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);
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);
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) */
(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)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)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));
- 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 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)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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
+ 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",
(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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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));
- 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 */
- 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));
- 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));
- 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));
- 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));
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));
}
+