1
0
Fork 0

fs: make helpers idmap mount aware

Extend some inode methods with an additional user namespace argument. A
filesystem that is aware of idmapped mounts will receive the user
namespace the mount has been marked with. This can be used for
additional permission checking and also to enable filesystems to
translate between uids and gids if they need to. We have implemented all
relevant helpers in earlier patches.

As requested we simply extend the exisiting inode method instead of
introducing new ones. This is a little more code churn but it's mostly
mechanical and doesnt't leave us with additional inode methods.

Link: https://lore.kernel.org/r/20210121131959.646623-25-christian.brauner@ubuntu.com
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
master
Christian Brauner 2021-01-21 14:19:43 +01:00
parent 1ab29965b3
commit 549c729771
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
182 changed files with 1121 additions and 756 deletions

View File

@ -415,28 +415,29 @@ As of kernel 2.6.22, the following members are defined:
.. code-block:: c .. code-block:: c
struct inode_operations { struct inode_operations {
int (*create) (struct inode *,struct dentry *, umode_t, bool); int (*create) (struct user_namespace *, struct inode *,struct dentry *, umode_t, bool);
struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
int (*link) (struct dentry *,struct inode *,struct dentry *); int (*link) (struct dentry *,struct inode *,struct dentry *);
int (*unlink) (struct inode *,struct dentry *); int (*unlink) (struct inode *,struct dentry *);
int (*symlink) (struct inode *,struct dentry *,const char *); int (*symlink) (struct user_namespace *, struct inode *,struct dentry *,const char *);
int (*mkdir) (struct inode *,struct dentry *,umode_t); int (*mkdir) (struct user_namespace *, struct inode *,struct dentry *,umode_t);
int (*rmdir) (struct inode *,struct dentry *); int (*rmdir) (struct inode *,struct dentry *);
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,umode_t,dev_t);
int (*rename) (struct inode *, struct dentry *, int (*rename) (struct user_namespace *, struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int); struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int); int (*readlink) (struct dentry *, char __user *,int);
const char *(*get_link) (struct dentry *, struct inode *, const char *(*get_link) (struct dentry *, struct inode *,
struct delayed_call *); struct delayed_call *);
int (*permission) (struct inode *, int); int (*permission) (struct user_namespace *, struct inode *, int);
int (*get_acl)(struct inode *, int); int (*get_acl)(struct inode *, int);
int (*setattr) (struct dentry *, struct iattr *); int (*setattr) (struct user_namespace *, struct dentry *, struct iattr *);
int (*getattr) (const struct path *, struct kstat *, u32, unsigned int); int (*getattr) (struct user_namespace *, const struct path *, struct kstat *, u32, unsigned int);
ssize_t (*listxattr) (struct dentry *, char *, size_t); ssize_t (*listxattr) (struct dentry *, char *, size_t);
void (*update_time)(struct inode *, struct timespec *, int); void (*update_time)(struct inode *, struct timespec *, int);
int (*atomic_open)(struct inode *, struct dentry *, struct file *, int (*atomic_open)(struct inode *, struct dentry *, struct file *,
unsigned open_flag, umode_t create_mode); unsigned open_flag, umode_t create_mode);
int (*tmpfile) (struct inode *, struct dentry *, umode_t); int (*tmpfile) (struct user_namespace *, struct inode *, struct dentry *, umode_t);
int (*set_acl)(struct user_namespace *, struct inode *, struct posix_acl *, int);
}; };
Again, all methods are called without any locks being held, unless Again, all methods are called without any locks being held, unless

View File

@ -91,7 +91,8 @@ out:
} }
static int static int
spufs_setattr(struct dentry *dentry, struct iattr *attr) spufs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);

View File

@ -355,7 +355,8 @@ static inline bool is_binderfs_control_device(const struct dentry *dentry)
return info->control_dentry == dentry; return info->control_dentry == dentry;
} }
static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry, static int binderfs_rename(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {
@ -363,7 +364,8 @@ static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry,
is_binderfs_control_device(new_dentry)) is_binderfs_control_device(new_dentry))
return -EPERM; return -EPERM;
return simple_rename(old_dir, old_dentry, new_dir, new_dentry, flags); return simple_rename(&init_user_ns, old_dir, old_dentry, new_dir,
new_dentry, flags);
} }
static int binderfs_unlink(struct inode *dir, struct dentry *dentry) static int binderfs_unlink(struct inode *dir, struct dentry *dentry)

View File

@ -280,7 +280,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
struct iattr iattr = { 0 }; struct iattr iattr = { 0 };
struct posix_acl *old_acl = acl; struct posix_acl *old_acl = acl;
retval = posix_acl_update_mode(mnt_userns, inode, retval = posix_acl_update_mode(&init_user_ns, inode,
&iattr.ia_mode, &acl); &iattr.ia_mode, &acl);
if (retval) if (retval)
goto err_out; goto err_out;
@ -299,7 +299,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
* What is the following setxattr update the * What is the following setxattr update the
* mode ? * mode ?
*/ */
v9fs_vfs_setattr_dotl(dentry, &iattr); v9fs_vfs_setattr_dotl(&init_user_ns, dentry, &iattr);
} }
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:

View File

@ -135,7 +135,8 @@ extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags); unsigned int flags);
extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d); extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d);
extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d); extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d);
extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, extern int v9fs_vfs_rename(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags); unsigned int flags);
extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses, extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses,

View File

@ -59,7 +59,8 @@ void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat);
int v9fs_uflags2omode(int uflags, int extended); int v9fs_uflags2omode(int uflags, int extended);
void v9fs_blank_wstat(struct p9_wstat *wstat); void v9fs_blank_wstat(struct p9_wstat *wstat);
int v9fs_vfs_setattr_dotl(struct dentry *, struct iattr *); int v9fs_vfs_setattr_dotl(struct user_namespace *, struct dentry *,
struct iattr *);
int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end, int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
int datasync); int datasync);
int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode); int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode);

View File

@ -676,8 +676,8 @@ error:
*/ */
static int static int
v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, v9fs_vfs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
u32 perm = unixmode2p9mode(v9ses, mode); u32 perm = unixmode2p9mode(v9ses, mode);
@ -702,7 +702,8 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
* *
*/ */
static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int v9fs_vfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
int err; int err;
u32 perm; u32 perm;
@ -907,9 +908,9 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)
*/ */
int int
v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, v9fs_vfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
int retval; int retval;
struct inode *old_inode; struct inode *old_inode;
@ -1016,8 +1017,8 @@ done:
*/ */
static int static int
v9fs_vfs_getattr(const struct path *path, struct kstat *stat, v9fs_vfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int flags) struct kstat *stat, u32 request_mask, unsigned int flags)
{ {
struct dentry *dentry = path->dentry; struct dentry *dentry = path->dentry;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
@ -1054,7 +1055,8 @@ v9fs_vfs_getattr(const struct path *path, struct kstat *stat,
* *
*/ */
static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) static int v9fs_vfs_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *iattr)
{ {
int retval, use_dentry = 0; int retval, use_dentry = 0;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
@ -1295,7 +1297,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
*/ */
static int static int
v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) v9fs_vfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, const char *symname)
{ {
p9_debug(P9_DEBUG_VFS, " %lu,%pd,%s\n", p9_debug(P9_DEBUG_VFS, " %lu,%pd,%s\n",
dir->i_ino, dentry, symname); dir->i_ino, dentry, symname);
@ -1348,7 +1351,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
*/ */
static int static int
v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) v9fs_vfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
int retval; int retval;

View File

@ -33,8 +33,8 @@
#include "acl.h" #include "acl.h"
static int static int
v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
dev_t rdev); struct dentry *dentry, umode_t omode, dev_t rdev);
/** /**
* v9fs_get_fsgid_for_create - Helper function to get the gid for creating a * v9fs_get_fsgid_for_create - Helper function to get the gid for creating a
@ -218,10 +218,10 @@ int v9fs_open_to_dotl_flags(int flags)
*/ */
static int static int
v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, v9fs_vfs_create_dotl(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t omode, bool excl)
{ {
return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0); return v9fs_vfs_mknod_dotl(mnt_userns, dir, dentry, omode, 0);
} }
static int static int
@ -367,8 +367,9 @@ err_clunk_old_fid:
* *
*/ */
static int v9fs_vfs_mkdir_dotl(struct inode *dir, static int v9fs_vfs_mkdir_dotl(struct user_namespace *mnt_userns,
struct dentry *dentry, umode_t omode) struct inode *dir, struct dentry *dentry,
umode_t omode)
{ {
int err; int err;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
@ -457,8 +458,9 @@ error:
} }
static int static int
v9fs_vfs_getattr_dotl(const struct path *path, struct kstat *stat, v9fs_vfs_getattr_dotl(struct user_namespace *mnt_userns,
u32 request_mask, unsigned int flags) const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags)
{ {
struct dentry *dentry = path->dentry; struct dentry *dentry = path->dentry;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
@ -540,7 +542,8 @@ static int v9fs_mapped_iattr_valid(int iattr_valid)
* *
*/ */
int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) int v9fs_vfs_setattr_dotl(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *iattr)
{ {
int retval, use_dentry = 0; int retval, use_dentry = 0;
struct p9_fid *fid = NULL; struct p9_fid *fid = NULL;
@ -684,8 +687,8 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
} }
static int static int
v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, v9fs_vfs_symlink_dotl(struct user_namespace *mnt_userns, struct inode *dir,
const char *symname) struct dentry *dentry, const char *symname)
{ {
int err; int err;
kgid_t gid; kgid_t gid;
@ -824,8 +827,8 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
* *
*/ */
static int static int
v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
dev_t rdev) struct dentry *dentry, umode_t omode, dev_t rdev)
{ {
int err; int err;
kgid_t gid; kgid_t gid;

View File

@ -144,7 +144,8 @@ struct adfs_discmap {
/* Inode stuff */ /* Inode stuff */
struct inode *adfs_iget(struct super_block *sb, struct object_info *obj); struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
int adfs_write_inode(struct inode *inode, struct writeback_control *wbc); int adfs_write_inode(struct inode *inode, struct writeback_control *wbc);
int adfs_notify_change(struct dentry *dentry, struct iattr *attr); int adfs_notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr);
/* map.c */ /* map.c */
int adfs_map_lookup(struct super_block *sb, u32 frag_id, unsigned int offset); int adfs_map_lookup(struct super_block *sb, u32 frag_id, unsigned int offset);

View File

@ -292,7 +292,8 @@ out:
* later. * later.
*/ */
int int
adfs_notify_change(struct dentry *dentry, struct iattr *attr) adfs_notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;

View File

@ -167,27 +167,33 @@ extern const struct export_operations affs_export_ops;
extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len); extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len);
extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int); extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int);
extern int affs_unlink(struct inode *dir, struct dentry *dentry); extern int affs_unlink(struct inode *dir, struct dentry *dentry);
extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool); extern int affs_create(struct user_namespace *mnt_userns, struct inode *dir,
extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); struct dentry *dentry, umode_t mode, bool);
extern int affs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode);
extern int affs_rmdir(struct inode *dir, struct dentry *dentry); extern int affs_rmdir(struct inode *dir, struct dentry *dentry);
extern int affs_link(struct dentry *olddentry, struct inode *dir, extern int affs_link(struct dentry *olddentry, struct inode *dir,
struct dentry *dentry); struct dentry *dentry);
extern int affs_symlink(struct inode *dir, struct dentry *dentry, extern int affs_symlink(struct user_namespace *mnt_userns,
const char *symname); struct inode *dir, struct dentry *dentry,
extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, const char *symname);
struct inode *new_dir, struct dentry *new_dentry, extern int affs_rename2(struct user_namespace *mnt_userns,
unsigned int flags); struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags);
/* inode.c */ /* inode.c */
extern struct inode *affs_new_inode(struct inode *dir); extern struct inode *affs_new_inode(struct inode *dir);
extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); extern int affs_notify_change(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *attr);
extern void affs_evict_inode(struct inode *inode); extern void affs_evict_inode(struct inode *inode);
extern struct inode *affs_iget(struct super_block *sb, extern struct inode *affs_iget(struct super_block *sb,
unsigned long ino); unsigned long ino);
extern int affs_write_inode(struct inode *inode, extern int affs_write_inode(struct inode *inode,
struct writeback_control *wbc); struct writeback_control *wbc);
extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type); extern int affs_add_entry(struct inode *dir, struct inode *inode,
struct dentry *dentry, s32 type);
/* file.c */ /* file.c */

View File

@ -216,7 +216,8 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
} }
int int
affs_notify_change(struct dentry *dentry, struct iattr *attr) affs_notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;

View File

