#error Do not #include this file directly. #include <lvfs.h> instead
#endif
-#ifdef LLOG_LVFS
-#undef LLOG_LVFS
-#endif
-
-struct lvfs_ucred {
- __u32 luc_fsuid;
- __u32 luc_fsgid;
- kernel_cap_t luc_cap;
- __u32 luc_uid;
- __u32 luc_umask;
-};
-
struct lvfs_run_ctxt {
int pid;
};
EXTRA_DIST = lprocfs_status.h lustre_acl.h lustre_debug.h lustre_lib.h \
lustre_dlm.h lustre_handles.h lustre_net.h obd_class.h obd_support.h \
- lustre_log.h lustre_compat25.h \
- obd.h lvfs.h lvfs_linux.h lustre_lite.h lustre_quota.h \
+ obd.h lvfs.h lustre_log.h lustre_compat25.h lustre_lite.h lustre_quota.h \
lustre_user.h lustre_patchless_compat.h lustre_intent.h lustre_common.h
generic_permission(inode, mask, check_acl)
#endif
-#ifdef HAVE_DENTRY_OPEN_USE_PATH
-#define ll_dentry_open(a,b,c) dentry_open(a,b,c)
-#else
-/*
- * dentry_open handles its own reference counting since Linux v3.6
- * (commit 765927b2). Callers should free their own references.
- *
- * Prior versions expected the caller to increment the references.
- * The references are retained on success and freed on error.
- */
-static inline struct file *ll_dentry_open(struct path *path, int flags,
- const struct cred *cred)
-{
- mntget(path->mnt);
- dget(path->dentry);
- return dentry_open(path->dentry, path->mnt, flags, cred);
-}
-#endif
-
#ifdef HAVE_4ARGS_VFS_SYMLINK
#define ll_vfs_symlink(dir, dentry, mnt, path, mode) \
vfs_symlink(dir, dentry, path, mode)
#if defined __KERNEL__
#include <linux/lustre_compat25.h>
#include <linux/lustre_common.h>
-#include <linux/lvfs_linux.h>
+#include <linux/fs.h>
#else
#include <liblustre.h>
#endif
-#define LLOG_LVFS
+#define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
+#define OBD_CTXT_DEBUG /* development-only debugging */
-/* simple.c */
+struct dt_device;
-struct lvfs_ucred {
- __u32 luc_uid;
- __u32 luc_gid;
- __u32 luc_fsuid;
- __u32 luc_fsgid;
- kernel_cap_t luc_cap;
- __u32 luc_umask;
- struct group_info *luc_ginfo;
- struct md_identity *luc_identity;
-};
-
-#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 group_info *group_info;
+ struct vfsmount *pwdmnt;
+ struct dentry *pwd;
+ mm_segment_t fs;
+ uint32_t umask;
struct dt_device *dt;
#ifdef OBD_CTXT_DEBUG
- __u32 magic;
+ uint32_t magic;
#endif
};
#ifdef __KERNEL__
-int lustre_rename(struct dentry *dir, struct vfsmount *mnt, char *oldname,
- char *newname);
-
-static inline void l_dput(struct dentry *de)
-{
- if (!de || IS_ERR(de))
- return;
- //shrink_dcache_parent(de);
- LASSERT(d_count(de) > 0);
- dput(de);
-}
-
/* We need to hold the inode semaphore over the dcache lookup itself, or we
* run the risk of entering the filesystem lookup path concurrently on SMP
* systems, and instantiating two inodes for the same entry. We still
+++ /dev/null
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#ifndef __LVFS_LINUX_H__
-#define __LVFS_LINUX_H__
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/sched.h>
-
-#include <lvfs.h>
-
-#define l_file file
-#define l_dentry dentry
-
-#define l_filp_open filp_open
-
-struct lvfs_run_ctxt;
-
-struct l_linux_dirent {
- cfs_list_t lld_list;
- ino_t lld_ino;
- unsigned long lld_off;
- char lld_name[LL_FID_NAMELEN];
-};
-struct l_readdir_callback {
- struct l_linux_dirent *lrc_dirent;
- cfs_list_t *lrc_list;
-};
-
-#endif /* __LVFS_LINUX_H__ */
#ifndef __LVFS_H__
#define __LVFS_H__
-#define LL_FID_NAMELEN (16 + 1 + 8 + 1)
-
#include <libcfs/libcfs.h>
#if defined(__linux__)
#include <linux/lvfs.h>
#error Unsupported operating system.
#endif
-#include <libcfs/lucache.h>
-
-#ifdef LIBLUSTRE
-#include <lvfs_user_fs.h>
-#endif
-
-/* lvfs_linux.c */
-void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
- struct lvfs_ucred *cred);
-void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
- struct lvfs_ucred *cred);
+/* ptlrpc_sec_ctx.c */
+void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx);
+void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx);
#endif
#include <lustre_fid.h>
#include <lustre_fld.h>
#include <lustre_capa.h>
+#include <lvfs.h>
#define MAX_OBD_DEVICES 8192
#define _OBD_SUPPORT
#include <libcfs/libcfs.h>
-#include <lvfs.h>
#include <lprocfs_status.h>
#if defined(__linux__)
#if defined(__KERNEL__)
+#include <libcfs/lucache.h>
#include <lustre_net.h>
#include <lustre/lustre_idl.h>
#include <obd_class.h>
#define DEBUG_SUBSYSTEM S_SEC
+#include <libcfs/lucache.h>
+
#include <lustre_idmap.h>
#include <md_object.h>
#include <obd_support.h>
struct lvfs_run_ctxt *newctxt,
struct lvfs_run_ctxt *save)
{
- OBD_SET_CTXT_MAGIC(newctxt);
- newctxt->pwdmnt = dev->od_mnt;
- newctxt->pwd = dev->od_mnt->mnt_root;
- newctxt->fs = get_ds();
+ OBD_SET_CTXT_MAGIC(newctxt);
+ newctxt->pwdmnt = dev->od_mnt;
+ newctxt->pwd = dev->od_mnt->mnt_root;
+ newctxt->fs = get_ds();
- push_ctxt(save, newctxt, NULL);
-}
-
-static void osd_pop_ctxt(const struct osd_device *dev,
- struct lvfs_run_ctxt *new,
- struct lvfs_run_ctxt *save)
-{
- pop_ctxt(save, new, NULL);
+ push_ctxt(save, newctxt);
}
/* utility to make a directory */
GOTO(cleanup, rc);
cleanup:
- pop_ctxt(&save, &new, NULL);
+ pop_ctxt(&save, &new);
if (rc) {
if (omm->omm_remote_parent != NULL)
dput(omm->omm_remote_parent);
GOTO(cleanup, rc);
cleanup:
- osd_pop_ctxt(dev, &new, &save);
+ pop_ctxt(&new, &save);
if (IS_ERR(d)) {
OBD_FREE_PTR(dev->od_ost_map);
RETURN(PTR_ERR(d));
spin_lock_init(&scrub->os_lock);
CFS_INIT_LIST_HEAD(&scrub->os_inconsistent_items);
- push_ctxt(&saved, ctxt, NULL);
+ push_ctxt(&saved, ctxt);
filp = filp_open(osd_scrub_name, O_RDWR | O_CREAT, 0644);
if (IS_ERR(filp)) {
- pop_ctxt(&saved, ctxt, NULL);
+ pop_ctxt(&saved, ctxt);
RETURN(PTR_ERR(filp));
}
rc = osd_ea_fid_set(info, inode, fid, LMAC_NOT_IN_OI, 0);
if (rc != 0) {
filp_close(filp, 0);
- pop_ctxt(&saved, ctxt, NULL);
+ pop_ctxt(&saved, ctxt);
RETURN(rc);
}
scrub->os_inode = igrab(inode);
filp_close(filp, 0);
- pop_ctxt(&saved, ctxt, NULL);
+ pop_ctxt(&saved, ctxt);
rc = osd_scrub_file_load(scrub);
if (rc == -ENOENT) {
int sptlrpc_conf_init(void);
void sptlrpc_conf_fini(void);
+int lustre_rename(struct dentry *dir, struct vfsmount *mnt, char *old_name,
+ char *new_name);
+
/* sec.c */
int sptlrpc_init(void);
void sptlrpc_fini(void);
int rc;
ENTRY;
- ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+ ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
if (ctxt == NULL)
- RETURN(-EINVAL);
+ RETURN(-EINVAL);
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt);
dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, current->fs->pwd.dentry,
strlen(MOUNT_CONFIGS_DIR));
rc = lustre_rename(dentry, obd->obd_lvfs_ctxt.pwdmnt,
LOG_SPTLRPC_TMP, LOG_SPTLRPC);
out_dput:
- l_dput(dentry);
+ dput(dentry);
out_ctx:
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- llog_ctxt_put(ctxt);
- CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n",
- obd->obd_name, rc);
- RETURN(rc);
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt);
+ llog_ctxt_put(ctxt);
+ CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n",
+ obd->obd_name, rc);
+ RETURN(rc);
}
static int local_read_handler(const struct lu_env *env,
RETURN(-EINVAL);
}
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt);
rc = llog_open(NULL, ctxt, &llh, NULL, LOG_SPTLRPC, LLOG_OPEN_EXISTS);
if (rc < 0) {
out_close:
llog_close(NULL, llh);
out_pop:
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- llog_ctxt_put(ctxt);
- CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n",
- obd->obd_name, rc);
- RETURN(rc);
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt);
+ llog_ctxt_put(ctxt);
+ CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n",
+ obd->obd_name, rc);
+ RETURN(rc);
}
#endif /* __KRENEL__ */
#define DEBUG_SUBSYSTEM S_FILTER
-#include <linux/version.h>
#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-#include <linux/quotaops.h>
-#include <linux/version.h>
#include <libcfs/libcfs.h>
-#include <obd.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/lustre_compat25.h>
#include <lvfs.h>
-#include <obd.h>
-#include <lustre_lib.h>
-
/* refine later and change to seqlock or simlar from libcfs */
/* Debugging check only needed during development */
#ifdef OBD_CTXT_DEBUG
# define ASSERT_KERNEL_CTXT(msg) do {} while(0)
#endif
-static void push_group_info(struct lvfs_run_ctxt *save,
- struct group_info *ginfo)
-{
- if (!ginfo) {
- save->ngroups = current_ngroups;
- current_ngroups = 0;
- } else {
- struct cred *cred;
- task_lock(current);
- save->group_info = current_cred()->group_info;
- if ((cred = prepare_creds())) {
- cred->group_info = ginfo;
- commit_creds(cred);
- }
- task_unlock(current);
- }
-}
-
-static void pop_group_info(struct lvfs_run_ctxt *save,
- struct group_info *ginfo)
-{
- if (!ginfo) {
- current_ngroups = save->ngroups;
- } else {
- struct cred *cred;
- task_lock(current);
- if ((cred = prepare_creds())) {
- cred->group_info = save->group_info;
- commit_creds(cred);
- }
- task_unlock(current);
- }
-}
-
/* push / pop to root of obd store */
-void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
- struct lvfs_ucred *uc)
+void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx)
{
/* if there is underlaying dt_device then push_ctxt is not needed */
if (new_ctx->dt != NULL)
LASSERT(d_count(new_ctx->pwd));
save->pwd = dget(current->fs->pwd.dentry);
save->pwdmnt = mntget(current->fs->pwd.mnt);
- save->luc.luc_umask = current_umask();
- save->ngroups = current_cred()->group_info->ngroups;
+ save->umask = current_umask();
LASSERT(save->pwd);
LASSERT(save->pwdmnt);
LASSERT(new_ctx->pwd);
LASSERT(new_ctx->pwdmnt);
- if (uc) {
- struct cred *cred;
- save->luc.luc_uid = current_uid();
- save->luc.luc_gid = current_gid();
- save->luc.luc_fsuid = current_fsuid();
- save->luc.luc_fsgid = current_fsgid();
- save->luc.luc_cap = current_cap();
-
- if ((cred = prepare_creds())) {
- cred->uid = uc->luc_uid;
- cred->gid = uc->luc_gid;
- cred->fsuid = uc->luc_fsuid;
- cred->fsgid = uc->luc_fsgid;
- cred->cap_effective = uc->luc_cap;
- commit_creds(cred);
- }
-
- push_group_info(save,
- uc->luc_ginfo ?:
- uc->luc_identity ? uc->luc_identity->mi_ginfo :
- NULL);
- }
current->fs->umask = 0; /* umask already applied on client */
set_fs(new_ctx->fs);
ll_set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
}
EXPORT_SYMBOL(push_ctxt);
-void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
- struct lvfs_ucred *uc)
+void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx)
{
/* if there is underlaying dt_device then pop_ctxt is not needed */
if (new_ctx->dt != NULL)
dput(saved->pwd);
mntput(saved->pwdmnt);
- current->fs->umask = saved->luc.luc_umask;
- if (uc) {
- struct cred *cred;
- if ((cred = prepare_creds())) {
- cred->uid = saved->luc.luc_uid;
- cred->gid = saved->luc.luc_gid;
- cred->fsuid = saved->luc.luc_fsuid;
- cred->fsgid = saved->luc.luc_fsgid;
- cred->cap_effective = saved->luc.luc_cap;
- commit_creds(cred);
- }
-
- pop_group_info(saved,
- uc->luc_ginfo ?:
- uc->luc_identity ? uc->luc_identity->mi_ginfo :
- NULL);
- }
+ current->fs->umask = saved->umask;
}
EXPORT_SYMBOL(pop_ctxt);
dput(dchild_old);
RETURN(err);
}
-EXPORT_SYMBOL(lustre_rename);
#endif /* __KERNEL__ */