# 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
+#else
+#define current_ngroups current->ngroups
+#define current_groups current->groups
+#endif
+
/* push / pop to root of obd store */
-void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx,
- struct obd_ucred *uc)
+void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
+ struct lvfs_ucred *uc)
{
//ASSERT_NOT_KERNEL_CTXT("already in kernel context!\n");
ASSERT_CTXT_MAGIC(new_ctx->magic);
+ LASSERT(save->magic != OBD_RUN_CTXT_MAGIC || save->pid != current->pid);
OBD_SET_CTXT_MAGIC(save);
+ save->pid = current->pid;
/*
CDEBUG(D_INFO,
LASSERT(atomic_read(&new_ctx->pwd->d_count));
save->pwd = dget(current->fs->pwd);
save->pwdmnt = mntget(current->fs->pwdmnt);
- save->ngroups = current->ngroups;
+ save->ngroups = current_ngroups;
LASSERT(save->pwd);
LASSERT(save->pwdmnt);
LASSERT(new_ctx->pwdmnt);
if (uc) {
- save->ouc.ouc_fsuid = current->fsuid;
- save->ouc.ouc_fsgid = current->fsgid;
- save->ouc.ouc_cap = current->cap_effective;
- save->ouc.ouc_suppgid1 = current->groups[0];
- save->ouc.ouc_suppgid2 = current->groups[1];
-
- current->fsuid = uc->ouc_fsuid;
- current->fsgid = uc->ouc_fsgid;
- current->cap_effective = uc->ouc_cap;
- current->ngroups = 0;
-
- if (uc->ouc_suppgid1 != -1)
- current->groups[current->ngroups++] = uc->ouc_suppgid1;
- if (uc->ouc_suppgid2 != -1)
- current->groups[current->ngroups++] = uc->ouc_suppgid2;
+ 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;
}
set_fs(new_ctx->fs);
set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
}
EXPORT_SYMBOL(push_ctxt);
-void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx,
- struct obd_ucred *uc)
+void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
+ struct lvfs_ucred *uc)
{
//printk("pc0");
ASSERT_CTXT_MAGIC(saved->magic);
+ LASSERT(saved->pid == current->pid);
+ saved->magic = 0;
+ saved->pid = 0;
//printk("pc1");
ASSERT_KERNEL_CTXT("popping non-kernel context!\n");
dput(saved->pwd);
mntput(saved->pwdmnt);
if (uc) {
- current->fsuid = saved->ouc.ouc_fsuid;
- current->fsgid = saved->ouc.ouc_fsgid;
- current->cap_effective = saved->ouc.ouc_cap;
- current->ngroups = saved->ngroups;
- current->groups[0] = saved->ouc.ouc_suppgid1;
- current->groups[1] = saved->ouc.ouc_suppgid2;
+ 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;
}
/*
}
EXPORT_SYMBOL(lustre_fsync);
-struct l_file *l_dentry_open(struct obd_run_ctxt *ctxt, struct l_dentry *de,
+struct l_file *l_dentry_open(struct lvfs_run_ctxt *ctxt, struct l_dentry *de,
int flags)
{
mntget(ctxt->pwdmnt);