@ -242,7 +242,8 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
} }
int int
affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) affs_create(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, bool excl)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
@ -273,7 +274,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
} }
int int
affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) affs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct inode *inode; struct inode *inode;
int error; int error;
@ -311,7 +313,8 @@ affs_rmdir(struct inode *dir, struct dentry *dentry)
} }
int int
affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) affs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, const char *symname)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct buffer_head *bh; struct buffer_head *bh;
@ -498,9 +501,9 @@ done:
return retval; return retval;
} }
int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, int affs_rename2(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))

View File

@ -28,18 +28,19 @@ static int afs_lookup_one_filldir(struct dir_context *ctx, const char *name, int
loff_t fpos, u64 ino, unsigned dtype); loff_t fpos, u64 ino, unsigned dtype);
static int afs_lookup_filldir(struct dir_context *ctx, const char *name, int nlen, static int afs_lookup_filldir(struct dir_context *ctx, const char *name, int nlen,
loff_t fpos, u64 ino, unsigned dtype); loff_t fpos, u64 ino, unsigned dtype);
static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int afs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl); struct dentry *dentry, umode_t mode, bool excl);
static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); static int afs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode);
static int afs_rmdir(struct inode *dir, struct dentry *dentry); static int afs_rmdir(struct inode *dir, struct dentry *dentry);
static int afs_unlink(struct inode *dir, struct dentry *dentry); static int afs_unlink(struct inode *dir, struct dentry *dentry);
static int afs_link(struct dentry *from, struct inode *dir, static int afs_link(struct dentry *from, struct inode *dir,
struct dentry *dentry); struct dentry *dentry);
static int afs_symlink(struct inode *dir, struct dentry *dentry, static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *content); struct dentry *dentry, const char *content);
static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags); struct dentry *new_dentry, unsigned int flags);
static int afs_dir_releasepage(struct page *page, gfp_t gfp_flags); static int afs_dir_releasepage(struct page *page, gfp_t gfp_flags);
static void afs_dir_invalidatepage(struct page *page, unsigned int offset, static void afs_dir_invalidatepage(struct page *page, unsigned int offset,
unsigned int length); unsigned int length);
@ -1325,7 +1326,8 @@ static const struct afs_operation_ops afs_mkdir_operation = {
/* /*
* create a directory on an AFS filesystem * create a directory on an AFS filesystem
*/ */
static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int afs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_vnode *dvnode = AFS_FS_I(dir); struct afs_vnode *dvnode = AFS_FS_I(dir);
@ -1619,8 +1621,8 @@ static const struct afs_operation_ops afs_create_operation = {
/* /*
* create a regular file on an AFS filesystem * create a regular file on an AFS filesystem
*/ */
static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int afs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_vnode *dvnode = AFS_FS_I(dir); struct afs_vnode *dvnode = AFS_FS_I(dir);
@ -1741,8 +1743,8 @@ static const struct afs_operation_ops afs_symlink_operation = {
/* /*
* create a symlink in an AFS filesystem * create a symlink in an AFS filesystem
*/ */
static int afs_symlink(struct inode *dir, struct dentry *dentry, static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *content) struct dentry *dentry, const char *content)
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_vnode *dvnode = AFS_FS_I(dir); struct afs_vnode *dvnode = AFS_FS_I(dir);
@ -1876,9 +1878,9 @@ static const struct afs_operation_ops afs_rename_operation = {
/* /*
* rename a file in an AFS filesystem and/or move it between directories * rename a file in an AFS filesystem and/or move it between directories
*/ */
static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_vnode *orig_dvnode, *new_dvnode, *vnode; struct afs_vnode *orig_dvnode, *new_dvnode, *vnode;

View File

@ -734,8 +734,8 @@ error_unlock:
/* /*
* read the attributes of an inode * read the attributes of an inode
*/ */
int afs_getattr(const struct path *path, struct kstat *stat, int afs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags) struct kstat *stat, u32 request_mask, unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_vnode *vnode = AFS_FS_I(inode);
@ -857,7 +857,8 @@ static const struct afs_operation_ops afs_setattr_operation = {
/* /*
* set the attributes of an inode * set the attributes of an inode
*/ */
int afs_setattr(struct dentry *dentry, struct iattr *attr) int afs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry));

View File

@ -1149,8 +1149,9 @@ extern struct inode *afs_iget(struct afs_operation *, struct afs_vnode_param *);
extern struct inode *afs_root_iget(struct super_block *, struct key *); extern struct inode *afs_root_iget(struct super_block *, struct key *);
extern bool afs_check_validity(struct afs_vnode *); extern bool afs_check_validity(struct afs_vnode *);
extern int afs_validate(struct afs_vnode *, struct key *); extern int afs_validate(struct afs_vnode *, struct key *);
extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int); extern int afs_getattr(struct user_namespace *mnt_userns, const struct path *,
extern int afs_setattr(struct dentry *, struct iattr *); struct kstat *, u32, unsigned int);
extern int afs_setattr(struct user_namespace *mnt_userns, struct dentry *, struct iattr *);
extern void afs_evict_inode(struct inode *); extern void afs_evict_inode(struct inode *);
extern int afs_drop_inode(struct inode *); extern int afs_drop_inode(struct inode *);
@ -1361,7 +1362,7 @@ extern void afs_zap_permits(struct rcu_head *);
extern struct key *afs_request_key(struct afs_cell *); extern struct key *afs_request_key(struct afs_cell *);
extern struct key *afs_request_key_rcu(struct afs_cell *); extern struct key *afs_request_key_rcu(struct afs_cell *);
extern int afs_check_permit(struct afs_vnode *, struct key *, afs_access_t *); extern int afs_check_permit(struct afs_vnode *, struct key *, afs_access_t *);
extern int afs_permission(struct inode *, int); extern int afs_permission(struct user_namespace *, struct inode *, int);
extern void __exit afs_clean_up_permit_cache(void); extern void __exit afs_clean_up_permit_cache(void);
/* /*

View File

@ -396,7 +396,8 @@ int afs_check_permit(struct afs_vnode *vnode, struct key *key,
* - AFS ACLs are attached to directories only, and a file is controlled by its * - AFS ACLs are attached to directories only, and a file is controlled by its
* parent directory's ACL * parent directory's ACL
*/ */
int afs_permission(struct inode *inode, int mask) int afs_permission(struct user_namespace *mnt_userns, struct inode *inode,
int mask)
{ {
struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_vnode *vnode = AFS_FS_I(inode);
afs_access_t access; afs_access_t access;

View File

@ -395,9 +395,9 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
return error; return error;
if (inode->i_op->setattr) if (inode->i_op->setattr)
error = inode->i_op->setattr(dentry, attr); error = inode->i_op->setattr(mnt_userns, dentry, attr);
else else
error = simple_setattr(dentry, attr); error = simple_setattr(mnt_userns, dentry, attr);
if (!error) { if (!error) {
fsnotify_change(dentry, ia_valid); fsnotify_change(dentry, ia_valid);

View File

@ -10,10 +10,12 @@
#include "autofs_i.h" #include "autofs_i.h"
static int autofs_dir_symlink(struct inode *, struct dentry *, const char *); static int autofs_dir_symlink(struct user_namespace *, struct inode *,
struct dentry *, const char *);
static int autofs_dir_unlink(struct inode *, struct dentry *); static int autofs_dir_unlink(struct inode *, struct dentry *);
static int autofs_dir_rmdir(struct inode *, struct dentry *); static int autofs_dir_rmdir(struct inode *, struct dentry *);
static int autofs_dir_mkdir(struct inode *, struct dentry *, umode_t); static int autofs_dir_mkdir(struct user_namespace *, struct inode *,
struct dentry *, umode_t);
static long autofs_root_ioctl(struct file *, unsigned int, unsigned long); static long autofs_root_ioctl(struct file *, unsigned int, unsigned long);
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static long autofs_root_compat_ioctl(struct file *, static long autofs_root_compat_ioctl(struct file *,
@ -524,9 +526,9 @@ static struct dentry *autofs_lookup(struct inode *dir,
return NULL; return NULL;
} }
static int autofs_dir_symlink(struct inode *dir, static int autofs_dir_symlink(struct user_namespace *mnt_userns,
struct dentry *dentry, struct inode *dir, struct dentry *dentry,
const char *symname) const char *symname)
{ {
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb); struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
struct autofs_info *ino = autofs_dentry_ino(dentry); struct autofs_info *ino = autofs_dentry_ino(dentry);
@ -715,8 +717,9 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
return 0; return 0;
} }
static int autofs_dir_mkdir(struct inode *dir, static int autofs_dir_mkdir(struct user_namespace *mnt_userns,
struct dentry *dentry, umode_t mode) struct inode *dir, struct dentry *dentry,
umode_t mode)
{ {
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb); struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
struct autofs_info *ino = autofs_dentry_ino(dentry); struct autofs_info *ino = autofs_dentry_ino(dentry);

View File

@ -27,8 +27,9 @@ static const struct file_operations bad_file_ops =
.open = bad_file_open, .open = bad_file_open,
}; };
static int bad_inode_create (struct inode *dir, struct dentry *dentry, static int bad_inode_create(struct user_namespace *mnt_userns,
umode_t mode, bool excl) struct inode *dir, struct dentry *dentry,
umode_t mode, bool excl)
{ {
return -EIO; return -EIO;
} }
@ -50,14 +51,15 @@ static int bad_inode_unlink(struct inode *dir, struct dentry *dentry)
return -EIO; return -EIO;
} }
static int bad_inode_symlink (struct inode *dir, struct dentry *dentry, static int bad_inode_symlink(struct user_namespace *mnt_userns,
const char *symname) struct inode *dir, struct dentry *dentry,
const char *symname)
{ {
return -EIO; return -EIO;
} }
static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry, static int bad_inode_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode) struct dentry *dentry, umode_t mode)
{ {
return -EIO; return -EIO;
} }
@ -67,13 +69,14 @@ static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
return -EIO; return -EIO;
} }
static int bad_inode_mknod (struct inode *dir, struct dentry *dentry, static int bad_inode_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
return -EIO; return -EIO;
} }
static int bad_inode_rename2(struct inode *old_dir, struct dentry *old_dentry, static int bad_inode_rename2(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {
@ -86,18 +89,21 @@ static int bad_inode_readlink(struct dentry *dentry, char __user *buffer,
return -EIO; return -EIO;
} }
static int bad_inode_permission(struct inode *inode, int mask) static int bad_inode_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask)
{ {
return -EIO; return -EIO;
} }
static int bad_inode_getattr(const struct path *path, struct kstat *stat, static int bad_inode_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags) u32 request_mask, unsigned int query_flags)
{ {
return -EIO; return -EIO;
} }
static int bad_inode_setattr(struct dentry *direntry, struct iattr *attrs) static int bad_inode_setattr(struct user_namespace *mnt_userns,
struct dentry *direntry, struct iattr *attrs)
{ {
return -EIO; return -EIO;
} }
@ -140,13 +146,15 @@ static int bad_inode_atomic_open(struct inode *inode, struct dentry *dentry,
return -EIO; return -EIO;
} }
static int bad_inode_tmpfile(struct inode *inode, struct dentry *dentry, static int bad_inode_tmpfile(struct user_namespace *mnt_userns,
struct inode *inode, struct dentry *dentry,
umode_t mode) umode_t mode)
{ {
return -EIO; return -EIO;
} }
static int bad_inode_set_acl(struct inode *inode, struct posix_acl *acl, static int bad_inode_set_acl(struct user_namespace *mnt_userns,
struct inode *inode, struct posix_acl *acl,
int type) int type)
{ {
return -EIO; return -EIO;

View File

@ -75,8 +75,8 @@ const struct file_operations bfs_dir_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
}; };
static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int bfs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
int err; int err;
struct inode *inode; struct inode *inode;
@ -199,9 +199,9 @@ out_brelse:
return error; return error;
} }
static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, static int bfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
struct inode *old_inode, *new_inode; struct inode *old_inode, *new_inode;
struct buffer_head *old_bh, *new_bh; struct buffer_head *old_bh, *new_bh;

View File

@ -107,7 +107,8 @@ out:
return ret; return ret;
} }
int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) int btrfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
int ret; int ret;
umode_t old_mode = inode->i_mode; umode_t old_mode = inode->i_mode;

View File

@ -3625,7 +3625,8 @@ static inline int __btrfs_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag)
/* acl.c */ /* acl.c */
#ifdef CONFIG_BTRFS_FS_POSIX_ACL #ifdef CONFIG_BTRFS_FS_POSIX_ACL
struct posix_acl *btrfs_get_acl(struct inode *inode, int type); struct posix_acl *btrfs_get_acl(struct inode *inode, int type);
int btrfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); int btrfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
int btrfs_init_acl(struct btrfs_trans_handle *trans, int btrfs_init_acl(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *dir); struct inode *inode, struct inode *dir);
#else #else

View File

@ -5045,7 +5045,8 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
return ret; return ret;
} }
static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
@ -6352,8 +6353,8 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans,
return err; return err;
} }
static int btrfs_mknod(struct inode *dir, struct dentry *dentry, static int btrfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
@ -6416,8 +6417,8 @@ out_unlock:
return err; return err;
} }
static int btrfs_create(struct inode *dir, struct dentry *dentry, static int btrfs_create(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
@ -6561,7 +6562,8 @@ fail:
return err; return err;
} }
static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int btrfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
struct inode *inode = NULL; struct inode *inode = NULL;
@ -8816,7 +8818,8 @@ fail:
return -ENOMEM; return -ENOMEM;
} }
static int btrfs_getattr(const struct path *path, struct kstat *stat, static int btrfs_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags) u32 request_mask, unsigned int flags)
{ {
u64 delalloc_bytes; u64 delalloc_bytes;
@ -9333,9 +9336,9 @@ out_notrans:
return ret; return ret;
} }
static int btrfs_rename2(struct inode *old_dir, struct dentry *old_dentry, static int btrfs_rename2(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))
return -EINVAL; return -EINVAL;
@ -9543,8 +9546,8 @@ out:
return ret; return ret;
} }
static int btrfs_symlink(struct inode *dir, struct dentry *dentry, static int btrfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *symname) struct dentry *dentry, const char *symname)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;
@ -9878,7 +9881,8 @@ static int btrfs_set_page_dirty(struct page *page)
return __set_page_dirty_nobuffers(page); return __set_page_dirty_nobuffers(page);
} }
static int btrfs_permission(struct inode *inode, int mask) static int btrfs_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
umode_t mode = inode->i_mode; umode_t mode = inode->i_mode;
@ -9893,7 +9897,8 @@ static int btrfs_permission(struct inode *inode, int mask)
return generic_permission(&init_user_ns, inode, mask); return generic_permission(&init_user_ns, inode, mask);
} }
static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) static int btrfs_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb); struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
struct btrfs_trans_handle *trans; struct btrfs_trans_handle *trans;

View File

@ -82,7 +82,8 @@ retry:
return acl; return acl;
} }
int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) int ceph_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
int ret = 0, size = 0; int ret = 0, size = 0;
const char *name = NULL; const char *name = NULL;

View File

@ -823,8 +823,8 @@ int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry)
return PTR_ERR(result); return PTR_ERR(result);
} }
static int ceph_mknod(struct inode *dir, struct dentry *dentry, static int ceph_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
struct ceph_mds_request *req; struct ceph_mds_request *req;
@ -878,14 +878,14 @@ out:
return err; return err;
} }
static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int ceph_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
return ceph_mknod(dir, dentry, mode, 0); return ceph_mknod(mnt_userns, dir, dentry, mode, 0);
} }
static int ceph_symlink(struct inode *dir, struct dentry *dentry, static int ceph_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *dest) struct dentry *dentry, const char *dest)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
struct ceph_mds_request *req; struct ceph_mds_request *req;
@ -937,7 +937,8 @@ out:
return err; return err;
} }
static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int ceph_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
struct ceph_mds_request *req; struct ceph_mds_request *req;
@ -1183,9 +1184,9 @@ out:
return err; return err;
} }
static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, static int ceph_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(old_dir->i_sb); struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(old_dir->i_sb);
struct ceph_mds_request *req; struct ceph_mds_request *req;

View File

@ -2238,7 +2238,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
/* /*
* setattr * setattr
*/ */
int ceph_setattr(struct dentry *dentry, struct iattr *attr) int ceph_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct ceph_fs_client *fsc = ceph_inode_to_client(inode); struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
@ -2321,7 +2322,8 @@ int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
* Check inode permissions. We verify we have a valid value for * Check inode permissions. We verify we have a valid value for
* the AUTH cap, then call the generic handler. * the AUTH cap, then call the generic handler.
*/ */
int ceph_permission(struct inode *inode, int mask) int ceph_permission(struct user_namespace *mnt_userns, struct inode *inode,
int mask)
{ {
int err; int err;
@ -2368,8 +2370,8 @@ static int statx_to_caps(u32 want, umode_t mode)
* Get all the attributes. If we have sufficient caps for the requested attrs, * Get all the attributes. If we have sufficient caps for the requested attrs,
* then we can avoid talking to the MDS at all. * then we can avoid talking to the MDS at all.
*/ */
int ceph_getattr(const struct path *path, struct kstat *stat, int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int flags) struct kstat *stat, u32 request_mask, unsigned int flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);

View File

@ -973,10 +973,13 @@ static inline int ceph_do_getattr(struct inode *inode, int mask, bool force)
{ {
return __ceph_do_getattr(inode, NULL, mask, force); return __ceph_do_getattr(inode, NULL, mask, force);
} }
extern int ceph_permission(struct inode *inode, int mask); extern int ceph_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask);
extern int __ceph_setattr(struct inode *inode, struct iattr *attr); extern int __ceph_setattr(struct inode *inode, struct iattr *attr);
extern int ceph_setattr(struct dentry *dentry, struct iattr *attr); extern int ceph_setattr(struct user_namespace *mnt_userns,
extern int ceph_getattr(const struct path *path, struct kstat *stat, struct dentry *dentry, struct iattr *attr);
extern int ceph_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags); u32 request_mask, unsigned int flags);
/* xattr.c */ /* xattr.c */
@ -1037,7 +1040,8 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx);
#ifdef CONFIG_CEPH_FS_POSIX_ACL #ifdef CONFIG_CEPH_FS_POSIX_ACL
struct posix_acl *ceph_get_acl(struct inode *, int); struct posix_acl *ceph_get_acl(struct inode *, int);
int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type); int ceph_set_acl(struct user_namespace *mnt_userns,
struct inode *inode, struct posix_acl *acl, int type);
int ceph_pre_init_acls(struct inode *dir, umode_t *mode, int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
struct ceph_acl_sec_ctx *as_ctx); struct ceph_acl_sec_ctx *as_ctx);
void ceph_init_inode_acls(struct inode *inode, void ceph_init_inode_acls(struct inode *inode,

View File

@ -305,7 +305,8 @@ static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int cifs_permission(struct inode *inode, int mask) static int cifs_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask)
{ {
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;

View File

@ -62,19 +62,22 @@ extern void cifs_sb_deactive(struct super_block *sb);
/* Functions related to inodes */ /* Functions related to inodes */
extern const struct inode_operations cifs_dir_inode_ops; extern const struct inode_operations cifs_dir_inode_ops;
extern struct inode *cifs_root_iget(struct super_block *); extern struct inode *cifs_root_iget(struct super_block *);
extern int cifs_create(struct inode *, struct dentry *, umode_t, extern int cifs_create(struct user_namespace *, struct inode *,
bool excl); struct dentry *, umode_t, bool excl);
extern int cifs_atomic_open(struct inode *, struct dentry *, extern int cifs_atomic_open(struct inode *, struct dentry *,
struct file *, unsigned, umode_t); struct file *, unsigned, umode_t);
extern struct dentry *cifs_lookup(struct inode *, struct dentry *, extern struct dentry *cifs_lookup(struct inode *, struct dentry *,
unsigned int); unsigned int);
extern int cifs_unlink(struct inode *dir, struct dentry *dentry); extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
extern int cifs_mknod(struct inode *, struct dentry *, umode_t, dev_t); extern int cifs_mknod(struct user_namespace *, struct inode *, struct dentry *,
extern int cifs_mkdir(struct inode *, struct dentry *, umode_t); umode_t, dev_t);
extern int cifs_mkdir(struct user_namespace *, struct inode *, struct dentry *,
umode_t);
extern int cifs_rmdir(struct inode *, struct dentry *); extern int cifs_rmdir(struct inode *, struct dentry *);
extern int cifs_rename2(struct inode *, struct dentry *, struct inode *, extern int cifs_rename2(struct user_namespace *, struct inode *,
struct dentry *, unsigned int); struct dentry *, struct inode *, struct dentry *,
unsigned int);
extern int cifs_revalidate_file_attr(struct file *filp); extern int cifs_revalidate_file_attr(struct file *filp);
extern int cifs_revalidate_dentry_attr(struct dentry *); extern int cifs_revalidate_dentry_attr(struct dentry *);
extern int cifs_revalidate_file(struct file *filp); extern int cifs_revalidate_file(struct file *filp);
@ -82,8 +85,10 @@ extern int cifs_revalidate_dentry(struct dentry *);
extern int cifs_invalidate_mapping(struct inode *inode); extern int cifs_invalidate_mapping(struct inode *inode);
extern int cifs_revalidate_mapping(struct inode *inode); extern int cifs_revalidate_mapping(struct inode *inode);
extern int cifs_zap_mapping(struct inode *inode); extern int cifs_zap_mapping(struct inode *inode);
extern int cifs_getattr(const struct path *, struct kstat *, u32, unsigned int); extern int cifs_getattr(struct user_namespace *, const struct path *,
extern int cifs_setattr(struct dentry *, struct iattr *); struct kstat *, u32, unsigned int);
extern int cifs_setattr(struct user_namespace *, struct dentry *,
struct iattr *);
extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start, extern int cifs_fiemap(struct inode *, struct fiemap_extent_info *, u64 start,
u64 len); u64 len);
@ -132,8 +137,8 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
/* Functions related to symlinks */ /* Functions related to symlinks */
extern const char *cifs_get_link(struct dentry *, struct inode *, extern const char *cifs_get_link(struct dentry *, struct inode *,
struct delayed_call *); struct delayed_call *);
extern int cifs_symlink(struct inode *inode, struct dentry *direntry, extern int cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
const char *symname); struct dentry *direntry, const char *symname);
#ifdef CONFIG_CIFS_XATTR #ifdef CONFIG_CIFS_XATTR
extern const struct xattr_handler *cifs_xattr_handlers[]; extern const struct xattr_handler *cifs_xattr_handlers[];

View File

@ -567,8 +567,8 @@ out_free_xid:
return rc; return rc;
} }
int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, int cifs_create(struct user_namespace *mnt_userns, struct inode *inode,
bool excl) struct dentry *direntry, umode_t mode, bool excl)
{ {
int rc; int rc;
unsigned int xid = get_xid(); unsigned int xid = get_xid();
@ -611,8 +611,8 @@ out_free_xid:
return rc; return rc;
} }
int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, int cifs_mknod(struct user_namespace *mnt_userns, struct inode *inode,
dev_t device_number) struct dentry *direntry, umode_t mode, dev_t device_number)
{ {
int rc = -EPERM; int rc = -EPERM;
unsigned int xid; unsigned int xid;

View File

@ -1857,7 +1857,8 @@ posix_mkdir_get_info:
goto posix_mkdir_out; goto posix_mkdir_out;
} }
int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) int cifs_mkdir(struct user_namespace *mnt_userns, struct inode *inode,
struct dentry *direntry, umode_t mode)
{ {
int rc = 0; int rc = 0;
unsigned int xid; unsigned int xid;
@ -2067,9 +2068,9 @@ do_rename_exit:
} }
int int
cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, cifs_rename2(struct user_namespace *mnt_userns, struct inode *source_dir,
struct inode *target_dir, struct dentry *target_dentry, struct dentry *source_dentry, struct inode *target_dir,
unsigned int flags) struct dentry *target_dentry, unsigned int flags)
{ {
char *from_name = NULL; char *from_name = NULL;
char *to_name = NULL; char *to_name = NULL;
@ -2370,8 +2371,8 @@ int cifs_revalidate_dentry(struct dentry *dentry)
return cifs_revalidate_mapping(inode); return cifs_revalidate_mapping(inode);
} }
int cifs_getattr(const struct path *path, struct kstat *stat, int cifs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int flags) struct kstat *stat, u32 request_mask, unsigned int flags)
{ {
struct dentry *dentry = path->dentry; struct dentry *dentry = path->dentry;
struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
@ -2923,7 +2924,8 @@ cifs_setattr_exit:
} }
int int
cifs_setattr(struct dentry *direntry, struct iattr *attrs) cifs_setattr(struct user_namespace *mnt_userns, struct dentry *direntry,
struct iattr *attrs)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb);

View File

@ -661,7 +661,8 @@ cifs_get_link(struct dentry *direntry, struct inode *inode,
} }
int int
cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
struct dentry *direntry, const char *symname)
{ {
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
unsigned int xid; unsigned int xid;

View File

@ -46,10 +46,12 @@ extern const struct file_operations coda_ioctl_operations;
/* operations shared over more than one file */ /* operations shared over more than one file */
int coda_open(struct inode *i, struct file *f); int coda_open(struct inode *i, struct file *f);
int coda_release(struct inode *i, struct file *f); int coda_release(struct inode *i, struct file *f);
int coda_permission(struct inode *inode, int mask); int coda_permission(struct user_namespace *mnt_userns, struct inode *inode,
int mask);
int coda_revalidate_inode(struct inode *); int coda_revalidate_inode(struct inode *);
int coda_getattr(const struct path *, struct kstat *, u32, unsigned int); int coda_getattr(struct user_namespace *, const struct path *, struct kstat *,
int coda_setattr(struct dentry *, struct iattr *); u32, unsigned int);
int coda_setattr(struct user_namespace *, struct dentry *, struct iattr *);
/* this file: heloers */ /* this file: heloers */
char *coda_f2s(struct CodaFid *f); char *coda_f2s(struct CodaFid *f);

View File

@ -73,7 +73,8 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsig
} }
int coda_permission(struct inode *inode, int mask) int coda_permission(struct user_namespace *mnt_userns, struct inode *inode,
int mask)
{ {
int error; int error;
@ -132,7 +133,8 @@ static inline void coda_dir_drop_nlink(struct inode *dir)
} }
/* creation routines: create, mknod, mkdir, link, symlink */ /* creation routines: create, mknod, mkdir, link, symlink */
static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, bool excl) static int coda_create(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *de, umode_t mode, bool excl)
{ {
int error; int error;
const char *name=de->d_name.name; const char *name=de->d_name.name;
@ -164,7 +166,8 @@ err_out:
return error; return error;
} }
static int coda_mkdir(struct inode *dir, struct dentry *de, umode_t mode) static int coda_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *de, umode_t mode)
{ {
struct inode *inode; struct inode *inode;
struct coda_vattr attrs; struct coda_vattr attrs;
@ -225,7 +228,8 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
} }
static int coda_symlink(struct inode *dir_inode, struct dentry *de, static int coda_symlink(struct user_namespace *mnt_userns,
struct inode *dir_inode, struct dentry *de,
const char *symname) const char *symname)
{ {
const char *name = de->d_name.name; const char *name = de->d_name.name;
@ -291,9 +295,9 @@ static int coda_rmdir(struct inode *dir, struct dentry *de)
} }
/* rename */ /* rename */
static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, static int coda_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
const char *old_name = old_dentry->d_name.name; const char *old_name = old_dentry->d_name.name;
const char *new_name = new_dentry->d_name.name; const char *new_name = new_dentry->d_name.name;

View File

@ -251,8 +251,8 @@ static void coda_evict_inode(struct inode *inode)
coda_cache_clear_inode(inode); coda_cache_clear_inode(inode);
} }
int coda_getattr(const struct path *path, struct kstat *stat, int coda_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int flags) struct kstat *stat, u32 request_mask, unsigned int flags)
{ {
int err = coda_revalidate_inode(d_inode(path->dentry)); int err = coda_revalidate_inode(d_inode(path->dentry));
if (!err) if (!err)
@ -260,7 +260,8 @@ int coda_getattr(const struct path *path, struct kstat *stat,
return err; return err;
} }
int coda_setattr(struct dentry *de, struct iattr *iattr) int coda_setattr(struct user_namespace *mnt_userns, struct dentry *de,
struct iattr *iattr)
{ {
struct inode *inode = d_inode(de); struct inode *inode = d_inode(de);
struct coda_vattr vattr; struct coda_vattr vattr;

View File

@ -24,7 +24,8 @@
#include "coda_linux.h" #include "coda_linux.h"
/* pioctl ops */ /* pioctl ops */
static int coda_ioctl_permission(struct inode *inode, int mask); static int coda_ioctl_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask);
static long coda_pioctl(struct file *filp, unsigned int cmd, static long coda_pioctl(struct file *filp, unsigned int cmd,
unsigned long user_data); unsigned long user_data);
@ -40,7 +41,8 @@ const struct file_operations coda_ioctl_operations = {
}; };
/* the coda pioctl inode ops */ /* the coda pioctl inode ops */
static int coda_ioctl_permission(struct inode *inode, int mask) static int coda_ioctl_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask)
{ {
return (mask & MAY_EXEC) ? -EACCES : 0; return (mask & MAY_EXEC) ? -EACCES : 0;
} }

View File

@ -79,7 +79,8 @@ extern void configfs_hash_and_remove(struct dentry * dir, const char * name);
extern const unsigned char * configfs_get_name(struct configfs_dirent *sd); extern const unsigned char * configfs_get_name(struct configfs_dirent *sd);
extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent); extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent);
extern int configfs_setattr(struct dentry *dentry, struct iattr *iattr); extern int configfs_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *iattr);
extern struct dentry *configfs_pin_fs(void); extern struct dentry *configfs_pin_fs(void);
extern void configfs_release_fs(void); extern void configfs_release_fs(void);
@ -92,7 +93,8 @@ extern const struct inode_operations configfs_root_inode_operations;
extern const struct inode_operations configfs_symlink_inode_operations; extern const struct inode_operations configfs_symlink_inode_operations;
extern const struct dentry_operations configfs_dentry_ops; extern const struct dentry_operations configfs_dentry_ops;
extern int configfs_symlink(struct inode *dir, struct dentry *dentry, extern int configfs_symlink(struct user_namespace *mnt_userns,
struct inode *dir, struct dentry *dentry,
const char *symname); const char *symname);
extern int configfs_unlink(struct inode *dir, struct dentry *dentry); extern int configfs_unlink(struct inode *dir, struct dentry *dentry);

View File

@ -1268,7 +1268,8 @@ out_root_unlock:
} }
EXPORT_SYMBOL(configfs_depend_item_unlocked); EXPORT_SYMBOL(configfs_depend_item_unlocked);
static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int configfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
int ret = 0; int ret = 0;
int module_got = 0; int module_got = 0;

View File

@ -40,7 +40,8 @@ static const struct inode_operations configfs_inode_operations ={
.setattr = configfs_setattr, .setattr = configfs_setattr,
}; };
int configfs_setattr(struct dentry * dentry, struct iattr * iattr) int configfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *iattr)
{ {
struct inode * inode = d_inode(dentry); struct inode * inode = d_inode(dentry);
struct configfs_dirent * sd = dentry->d_fsdata; struct configfs_dirent * sd = dentry->d_fsdata;
@ -67,7 +68,7 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
} }
/* attributes were changed atleast once in past */ /* attributes were changed atleast once in past */
error = simple_setattr(dentry, iattr); error = simple_setattr(mnt_userns, dentry, iattr);
if (error) if (error)
return error; return error;

View File

@ -139,7 +139,8 @@ static int get_target(const char *symname, struct path *path,
} }
int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) int configfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, const char *symname)
{ {
int ret; int ret;
struct path path; struct path path;

View File

@ -42,13 +42,14 @@ static unsigned int debugfs_allow = DEFAULT_DEBUGFS_ALLOW_BITS;
* so that we can use the file mode as part of a heuristic to determine whether * so that we can use the file mode as part of a heuristic to determine whether
* to lock down individual files. * to lock down individual files.
*/ */
static int debugfs_setattr(struct dentry *dentry, struct iattr *ia) static int debugfs_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *ia)
{ {
int ret = security_locked_down(LOCKDOWN_DEBUGFS); int ret = security_locked_down(LOCKDOWN_DEBUGFS);
if (ret && (ia->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))) if (ret && (ia->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)))
return ret; return ret;
return simple_setattr(dentry, ia); return simple_setattr(&init_user_ns, dentry, ia);
} }
static const struct inode_operations debugfs_file_inode_operations = { static const struct inode_operations debugfs_file_inode_operations = {
@ -775,8 +776,8 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
take_dentry_name_snapshot(&old_name, old_dentry); take_dentry_name_snapshot(&old_name, old_dentry);
error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir), error = simple_rename(&init_user_ns, d_inode(old_dir), old_dentry,
dentry, 0); d_inode(new_dir), dentry, 0);
if (error) { if (error) {
release_dentry_name_snapshot(&old_name); release_dentry_name_snapshot(&old_name);
goto exit; goto exit;

View File

@ -257,7 +257,8 @@ out:
* Returns zero on success; non-zero on error condition * Returns zero on success; non-zero on error condition
*/ */
static int static int
ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, ecryptfs_create(struct user_namespace *mnt_userns,
struct inode *directory_inode, struct dentry *ecryptfs_dentry,
umode_t mode, bool excl) umode_t mode, bool excl)
{ {
struct inode *ecryptfs_inode; struct inode *ecryptfs_inode;
@ -463,7 +464,8 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
return ecryptfs_do_unlink(dir, dentry, d_inode(dentry)); return ecryptfs_do_unlink(dir, dentry, d_inode(dentry));
} }
static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, static int ecryptfs_symlink(struct user_namespace *mnt_userns,
struct inode *dir, struct dentry *dentry,
const char *symname) const char *symname)
{ {
int rc; int rc;
@ -502,7 +504,8 @@ out_lock:
return rc; return rc;
} }
static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int ecryptfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
int rc; int rc;
struct dentry *lower_dentry; struct dentry *lower_dentry;
@ -559,7 +562,8 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
} }
static int static int
ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) ecryptfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, dev_t dev)
{ {
int rc; int rc;
struct dentry *lower_dentry; struct dentry *lower_dentry;
@ -584,9 +588,9 @@ out:
} }
static int static int
ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, ecryptfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
int rc; int rc;
struct dentry *lower_old_dentry; struct dentry *lower_old_dentry;
@ -874,7 +878,8 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
} }
static int static int
ecryptfs_permission(struct inode *inode, int mask) ecryptfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
int mask)
{ {
return inode_permission(&init_user_ns, return inode_permission(&init_user_ns,
ecryptfs_inode_to_lower(inode), mask); ecryptfs_inode_to_lower(inode), mask);
@ -892,7 +897,8 @@ ecryptfs_permission(struct inode *inode, int mask)
* All other metadata changes will be passed right to the lower filesystem, * All other metadata changes will be passed right to the lower filesystem,
* and we will just update our inode to look like the lower. * and we will just update our inode to look like the lower.
*/ */
static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) static int ecryptfs_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *ia)
{ {
int rc = 0; int rc = 0;
struct dentry *lower_dentry; struct dentry *lower_dentry;
@ -979,7 +985,8 @@ out:
return rc; return rc;
} }
static int ecryptfs_getattr_link(const struct path *path, struct kstat *stat, static int ecryptfs_getattr_link(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags) u32 request_mask, unsigned int flags)
{ {
struct dentry *dentry = path->dentry; struct dentry *dentry = path->dentry;
@ -1004,7 +1011,8 @@ static int ecryptfs_getattr_link(const struct path *path, struct kstat *stat,
return rc; return rc;
} }
static int ecryptfs_getattr(const struct path *path, struct kstat *stat, static int ecryptfs_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags) u32 request_mask, unsigned int flags)
{ {
struct dentry *dentry = path->dentry; struct dentry *dentry = path->dentry;

View File

@ -66,8 +66,8 @@ bool efivarfs_valid_name(const char *str, int len)
return uuid_is_valid(s); return uuid_is_valid(s);
} }
static int efivarfs_create(struct inode *dir, struct dentry *dentry, static int efivarfs_create(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct inode *inode = NULL; struct inode *inode = NULL;
struct efivar_entry *var; struct efivar_entry *var;

View File

@ -331,8 +331,9 @@ struct inode *erofs_iget(struct super_block *sb,
return inode; return inode;
} }
int erofs_getattr(const struct path *path, struct kstat *stat, int erofs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags) struct kstat *stat, u32 request_mask,
unsigned int query_flags)
{ {
struct inode *const inode = d_inode(path->dentry); struct inode *const inode = d_inode(path->dentry);

View File

@ -373,8 +373,9 @@ extern const struct inode_operations erofs_symlink_iops;
extern const struct inode_operations erofs_fast_symlink_iops; extern const struct inode_operations erofs_fast_symlink_iops;
struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid, bool dir); struct inode *erofs_iget(struct super_block *sb, erofs_nid_t nid, bool dir);
int erofs_getattr(const struct path *path, struct kstat *stat, int erofs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags); struct kstat *stat, u32 request_mask,
unsigned int query_flags);
/* namei.c */ /* namei.c */
extern const struct inode_operations erofs_dir_iops; extern const struct inode_operations erofs_dir_iops;

View File

@ -416,9 +416,11 @@ int exfat_count_used_clusters(struct super_block *sb, unsigned int *ret_count);
extern const struct file_operations exfat_file_operations; extern const struct file_operations exfat_file_operations;
int __exfat_truncate(struct inode *inode, loff_t new_size); int __exfat_truncate(struct inode *inode, loff_t new_size);
void exfat_truncate(struct inode *inode, loff_t size); void exfat_truncate(struct inode *inode, loff_t size);
int exfat_setattr(struct dentry *dentry, struct iattr *attr); int exfat_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
int exfat_getattr(const struct path *path, struct kstat *stat, struct iattr *attr);
unsigned int request_mask, unsigned int query_flags); int exfat_getattr(struct user_namespace *mnt_userns, const struct path *path,
struct kstat *stat, unsigned int request_mask,
unsigned int query_flags);
int exfat_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); int exfat_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
/* namei.c */ /* namei.c */

View File

@ -267,8 +267,9 @@ write_size:
mutex_unlock(&sbi->s_lock); mutex_unlock(&sbi->s_lock);
} }
int exfat_getattr(const struct path *path, struct kstat *stat, int exfat_getattr(struct user_namespace *mnt_uerns, const struct path *path,
unsigned int request_mask, unsigned int query_flags) struct kstat *stat, unsigned int request_mask,
unsigned int query_flags)
{ {
struct inode *inode = d_backing_inode(path->dentry); struct inode *inode = d_backing_inode(path->dentry);
struct exfat_inode_info *ei = EXFAT_I(inode); struct exfat_inode_info *ei = EXFAT_I(inode);
@ -282,7 +283,8 @@ int exfat_getattr(const struct path *path, struct kstat *stat,
return 0; return 0;
} }
int exfat_setattr(struct dentry *dentry, struct iattr *attr) int exfat_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct exfat_sb_info *sbi = EXFAT_SB(dentry->d_sb); struct exfat_sb_info *sbi = EXFAT_SB(dentry->d_sb);
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;

View File

@ -541,8 +541,8 @@ out:
return ret; return ret;
} }
static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int exfat_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
@ -827,7 +827,8 @@ unlock:
return err; return err;
} }
static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int exfat_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
@ -1318,9 +1319,10 @@ out:
return ret; return ret;
} }
static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry, static int exfat_rename(struct user_namespace *mnt_userns,
struct inode *new_dir, struct dentry *new_dentry, struct inode *old_dir, struct dentry *old_dentry,
unsigned int flags) struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags)
{ {
struct inode *old_inode, *new_inode; struct inode *old_inode, *new_inode;
struct super_block *sb = old_dir->i_sb; struct super_block *sb = old_dir->i_sb;

View File

@ -216,7 +216,8 @@ __ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
* inode->i_mutex: down * inode->i_mutex: down
*/ */
int int
ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type) ext2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
int error; int error;
int update_mode = 0; int update_mode = 0;

View File

@ -56,7 +56,8 @@ static inline int ext2_acl_count(size_t size)
/* acl.c */ /* acl.c */
extern struct posix_acl *ext2_get_acl(struct inode *inode, int type); extern struct posix_acl *ext2_get_acl(struct inode *inode, int type);
extern int ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type); extern int ext2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
extern int ext2_init_acl (struct inode *, struct inode *); extern int ext2_init_acl (struct inode *, struct inode *);
#else #else

View File

@ -764,8 +764,9 @@ extern struct inode *ext2_iget (struct super_block *, unsigned long);
extern int ext2_write_inode (struct inode *, struct writeback_control *); extern int ext2_write_inode (struct inode *, struct writeback_control *);
extern void ext2_evict_inode(struct inode *); extern void ext2_evict_inode(struct inode *);
extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern int ext2_setattr (struct dentry *, struct iattr *); extern int ext2_setattr (struct user_namespace *, struct dentry *, struct iattr *);
extern int ext2_getattr (const struct path *, struct kstat *, u32, unsigned int); extern int ext2_getattr (struct user_namespace *, const struct path *,
struct kstat *, u32, unsigned int);
extern void ext2_set_inode_flags(struct inode *inode); extern void ext2_set_inode_flags(struct inode *inode);
extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
u64 start, u64 len); u64 start, u64 len);

View File

@ -1638,8 +1638,8 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc)
return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL); return __ext2_write_inode(inode, wbc->sync_mode == WB_SYNC_ALL);
} }
int ext2_getattr(const struct path *path, struct kstat *stat, int ext2_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags) struct kstat *stat, u32 request_mask, unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct ext2_inode_info *ei = EXT2_I(inode); struct ext2_inode_info *ei = EXT2_I(inode);
@ -1664,7 +1664,8 @@ int ext2_getattr(const struct path *path, struct kstat *stat,
return 0; return 0;
} }
int ext2_setattr(struct dentry *dentry, struct iattr *iattr) int ext2_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *iattr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;

View File

@ -100,7 +100,9 @@ struct dentry *ext2_get_parent(struct dentry *child)
* If the create succeeds, we fill in the inode information * If the create succeeds, we fill in the inode information
* with d_instantiate(). * with d_instantiate().
*/ */
static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, bool excl) static int ext2_create (struct user_namespace * mnt_userns,
struct inode * dir, struct dentry * dentry,
umode_t mode, bool excl)
{ {
struct inode *inode; struct inode *inode;
int err; int err;
@ -118,7 +120,8 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode
return ext2_add_nondir(dentry, inode); return ext2_add_nondir(dentry, inode);
} }
static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) static int ext2_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct inode *inode = ext2_new_inode(dir, mode, NULL); struct inode *inode = ext2_new_inode(dir, mode, NULL);
if (IS_ERR(inode)) if (IS_ERR(inode))
@ -131,7 +134,8 @@ static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
return 0; return 0;
} }
static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev) static int ext2_mknod (struct user_namespace * mnt_userns, struct inode * dir,
struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct inode * inode; struct inode * inode;
int err; int err;
@ -151,8 +155,8 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode,
return err; return err;
} }
static int ext2_symlink (struct inode * dir, struct dentry * dentry, static int ext2_symlink (struct user_namespace * mnt_userns, struct inode * dir,
const char * symname) struct dentry * dentry, const char * symname)
{ {
struct super_block * sb = dir->i_sb; struct super_block * sb = dir->i_sb;
int err = -ENAMETOOLONG; int err = -ENAMETOOLONG;
@ -225,7 +229,8 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
return err; return err;
} }
static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) static int ext2_mkdir(struct user_namespace * mnt_userns,
struct inode * dir, struct dentry * dentry, umode_t mode)
{ {
struct inode * inode; struct inode * inode;
int err; int err;
@ -315,8 +320,9 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
return err; return err;
} }
static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, static int ext2_rename (struct user_namespace * mnt_userns,
struct inode * new_dir, struct dentry * new_dentry, struct inode * old_dir, struct dentry * old_dentry,
struct inode * new_dir, struct dentry * new_dentry,
unsigned int flags) unsigned int flags)
{ {
struct inode * old_inode = d_inode(old_dentry); struct inode * old_inode = d_inode(old_dentry);

View File

@ -222,7 +222,8 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
} }
int int
ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type) ext4_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
handle_t *handle; handle_t *handle;
int error, credits, retries = 0; int error, credits, retries = 0;

View File

@ -56,7 +56,8 @@ static inline int ext4_acl_count(size_t size)
/* acl.c */ /* acl.c */
struct posix_acl *ext4_get_acl(struct inode *inode, int type); struct posix_acl *ext4_get_acl(struct inode *inode, int type);
int ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type); int ext4_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
extern int ext4_init_acl(handle_t *, struct inode *, struct inode *); extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
#else /* CONFIG_EXT4_FS_POSIX_ACL */ #else /* CONFIG_EXT4_FS_POSIX_ACL */

View File

@ -2877,11 +2877,14 @@ extern struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
__ext4_iget((sb), (ino), (flags), __func__, __LINE__) __ext4_iget((sb), (ino), (flags), __func__, __LINE__)
extern int ext4_write_inode(struct inode *, struct writeback_control *); extern int ext4_write_inode(struct inode *, struct writeback_control *);
extern int ext4_setattr(struct dentry *, struct iattr *); extern int ext4_setattr(struct user_namespace *, struct dentry *,
extern int ext4_getattr(const struct path *, struct kstat *, u32, unsigned int); struct iattr *);
extern int ext4_getattr(struct user_namespace *, const struct path *,
struct kstat *, u32, unsigned int);
extern void ext4_evict_inode(struct inode *); extern void ext4_evict_inode(struct inode *);
extern void ext4_clear_inode(struct inode *); extern void ext4_clear_inode(struct inode *);
extern int ext4_file_getattr(const struct path *, struct kstat *, u32, unsigned int); extern int ext4_file_getattr(struct user_namespace *, const struct path *,
struct kstat *, u32, unsigned int);
extern int ext4_sync_inode(handle_t *, struct inode *); extern int ext4_sync_inode(handle_t *, struct inode *);
extern void ext4_dirty_inode(struct inode *, int); extern void ext4_dirty_inode(struct inode *, int);
extern int ext4_change_inode_journal_flag(struct inode *, int); extern int ext4_change_inode_journal_flag(struct inode *, int);

View File

@ -5319,7 +5319,8 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
* *
* Called with inode->i_mutex down. * Called with inode->i_mutex down.
*/ */
int ext4_setattr(struct dentry *dentry, struct iattr *attr) int ext4_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error, rc = 0; int error, rc = 0;
@ -5535,8 +5536,8 @@ err_out:
return error; return error;
} }
int ext4_getattr(const struct path *path, struct kstat *stat, int ext4_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags) struct kstat *stat, u32 request_mask, unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct ext4_inode *raw_inode; struct ext4_inode *raw_inode;
@ -5575,13 +5576,14 @@ int ext4_getattr(const struct path *path, struct kstat *stat,
return 0; return 0;
} }
int ext4_file_getattr(const struct path *path, struct kstat *stat, int ext4_file_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags) u32 request_mask, unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
u64 delalloc_blocks; u64 delalloc_blocks;
ext4_getattr(path, stat, request_mask, query_flags); ext4_getattr(&init_user_ns, path, stat, request_mask, query_flags);
/* /*
* If there is inline data in the inode, the inode will normally not * If there is inline data in the inode, the inode will normally not

View File

@ -2596,8 +2596,8 @@ static int ext4_add_nondir(handle_t *handle,
* If the create succeeds, we fill in the inode information * If the create succeeds, we fill in the inode information
* with d_instantiate(). * with d_instantiate().
*/ */
static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int ext4_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
handle_t *handle; handle_t *handle;
struct inode *inode; struct inode *inode;
@ -2631,8 +2631,8 @@ retry:
return err; return err;
} }
static int ext4_mknod(struct inode *dir, struct dentry *dentry, static int ext4_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
handle_t *handle; handle_t *handle;
struct inode *inode; struct inode *inode;
@ -2665,7 +2665,8 @@ retry:
return err; return err;
} }
static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) static int ext4_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
handle_t *handle; handle_t *handle;
struct inode *inode; struct inode *inode;
@ -2774,7 +2775,8 @@ out:
return err; return err;
} }
static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int ext4_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
handle_t *handle; handle_t *handle;
struct inode *inode; struct inode *inode;
@ -3292,7 +3294,7 @@ out_trace:
return retval; return retval;
} }
static int ext4_symlink(struct inode *dir, static int ext4_symlink(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, const char *symname) struct dentry *dentry, const char *symname)
{ {
handle_t *handle; handle_t *handle;
@ -4085,7 +4087,8 @@ end_rename:
return retval; return retval;
} }
static int ext4_rename2(struct inode *old_dir, struct dentry *old_dentry, static int ext4_rename2(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {

View File

@ -249,7 +249,8 @@ static int __f2fs_set_acl(struct inode *inode, int type,
return error; return error;
} }
int f2fs_set_acl(struct inode *inode, struct posix_acl *acl, int type) int f2fs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
return -EIO; return -EIO;

View File

@ -34,7 +34,8 @@ struct f2fs_acl_header {
#ifdef CONFIG_F2FS_FS_POSIX_ACL #ifdef CONFIG_F2FS_FS_POSIX_ACL
extern struct posix_acl *f2fs_get_acl(struct inode *, int); extern struct posix_acl *f2fs_get_acl(struct inode *, int);
extern int f2fs_set_acl(struct inode *, struct posix_acl *, int); extern int f2fs_set_acl(struct user_namespace *, struct inode *,
struct posix_acl *, int);
extern int f2fs_init_acl(struct inode *, struct inode *, struct page *, extern int f2fs_init_acl(struct inode *, struct inode *, struct page *,
struct page *); struct page *);
#else #else

View File

@ -3135,9 +3135,10 @@ void f2fs_truncate_data_blocks(struct dnode_of_data *dn);
int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock); int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock);
int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock); int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock);
int f2fs_truncate(struct inode *inode); int f2fs_truncate(struct inode *inode);
int f2fs_getattr(const struct path *path, struct kstat *stat, int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int flags); struct kstat *stat, u32 request_mask, unsigned int flags);
int f2fs_setattr(struct dentry *dentry, struct iattr *attr); int f2fs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr);
int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end); int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end);
void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count); void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count);
int f2fs_precache_extents(struct inode *inode); int f2fs_precache_extents(struct inode *inode);

View File

@ -783,8 +783,8 @@ int f2fs_truncate(struct inode *inode)
return 0; return 0;
} }
int f2fs_getattr(const struct path *path, struct kstat *stat, int f2fs_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags) struct kstat *stat, u32 request_mask, unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct f2fs_inode_info *fi = F2FS_I(inode); struct f2fs_inode_info *fi = F2FS_I(inode);
@ -859,7 +859,8 @@ static void __setattr_copy(struct user_namespace *mnt_userns,
#define __setattr_copy setattr_copy #define __setattr_copy setattr_copy
#endif #endif
int f2fs_setattr(struct dentry *dentry, struct iattr *attr) int f2fs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int err; int err;

View File

@ -314,8 +314,8 @@ static void set_compress_inode(struct f2fs_sb_info *sbi, struct inode *inode,
} }
} }
static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int f2fs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
struct inode *inode; struct inode *inode;
@ -637,8 +637,8 @@ static const char *f2fs_get_link(struct dentry *dentry,
return link; return link;
} }
static int f2fs_symlink(struct inode *dir, struct dentry *dentry, static int f2fs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *symname) struct dentry *dentry, const char *symname)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
struct inode *inode; struct inode *inode;
@ -717,7 +717,8 @@ out_free_encrypted_link:
return err; return err;
} }
static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int f2fs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
struct inode *inode; struct inode *inode;
@ -770,8 +771,8 @@ static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
return -ENOTEMPTY; return -ENOTEMPTY;
} }
static int f2fs_mknod(struct inode *dir, struct dentry *dentry, static int f2fs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
struct inode *inode; struct inode *inode;
@ -874,7 +875,8 @@ out:
return err; return err;
} }
static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) static int f2fs_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct f2fs_sb_info *sbi = F2FS_I_SB(dir); struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
@ -1247,7 +1249,8 @@ out:
return err; return err;
} }
static int f2fs_rename2(struct inode *old_dir, struct dentry *old_dentry, static int f2fs_rename2(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {

View File

@ -397,9 +397,11 @@ extern long fat_generic_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg); unsigned long arg);
extern const struct file_operations fat_file_operations; extern const struct file_operations fat_file_operations;
extern const struct inode_operations fat_file_inode_operations; extern const struct inode_operations fat_file_inode_operations;
extern int fat_setattr(struct dentry *dentry, struct iattr *attr); extern int fat_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr);
extern void fat_truncate_blocks(struct inode *inode, loff_t offset); extern void fat_truncate_blocks(struct inode *inode, loff_t offset);
extern int fat_getattr(const struct path *path, struct kstat *stat, extern int fat_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags); u32 request_mask, unsigned int flags);
extern int fat_file_fsync(struct file *file, loff_t start, loff_t end, extern int fat_file_fsync(struct file *file, loff_t start, loff_t end,
int datasync); int datasync);

View File

@ -95,7 +95,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
goto out_unlock_inode; goto out_unlock_inode;
/* This MUST be done before doing anything irreversible... */ /* This MUST be done before doing anything irreversible... */
err = fat_setattr(file->f_path.dentry, &ia); err = fat_setattr(file_mnt_user_ns(file), file->f_path.dentry, &ia);
if (err) if (err)
goto out_unlock_inode; goto out_unlock_inode;
@ -394,8 +394,8 @@ void fat_truncate_blocks(struct inode *inode, loff_t offset)
fat_flush_inodes(inode->i_sb, inode, NULL); fat_flush_inodes(inode->i_sb, inode, NULL);
} }
int fat_getattr(const struct path *path, struct kstat *stat, int fat_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int flags) struct kstat *stat, u32 request_mask, unsigned int flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
generic_fillattr(&init_user_ns, inode, stat); generic_fillattr(&init_user_ns, inode, stat);
@ -466,7 +466,8 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode)
/* valid file mode bits */ /* valid file mode bits */
#define FAT_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXUGO) #define FAT_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXUGO)
int fat_setattr(struct dentry *dentry, struct iattr *attr) int fat_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);

View File

@ -261,8 +261,8 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
} }
/***** Create a file */ /***** Create a file */
static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int msdos_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode = NULL; struct inode *inode = NULL;
@ -339,7 +339,8 @@ out:
} }
/***** Make a directory */ /***** Make a directory */
static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int msdos_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct fat_slot_info sinfo; struct fat_slot_info sinfo;
@ -593,7 +594,8 @@ error_inode:
} }
/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */ /***** Rename, a wrapper for rename_same_dir & rename_diff_dir */
static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, static int msdos_rename(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {

View File

@ -756,8 +756,8 @@ error:
return ERR_PTR(err); return ERR_PTR(err);
} }
static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int vfat_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
@ -846,7 +846,8 @@ out:
return err; return err;
} }
static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int vfat_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct inode *inode; struct inode *inode;
@ -892,9 +893,9 @@ out:
return err; return err;
} }
static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, static int vfat_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
struct buffer_head *dotdot_bh; struct buffer_head *dotdot_bh;
struct msdos_dir_entry *dotdot_de; struct msdos_dir_entry *dotdot_de;

View File

@ -50,7 +50,8 @@ struct posix_acl *fuse_get_acl(struct inode *inode, int type)
return acl; return acl;
} }
int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type) int fuse_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_conn *fc = get_fuse_conn(inode);
const char *name; const char *name;

View File

@ -605,7 +605,8 @@ out_err:
return err; return err;
} }
static int fuse_mknod(struct inode *, struct dentry *, umode_t, dev_t); static int fuse_mknod(struct user_namespace *, struct inode *, struct dentry *,
umode_t, dev_t);
static int fuse_atomic_open(struct inode *dir, struct dentry *entry, static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
struct file *file, unsigned flags, struct file *file, unsigned flags,
umode_t mode) umode_t mode)
@ -645,7 +646,7 @@ out_dput:
return err; return err;
mknod: mknod:
err = fuse_mknod(dir, entry, mode, 0); err = fuse_mknod(&init_user_ns, dir, entry, mode, 0);
if (err) if (err)
goto out_dput; goto out_dput;
no_open: no_open:
@ -715,8 +716,8 @@ static int create_new_entry(struct fuse_mount *fm, struct fuse_args *args,
return err; return err;
} }
static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode, static int fuse_mknod(struct user_namespace *mnt_userns, struct inode *dir,
dev_t rdev) struct dentry *entry, umode_t mode, dev_t rdev)
{ {
struct fuse_mknod_in inarg; struct fuse_mknod_in inarg;
struct fuse_mount *fm = get_fuse_mount(dir); struct fuse_mount *fm = get_fuse_mount(dir);
@ -738,13 +739,14 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode,
return create_new_entry(fm, &args, dir, entry, mode); return create_new_entry(fm, &args, dir, entry, mode);
} }
static int fuse_create(struct inode *dir, struct dentry *entry, umode_t mode, static int fuse_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *entry, umode_t mode, bool excl)
{ {
return fuse_mknod(dir, entry, mode, 0); return fuse_mknod(&init_user_ns, dir, entry, mode, 0);
} }
static int fuse_mkdir(struct inode *dir, struct dentry *entry, umode_t mode) static int fuse_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *entry, umode_t mode)
{ {
struct fuse_mkdir_in inarg; struct fuse_mkdir_in inarg;
struct fuse_mount *fm = get_fuse_mount(dir); struct fuse_mount *fm = get_fuse_mount(dir);
@ -765,8 +767,8 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, umode_t mode)
return create_new_entry(fm, &args, dir, entry, S_IFDIR); return create_new_entry(fm, &args, dir, entry, S_IFDIR);
} }
static int fuse_symlink(struct inode *dir, struct dentry *entry, static int fuse_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *link) struct dentry *entry, const char *link)
{ {
struct fuse_mount *fm = get_fuse_mount(dir); struct fuse_mount *fm = get_fuse_mount(dir);
unsigned len = strlen(link) + 1; unsigned len = strlen(link) + 1;
@ -908,9 +910,9 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
return err; return err;
} }
static int fuse_rename2(struct inode *olddir, struct dentry *oldent, static int fuse_rename2(struct user_namespace *mnt_userns, struct inode *olddir,
struct inode *newdir, struct dentry *newent, struct dentry *oldent, struct inode *newdir,
unsigned int flags) struct dentry *newent, unsigned int flags)
{ {
struct fuse_conn *fc = get_fuse_conn(olddir); struct fuse_conn *fc = get_fuse_conn(olddir);
int err; int err;
@ -1249,7 +1251,8 @@ static int fuse_perm_getattr(struct inode *inode, int mask)
* access request is sent. Execute permission is still checked * access request is sent. Execute permission is still checked
* locally based on file mode. * locally based on file mode.
*/ */
static int fuse_permission(struct inode *inode, int mask) static int fuse_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask)
{ {
struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_conn *fc = get_fuse_conn(inode);
bool refreshed = false; bool refreshed = false;
@ -1757,7 +1760,8 @@ error:
return err; return err;
} }
static int fuse_setattr(struct dentry *entry, struct iattr *attr) static int fuse_setattr(struct user_namespace *mnt_userns, struct dentry *entry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(entry); struct inode *inode = d_inode(entry);
struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_conn *fc = get_fuse_conn(inode);
@ -1819,7 +1823,8 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
return ret; return ret;
} }
static int fuse_getattr(const struct path *path, struct kstat *stat, static int fuse_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags) u32 request_mask, unsigned int flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);

View File

@ -1180,8 +1180,8 @@ extern const struct xattr_handler *fuse_no_acl_xattr_handlers[];
struct posix_acl; struct posix_acl;
struct posix_acl *fuse_get_acl(struct inode *inode, int type); struct posix_acl *fuse_get_acl(struct inode *inode, int type);
int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type); int fuse_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
/* readdir.c */ /* readdir.c */
int fuse_readdir(struct file *file, struct dir_context *ctx); int fuse_readdir(struct file *file, struct dir_context *ctx);

View File

@ -106,7 +106,8 @@ out:
return error; return error;
} }
int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) int gfs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder gh; struct gfs2_holder gh;

View File

@ -13,6 +13,7 @@
extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type); extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type);
extern int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type); extern int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
extern int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type); extern int gfs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
#endif /* __ACL_DOT_H__ */ #endif /* __ACL_DOT_H__ */

View File

@ -256,7 +256,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask,
!capable(CAP_LINUX_IMMUTABLE)) !capable(CAP_LINUX_IMMUTABLE))
goto out; goto out;
if (!IS_IMMUTABLE(inode)) { if (!IS_IMMUTABLE(inode)) {
error = gfs2_permission(inode, MAY_WRITE); error = gfs2_permission(&init_user_ns, inode, MAY_WRITE);
if (error) if (error)
goto out; goto out;
} }

View File

@ -325,7 +325,7 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
} }
if (!is_root) { if (!is_root) {
error = gfs2_permission(dir, MAY_EXEC); error = gfs2_permission(&init_user_ns, dir, MAY_EXEC);
if (error) if (error)
goto out; goto out;
} }
@ -355,7 +355,8 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
{ {
int error; int error;
error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); error = gfs2_permission(&init_user_ns, &dip->i_inode,
MAY_WRITE | MAY_EXEC);
if (error) if (error)
return error; return error;
@ -843,8 +844,8 @@ fail:
* Returns: errno * Returns: errno
*/ */
static int gfs2_create(struct inode *dir, struct dentry *dentry, static int gfs2_create(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
return gfs2_create_inode(dir, dentry, NULL, S_IFREG | mode, 0, NULL, 0, excl); return gfs2_create_inode(dir, dentry, NULL, S_IFREG | mode, 0, NULL, 0, excl);
} }
@ -951,7 +952,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
goto out_gunlock; goto out_gunlock;
error = gfs2_permission(dir, MAY_WRITE | MAY_EXEC); error = gfs2_permission(&init_user_ns, dir, MAY_WRITE | MAY_EXEC);
if (error) if (error)
goto out_gunlock; goto out_gunlock;
@ -1068,7 +1069,8 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
if (IS_APPEND(&dip->i_inode)) if (IS_APPEND(&dip->i_inode))
return -EPERM; return -EPERM;
error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC); error = gfs2_permission(&init_user_ns, &dip->i_inode,
MAY_WRITE | MAY_EXEC);
if (error) if (error)
return error; return error;
@ -1204,8 +1206,8 @@ out_inodes:
* Returns: errno * Returns: errno
*/ */
static int gfs2_symlink(struct inode *dir, struct dentry *dentry, static int gfs2_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *symname) struct dentry *dentry, const char *symname)
{ {
unsigned int size; unsigned int size;
@ -1225,7 +1227,8 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
* Returns: errno * Returns: errno
*/ */
static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int gfs2_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
unsigned dsize = gfs2_max_stuffed_size(GFS2_I(dir)); unsigned dsize = gfs2_max_stuffed_size(GFS2_I(dir));
return gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0); return gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0);
@ -1240,8 +1243,8 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
* *
*/ */
static int gfs2_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, static int gfs2_mknod(struct user_namespace *mnt_userns, struct inode *dir,
dev_t dev) struct dentry *dentry, umode_t mode, dev_t dev)
{ {
return gfs2_create_inode(dir, dentry, NULL, mode, dev, NULL, 0, 0); return gfs2_create_inode(dir, dentry, NULL, mode, dev, NULL, 0, 0);
} }
@ -1490,7 +1493,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
} }
} }
} else { } else {
error = gfs2_permission(ndir, MAY_WRITE | MAY_EXEC); error = gfs2_permission(&init_user_ns, ndir,
MAY_WRITE | MAY_EXEC);
if (error) if (error)
goto out_gunlock; goto out_gunlock;
@ -1525,7 +1529,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
/* Check out the dir to be renamed */ /* Check out the dir to be renamed */
if (dir_rename) { if (dir_rename) {
error = gfs2_permission(d_inode(odentry), MAY_WRITE); error = gfs2_permission(&init_user_ns, d_inode(odentry),
MAY_WRITE);
if (error) if (error)
goto out_gunlock; goto out_gunlock;
} }
@ -1688,12 +1693,14 @@ static int gfs2_exchange(struct inode *odir, struct dentry *odentry,
goto out_gunlock; goto out_gunlock;
if (S_ISDIR(old_mode)) { if (S_ISDIR(old_mode)) {
error = gfs2_permission(odentry->d_inode, MAY_WRITE); error = gfs2_permission(&init_user_ns, odentry->d_inode,
MAY_WRITE);
if (error) if (error)
goto out_gunlock; goto out_gunlock;
} }
if (S_ISDIR(new_mode)) { if (S_ISDIR(new_mode)) {
error = gfs2_permission(ndentry->d_inode, MAY_WRITE); error = gfs2_permission(&init_user_ns, ndentry->d_inode,
MAY_WRITE);
if (error) if (error)
goto out_gunlock; goto out_gunlock;
} }
@ -1747,9 +1754,9 @@ out:
return error; return error;
} }
static int gfs2_rename2(struct inode *odir, struct dentry *odentry, static int gfs2_rename2(struct user_namespace *mnt_userns, struct inode *odir,
struct inode *ndir, struct dentry *ndentry, struct dentry *odentry, struct inode *ndir,
unsigned int flags) struct dentry *ndentry, unsigned int flags)
{ {
flags &= ~RENAME_NOREPLACE; flags &= ~RENAME_NOREPLACE;
@ -1833,7 +1840,8 @@ out:
* Returns: errno * Returns: errno
*/ */
int gfs2_permission(struct inode *inode, int mask) int gfs2_permission(struct user_namespace *mnt_userns, struct inode *inode,
int mask)
{ {
struct gfs2_inode *ip; struct gfs2_inode *ip;
struct gfs2_holder i_gh; struct gfs2_holder i_gh;
@ -1963,7 +1971,8 @@ out:
* Returns: errno * Returns: errno
*/ */
static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) static int gfs2_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
@ -2008,6 +2017,7 @@ out:
/** /**
* gfs2_getattr - Read out an inode's attributes * gfs2_getattr - Read out an inode's attributes
* @mnt_userns: user namespace of the mount the inode was found from
* @path: Object to query * @path: Object to query
* @stat: The inode's stats * @stat: The inode's stats
* @request_mask: Mask of STATX_xxx flags indicating the caller's interests * @request_mask: Mask of STATX_xxx flags indicating the caller's interests
@ -2022,7 +2032,8 @@ out:
* Returns: errno * Returns: errno
*/ */
static int gfs2_getattr(const struct path *path, struct kstat *stat, static int gfs2_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int flags) u32 request_mask, unsigned int flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);

View File

@ -99,7 +99,8 @@ extern int gfs2_inode_refresh(struct gfs2_inode *ip);
extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
int is_root); int is_root);
extern int gfs2_permission(struct inode *inode, int mask); extern int gfs2_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask);
extern int gfs2_setattr_simple(struct inode *inode, struct iattr *attr); extern int gfs2_setattr_simple(struct inode *inode, struct iattr *attr);
extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name); extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);

View File

@ -189,8 +189,8 @@ static int hfs_dir_release(struct inode *inode, struct file *file)
* a directory and return a corresponding inode, given the inode for * a directory and return a corresponding inode, given the inode for
* the directory and the name (and its length) of the new file. * the directory and the name (and its length) of the new file.
*/ */
static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int hfs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct inode *inode; struct inode *inode;
int res; int res;
@ -219,7 +219,8 @@ static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
* in a directory, given the inode for the parent directory and the * in a directory, given the inode for the parent directory and the
* name (and its length) of the new directory. * name (and its length) of the new directory.
*/ */
static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int hfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
struct inode *inode; struct inode *inode;
int res; int res;
@ -279,9 +280,9 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
* new file/directory. * new file/directory.
* XXX: how do you handle must_be dir? * XXX: how do you handle must_be dir?
*/ */
static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, static int hfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
int res; int res;

View File

@ -204,7 +204,8 @@ extern const struct address_space_operations hfs_btree_aops;
extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t); extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t);
extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
extern int hfs_write_inode(struct inode *, struct writeback_control *); extern int hfs_write_inode(struct inode *, struct writeback_control *);
extern int hfs_inode_setattr(struct dentry *, struct iattr *); extern int hfs_inode_setattr(struct user_namespace *, struct dentry *,
struct iattr *);
extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext, extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
__be32 log_size, __be32 phys_size, u32 clump_size); __be32 log_size, __be32 phys_size, u32 clump_size);
extern struct inode *hfs_iget(struct super_block *, struct hfs_cat_key *, hfs_cat_rec *); extern struct inode *hfs_iget(struct super_block *, struct hfs_cat_key *, hfs_cat_rec *);

View File

@ -602,13 +602,15 @@ static int hfs_file_release(struct inode *inode, struct file *file)
* correspond to the same HFS file. * correspond to the same HFS file.
*/ */
int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) int hfs_inode_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct hfs_sb_info *hsb = HFS_SB(inode->i_sb); struct hfs_sb_info *hsb = HFS_SB(inode->i_sb);
int error; int error;
error = setattr_prepare(&init_user_ns, dentry, attr); /* basic permission checks */ error = setattr_prepare(&init_user_ns, dentry,
attr); /* basic permission checks */
if (error) if (error)
return error; return error;

View File

@ -434,8 +434,8 @@ out:
return res; return res;
} }
static int hfsplus_symlink(struct inode *dir, struct dentry *dentry, static int hfsplus_symlink(struct user_namespace *mnt_userns, struct inode *dir,
const char *symname) struct dentry *dentry, const char *symname)
{ {
struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
struct inode *inode; struct inode *inode;
@ -476,8 +476,8 @@ out:
return res; return res;
} }
static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, static int hfsplus_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
struct inode *inode; struct inode *inode;
@ -517,18 +517,20 @@ out:
return res; return res;
} }
static int hfsplus_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int hfsplus_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
return hfsplus_mknod(dir, dentry, mode, 0); return hfsplus_mknod(&init_user_ns, dir, dentry, mode, 0);
} }
static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int hfsplus_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0); return hfsplus_mknod(&init_user_ns, dir, dentry, mode | S_IFDIR, 0);
} }
static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, static int hfsplus_rename(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {

View File

@ -488,8 +488,9 @@ void hfsplus_inode_write_fork(struct inode *inode,
struct hfsplus_fork_raw *fork); struct hfsplus_fork_raw *fork);
int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd);
int hfsplus_cat_write_inode(struct inode *inode); int hfsplus_cat_write_inode(struct inode *inode);
int hfsplus_getattr(const struct path *path, struct kstat *stat, int hfsplus_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags); struct kstat *stat, u32 request_mask,
unsigned int query_flags);
int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
int datasync); int datasync);

View File

@ -241,7 +241,8 @@ static int hfsplus_file_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) static int hfsplus_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
@ -270,8 +271,9 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
return 0; return 0;
} }
int hfsplus_getattr(const struct path *path, struct kstat *stat, int hfsplus_getattr(struct user_namespace *mnt_userns, const struct path *path,
u32 request_mask, unsigned int query_flags) struct kstat *stat, u32 request_mask,
unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
struct hfsplus_inode_info *hip = HFSPLUS_I(inode); struct hfsplus_inode_info *hip = HFSPLUS_I(inode);

View File

@ -555,8 +555,8 @@ static int read_name(struct inode *ino, char *name)
return 0; return 0;
} }
static int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int hostfs_create(struct user_namespace *mnt_userns, struct inode *dir,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct inode *inode; struct inode *inode;
char *name; char *name;
@ -654,8 +654,8 @@ static int hostfs_unlink(struct inode *ino, struct dentry *dentry)
return err; return err;
} }
static int hostfs_symlink(struct inode *ino, struct dentry *dentry, static int hostfs_symlink(struct user_namespace *mnt_userns, struct inode *ino,
const char *to) struct dentry *dentry, const char *to)
{ {
char *file; char *file;
int err; int err;
@ -667,7 +667,8 @@ static int hostfs_symlink(struct inode *ino, struct dentry *dentry,
return err; return err;
} }
static int hostfs_mkdir(struct inode *ino, struct dentry *dentry, umode_t mode) static int hostfs_mkdir(struct user_namespace *mnt_userns, struct inode *ino,
struct dentry *dentry, umode_t mode)
{ {
char *file; char *file;
int err; int err;
@ -691,7 +692,8 @@ static int hostfs_rmdir(struct inode *ino, struct dentry *dentry)
return err; return err;
} }
static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) static int hostfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, dev_t dev)
{ {
struct inode *inode; struct inode *inode;
char *name; char *name;
@ -729,7 +731,8 @@ static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
return err; return err;
} }
static int hostfs_rename2(struct inode *old_dir, struct dentry *old_dentry, static int hostfs_rename2(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {
@ -757,7 +760,8 @@ static int hostfs_rename2(struct inode *old_dir, struct dentry *old_dentry,
return err; return err;
} }
static int hostfs_permission(struct inode *ino, int desired) static int hostfs_permission(struct user_namespace *mnt_userns,
struct inode *ino, int desired)
{ {
char *name; char *name;
int r = 0, w = 0, x = 0, err; int r = 0, w = 0, x = 0, err;
@ -783,7 +787,8 @@ static int hostfs_permission(struct inode *ino, int desired)
return err; return err;
} }
static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) static int hostfs_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct hostfs_iattr attrs; struct hostfs_iattr attrs;

View File

@ -280,7 +280,7 @@ void hpfs_init_inode(struct inode *);
void hpfs_read_inode(struct inode *); void hpfs_read_inode(struct inode *);
void hpfs_write_inode(struct inode *); void hpfs_write_inode(struct inode *);
void hpfs_write_inode_nolock(struct inode *); void hpfs_write_inode_nolock(struct inode *);
int hpfs_setattr(struct dentry *, struct iattr *); int hpfs_setattr(struct user_namespace *, struct dentry *, struct iattr *);
void hpfs_write_if_changed(struct inode *); void hpfs_write_if_changed(struct inode *);
void hpfs_evict_inode(struct inode *); void hpfs_evict_inode(struct inode *);

View File

@ -257,7 +257,8 @@ void hpfs_write_inode_nolock(struct inode *i)
brelse(bh); brelse(bh);
} }
int hpfs_setattr(struct dentry *dentry, struct iattr *attr) int hpfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error = -EINVAL; int error = -EINVAL;

View File

@ -20,7 +20,8 @@ static void hpfs_update_directory_times(struct inode *dir)
hpfs_write_inode_nolock(dir); hpfs_write_inode_nolock(dir);
} }
static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int hpfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
const unsigned char *name = dentry->d_name.name; const unsigned char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
@ -128,7 +129,8 @@ bail:
return err; return err;
} }
static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) static int hpfs_create(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, bool excl)
{ {
const unsigned char *name = dentry->d_name.name; const unsigned char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
@ -215,7 +217,8 @@ bail:
return err; return err;
} }
static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) static int hpfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
const unsigned char *name = dentry->d_name.name; const unsigned char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
@ -289,7 +292,8 @@ bail:
return err; return err;
} }
static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink) static int hpfs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, const char *symlink)
{ {
const unsigned char *name = dentry->d_name.name; const unsigned char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
@ -506,10 +510,10 @@ fail:
const struct address_space_operations hpfs_symlink_aops = { const struct address_space_operations hpfs_symlink_aops = {
.readpage = hpfs_symlink_readpage .readpage = hpfs_symlink_readpage
}; };
static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, static int hpfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
const unsigned char *old_name = old_dentry->d_name.name; const unsigned char *old_name = old_dentry->d_name.name;
unsigned old_len = old_dentry->d_name.len; unsigned old_len = old_dentry->d_name.len;

View File

@ -751,7 +751,8 @@ out:
return error; return error;
} }
static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) static int hugetlbfs_setattr(struct user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct hstate *h = hstate_inode(inode); struct hstate *h = hstate_inode(inode);
@ -898,33 +899,39 @@ static int do_hugetlbfs_mknod(struct inode *dir,
return error; return error;
} }
static int hugetlbfs_mknod(struct inode *dir, static int hugetlbfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode, dev_t dev) struct dentry *dentry, umode_t mode, dev_t dev)
{ {
return do_hugetlbfs_mknod(dir, dentry, mode, dev, false); return do_hugetlbfs_mknod(dir, dentry, mode, dev, false);
} }
static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) static int hugetlbfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
struct dentry *dentry, umode_t mode)
{ {
int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0); int retval = hugetlbfs_mknod(&init_user_ns, dir, dentry,
mode | S_IFDIR, 0);
if (!retval) if (!retval)
inc_nlink(dir); inc_nlink(dir);
return retval; return retval;
} }
static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) static int hugetlbfs_create(struct user_namespace *mnt_userns,
struct inode *dir, struct dentry *dentry,
umode_t mode, bool excl)
{ {
return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0); return hugetlbfs_mknod(&init_user_ns, dir, dentry, mode | S_IFREG, 0);
} }
static int hugetlbfs_tmpfile(struct inode *dir, static int hugetlbfs_tmpfile(struct user_namespace *mnt_userns,
struct dentry *dentry, umode_t mode) struct inode *dir, struct dentry *dentry,
umode_t mode)
{ {
return do_hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0, true); return do_hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0, true);
} }
static int hugetlbfs_symlink(struct inode *dir, static int hugetlbfs_symlink(struct user_namespace *mnt_userns,
struct dentry *dentry, const char *symname) struct inode *dir, struct dentry *dentry,
const char *symname)
{ {
struct inode *inode; struct inode *inode;
int error = -ENOSPC; int error = -ENOSPC;

View File

@ -226,7 +226,8 @@ static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *a
return rc; return rc;
} }
int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) int jffs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
int rc, xprefix; int rc, xprefix;

View File

@ -28,7 +28,8 @@ struct jffs2_acl_header {
#ifdef CONFIG_JFFS2_FS_POSIX_ACL #ifdef CONFIG_JFFS2_FS_POSIX_ACL
struct posix_acl *jffs2_get_acl(struct inode *inode, int type); struct posix_acl *jffs2_get_acl(struct inode *inode, int type);
int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type); int jffs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
extern int jffs2_init_acl_pre(struct inode *, struct inode *, umode_t *); extern int jffs2_init_acl_pre(struct inode *, struct inode *, umode_t *);
extern int jffs2_init_acl_post(struct inode *); extern int jffs2_init_acl_post(struct inode *);

View File

@ -24,18 +24,21 @@
static int jffs2_readdir (struct file *, struct dir_context *); static int jffs2_readdir (struct file *, struct dir_context *);
static int jffs2_create (struct inode *,struct dentry *,umode_t, static int jffs2_create (struct user_namespace *, struct inode *,
bool); struct dentry *, umode_t, bool);
static struct dentry *jffs2_lookup (struct inode *,struct dentry *, static struct dentry *jffs2_lookup (struct inode *,struct dentry *,
unsigned int); unsigned int);
static int jffs2_link (struct dentry *,struct inode *,struct dentry *); static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
static int jffs2_unlink (struct inode *,struct dentry *); static int jffs2_unlink (struct inode *,struct dentry *);
static int jffs2_symlink (struct inode *,struct dentry *,const char *); static int jffs2_symlink (struct user_namespace *, struct inode *,
static int jffs2_mkdir (struct inode *,struct dentry *,umode_t); struct dentry *, const char *);
static int jffs2_mkdir (struct user_namespace *, struct inode *,struct dentry *,
umode_t);
static int jffs2_rmdir (struct inode *,struct dentry *); static int jffs2_rmdir (struct inode *,struct dentry *);
static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); static int jffs2_mknod (struct user_namespace *, struct inode *,struct dentry *,
static int jffs2_rename (struct inode *, struct dentry *, umode_t,dev_t);
struct inode *, struct dentry *, static int jffs2_rename (struct user_namespace *, struct inode *,
struct dentry *, struct inode *, struct dentry *,
unsigned int); unsigned int);
const struct file_operations jffs2_dir_operations = const struct file_operations jffs2_dir_operations =
@ -157,8 +160,8 @@ static int jffs2_readdir(struct file *file, struct dir_context *ctx)
/***********************************************************************/ /***********************************************************************/
static int jffs2_create(struct inode *dir_i, struct dentry *dentry, static int jffs2_create(struct user_namespace *mnt_userns, struct inode *dir_i,
umode_t mode, bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
struct jffs2_raw_inode *ri; struct jffs2_raw_inode *ri;
struct jffs2_inode_info *f, *dir_f; struct jffs2_inode_info *f, *dir_f;
@ -276,7 +279,8 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de
/***********************************************************************/ /***********************************************************************/
static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char *target) static int jffs2_symlink (struct user_namespace *mnt_userns, struct inode *dir_i,
struct dentry *dentry, const char *target)
{ {
struct jffs2_inode_info *f, *dir_f; struct jffs2_inode_info *f, *dir_f;
struct jffs2_sb_info *c; struct jffs2_sb_info *c;
@ -438,7 +442,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
} }
static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode) static int jffs2_mkdir (struct user_namespace *mnt_userns, struct inode *dir_i,
struct dentry *dentry, umode_t mode)
{ {
struct jffs2_inode_info *f, *dir_f; struct jffs2_inode_info *f, *dir_f;
struct jffs2_sb_info *c; struct jffs2_sb_info *c;
@ -609,7 +614,8 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
return ret; return ret;
} }
static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode, dev_t rdev) static int jffs2_mknod (struct user_namespace *mnt_userns, struct inode *dir_i,
struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct jffs2_inode_info *f, *dir_f; struct jffs2_inode_info *f, *dir_f;
struct jffs2_sb_info *c; struct jffs2_sb_info *c;
@ -756,7 +762,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
return ret; return ret;
} }
static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, static int jffs2_rename (struct user_namespace *mnt_userns,
struct inode *old_dir_i, struct dentry *old_dentry,
struct inode *new_dir_i, struct dentry *new_dentry, struct inode *new_dir_i, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {

View File

@ -190,7 +190,8 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
return 0; return 0;
} }
int jffs2_setattr(struct dentry *dentry, struct iattr *iattr) int jffs2_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *iattr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int rc; int rc;

View File

@ -164,7 +164,7 @@ long jffs2_ioctl(struct file *, unsigned int, unsigned long);
extern const struct inode_operations jffs2_symlink_inode_operations; extern const struct inode_operations jffs2_symlink_inode_operations;
/* fs.c */ /* fs.c */
int jffs2_setattr (struct dentry *, struct iattr *); int jffs2_setattr (struct user_namespace *, struct dentry *, struct iattr *);
int jffs2_do_setattr (struct inode *, struct iattr *); int jffs2_do_setattr (struct inode *, struct iattr *);
struct inode *jffs2_iget(struct super_block *, unsigned long); struct inode *jffs2_iget(struct super_block *, unsigned long);
void jffs2_evict_inode (struct inode *); void jffs2_evict_inode (struct inode *);

View File

@ -91,7 +91,8 @@ out:
return rc; return rc;
} }
int jfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) int jfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type)
{ {
int rc; int rc;
tid_t tid; tid_t tid;

View File

@ -85,7 +85,8 @@ static int jfs_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
int jfs_setattr(struct dentry *dentry, struct iattr *iattr) int jfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *iattr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int rc; int rc;

View File

@ -8,7 +8,8 @@
#ifdef CONFIG_JFS_POSIX_ACL #ifdef CONFIG_JFS_POSIX_ACL
struct posix_acl *jfs_get_acl(struct inode *inode, int type); struct posix_acl *jfs_get_acl(struct inode *inode, int type);
int jfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); int jfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
struct posix_acl *acl, int type);
int jfs_init_acl(tid_t, struct inode *, struct inode *); int jfs_init_acl(tid_t, struct inode *, struct inode *);
#else #else

View File

@ -26,7 +26,7 @@ extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type); int fh_len, int fh_type);
extern void jfs_set_inode_flags(struct inode *); extern void jfs_set_inode_flags(struct inode *);
extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern int jfs_setattr(struct dentry *, struct iattr *); extern int jfs_setattr(struct user_namespace *, struct dentry *, struct iattr *);
extern const struct address_space_operations jfs_aops; extern const struct address_space_operations jfs_aops;
extern const struct inode_operations jfs_dir_inode_operations; extern const struct inode_operations jfs_dir_inode_operations;

View File

@ -59,8 +59,8 @@ static inline void free_ea_wmap(struct inode *inode)
* RETURN: Errors from subroutines * RETURN: Errors from subroutines
* *
*/ */
static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, static int jfs_create(struct user_namespace *mnt_userns, struct inode *dip,
bool excl) struct dentry *dentry, umode_t mode, bool excl)
{ {
int rc = 0; int rc = 0;
tid_t tid; /* transaction id */ tid_t tid; /* transaction id */
@ -192,7 +192,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
* note: * note:
* EACCES: user needs search+write permission on the parent directory * EACCES: user needs search+write permission on the parent directory
*/ */
static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) static int jfs_mkdir(struct user_namespace *mnt_userns, struct inode *dip,
struct dentry *dentry, umode_t mode)
{ {
int rc = 0; int rc = 0;
tid_t tid; /* transaction id */ tid_t tid; /* transaction id */
@ -868,8 +869,8 @@ static int jfs_link(struct dentry *old_dentry,
* an intermediate result whose length exceeds PATH_MAX [XPG4.2] * an intermediate result whose length exceeds PATH_MAX [XPG4.2]
*/ */
static int jfs_symlink(struct inode *dip, struct dentry *dentry, static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip,
const char *name) struct dentry *dentry, const char *name)
{ {
int rc; int rc;
tid_t tid; tid_t tid;
@ -1058,9 +1059,9 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
* *
* FUNCTION: rename a file or directory * FUNCTION: rename a file or directory
*/ */
static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, static int jfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
struct inode *new_dir, struct dentry *new_dentry, struct dentry *old_dentry, struct inode *new_dir,
unsigned int flags) struct dentry *new_dentry, unsigned int flags)
{ {
struct btstack btstack; struct btstack btstack;
ino_t ino; ino_t ino;
@ -1344,8 +1345,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
* *
* FUNCTION: Create a special file (device) * FUNCTION: Create a special file (device)
*/ */
static int jfs_mknod(struct inode *dir, struct dentry *dentry, static int jfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
umode_t mode, dev_t rdev) struct dentry *dentry, umode_t mode, dev_t rdev)
{ {
struct jfs_inode_info *jfs_ip; struct jfs_inode_info *jfs_ip;
struct btstack btstack; struct btstack btstack;

View File

@ -1110,7 +1110,8 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
return ret; return ret;
} }
static int kernfs_iop_mkdir(struct inode *dir, struct dentry *dentry, static int kernfs_iop_mkdir(struct user_namespace *mnt_userns,
struct inode *dir, struct dentry *dentry,
umode_t mode) umode_t mode)
{ {
struct kernfs_node *parent = dir->i_private; struct kernfs_node *parent = dir->i_private;
@ -1147,7 +1148,8 @@ static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry)
return ret; return ret;
} }
static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry, static int kernfs_iop_rename(struct user_namespace *mnt_userns,
struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry, struct inode *new_dir, struct dentry *new_dentry,
unsigned int flags) unsigned int flags)
{ {

View File

@ -112,7 +112,8 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
return ret; return ret;
} }
int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr) int kernfs_iop_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *iattr)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
struct kernfs_node *kn = inode->i_private; struct kernfs_node *kn = inode->i_private;
@ -183,7 +184,8 @@ static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
set_nlink(inode, kn->dir.subdirs + 2); set_nlink(inode, kn->dir.subdirs + 2);
} }
int kernfs_iop_getattr(const struct path *path, struct kstat *stat, int kernfs_iop_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags) u32 request_mask, unsigned int query_flags)
{ {
struct inode *inode = d_inode(path->dentry); struct inode *inode = d_inode(path->dentry);
@ -272,7 +274,8 @@ void kernfs_evict_inode(struct inode *inode)
kernfs_put(kn); kernfs_put(kn);
} }
int kernfs_iop_permission(struct inode *inode, int mask) int kernfs_iop_permission(struct user_namespace *mnt_userns,
struct inode *inode, int mask)
{ {
struct kernfs_node *kn; struct kernfs_node *kn;

View File

@ -89,9 +89,12 @@ extern struct kmem_cache *kernfs_node_cache, *kernfs_iattrs_cache;
*/ */
extern const struct xattr_handler *kernfs_xattr_handlers[]; extern const struct xattr_handler *kernfs_xattr_handlers[];
void kernfs_evict_inode(struct inode *inode); void kernfs_evict_inode(struct inode *inode);
int kernfs_iop_permission(struct inode *inode, int mask); int kernfs_iop_permission(struct user_namespace *mnt_userns,
int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr); struct inode *inode, int mask);
int kernfs_iop_getattr(const struct path *path, struct kstat *stat, int kernfs_iop_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
struct iattr *iattr);
int kernfs_iop_getattr(struct user_namespace *mnt_userns,
const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags); u32 request_mask, unsigned int query_flags);
ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size); ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size);
int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr); int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);

Some files were not shown because too many files have changed in this diff Show More