You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
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>
This commit is contained in:
@@ -415,28 +415,29 @@ As of kernel 2.6.22, the following members are defined:
|
||||
.. code-block:: c
|
||||
|
||||
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);
|
||||
int (*link) (struct dentry *,struct inode *,struct dentry *);
|
||||
int (*unlink) (struct inode *,struct dentry *);
|
||||
int (*symlink) (struct inode *,struct dentry *,const char *);
|
||||
int (*mkdir) (struct inode *,struct dentry *,umode_t);
|
||||
int (*symlink) (struct user_namespace *, struct inode *,struct dentry *,const char *);
|
||||
int (*mkdir) (struct user_namespace *, struct inode *,struct dentry *,umode_t);
|
||||
int (*rmdir) (struct inode *,struct dentry *);
|
||||
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
|
||||
int (*rename) (struct inode *, struct dentry *,
|
||||
int (*mknod) (struct user_namespace *, struct inode *,struct dentry *,umode_t,dev_t);
|
||||
int (*rename) (struct user_namespace *, struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *, unsigned int);
|
||||
int (*readlink) (struct dentry *, char __user *,int);
|
||||
const char *(*get_link) (struct dentry *, struct inode *,
|
||||
struct delayed_call *);
|
||||
int (*permission) (struct inode *, int);
|
||||
int (*permission) (struct user_namespace *, struct inode *, int);
|
||||
int (*get_acl)(struct inode *, int);
|
||||
int (*setattr) (struct dentry *, struct iattr *);
|
||||
int (*getattr) (const struct path *, struct kstat *, u32, unsigned int);
|
||||
int (*setattr) (struct user_namespace *, struct dentry *, struct iattr *);
|
||||
int (*getattr) (struct user_namespace *, const struct path *, struct kstat *, u32, unsigned int);
|
||||
ssize_t (*listxattr) (struct dentry *, char *, size_t);
|
||||
void (*update_time)(struct inode *, struct timespec *, int);
|
||||
int (*atomic_open)(struct inode *, struct dentry *, struct file *,
|
||||
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
|
||||
|
||||
@@ -91,7 +91,8 @@ out:
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -355,7 +355,8 @@ static inline bool is_binderfs_control_device(const struct 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,
|
||||
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))
|
||||
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)
|
||||
|
||||
@@ -280,7 +280,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
|
||||
struct iattr iattr = { 0 };
|
||||
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);
|
||||
if (retval)
|
||||
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
|
||||
* mode ?
|
||||
*/
|
||||
v9fs_vfs_setattr_dotl(dentry, &iattr);
|
||||
v9fs_vfs_setattr_dotl(&init_user_ns, dentry, &iattr);
|
||||
}
|
||||
break;
|
||||
case ACL_TYPE_DEFAULT:
|
||||
|
||||
@@ -135,7 +135,8 @@ extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
|
||||
unsigned int flags);
|
||||
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_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,
|
||||
unsigned int flags);
|
||||
extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses,
|
||||
|
||||
@@ -59,7 +59,8 @@ void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat);
|
||||
int v9fs_uflags2omode(int uflags, int extended);
|
||||
|
||||
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 datasync);
|
||||
int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode);
|
||||
|
||||
@@ -676,8 +676,8 @@ error:
|
||||
*/
|
||||
|
||||
static int
|
||||
v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
bool excl)
|
||||
v9fs_vfs_create(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
|
||||
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;
|
||||
u32 perm;
|
||||
@@ -907,9 +908,9 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)
|
||||
*/
|
||||
|
||||
int
|
||||
v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
v9fs_vfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
struct dentry *old_dentry, struct inode *new_dir,
|
||||
struct dentry *new_dentry, unsigned int flags)
|
||||
{
|
||||
int retval;
|
||||
struct inode *old_inode;
|
||||
@@ -1016,8 +1017,8 @@ done:
|
||||
*/
|
||||
|
||||
static int
|
||||
v9fs_vfs_getattr(const struct path *path, struct kstat *stat,
|
||||
u32 request_mask, unsigned int flags)
|
||||
v9fs_vfs_getattr(struct user_namespace *mnt_userns, const struct path *path,
|
||||
struct kstat *stat, u32 request_mask, unsigned int flags)
|
||||
{
|
||||
struct dentry *dentry = path->dentry;
|
||||
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;
|
||||
struct v9fs_session_info *v9ses;
|
||||
@@ -1295,7 +1297,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
|
||||
*/
|
||||
|
||||
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",
|
||||
dir->i_ino, dentry, symname);
|
||||
@@ -1348,7 +1351,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
|
||||
*/
|
||||
|
||||
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);
|
||||
int retval;
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#include "acl.h"
|
||||
|
||||
static int
|
||||
v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
|
||||
dev_t rdev);
|
||||
v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t omode, dev_t rdev);
|
||||
|
||||
/**
|
||||
* 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
|
||||
v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
|
||||
bool excl)
|
||||
v9fs_vfs_create_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
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
|
||||
@@ -367,8 +367,9 @@ err_clunk_old_fid:
|
||||
*
|
||||
*/
|
||||
|
||||
static int v9fs_vfs_mkdir_dotl(struct inode *dir,
|
||||
struct dentry *dentry, umode_t omode)
|
||||
static int v9fs_vfs_mkdir_dotl(struct user_namespace *mnt_userns,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
umode_t omode)
|
||||
{
|
||||
int err;
|
||||
struct v9fs_session_info *v9ses;
|
||||
@@ -457,8 +458,9 @@ error:
|
||||
}
|
||||
|
||||
static int
|
||||
v9fs_vfs_getattr_dotl(const struct path *path, struct kstat *stat,
|
||||
u32 request_mask, unsigned int flags)
|
||||
v9fs_vfs_getattr_dotl(struct user_namespace *mnt_userns,
|
||||
const struct path *path, struct kstat *stat,
|
||||
u32 request_mask, unsigned int flags)
|
||||
{
|
||||
struct dentry *dentry = path->dentry;
|
||||
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;
|
||||
struct p9_fid *fid = NULL;
|
||||
@@ -684,8 +687,8 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
|
||||
}
|
||||
|
||||
static int
|
||||
v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
|
||||
const char *symname)
|
||||
v9fs_vfs_symlink_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, const char *symname)
|
||||
{
|
||||
int err;
|
||||
kgid_t gid;
|
||||
@@ -824,8 +827,8 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
|
||||
*
|
||||
*/
|
||||
static int
|
||||
v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
|
||||
dev_t rdev)
|
||||
v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t omode, dev_t rdev)
|
||||
{
|
||||
int err;
|
||||
kgid_t gid;
|
||||
|
||||
@@ -144,7 +144,8 @@ struct adfs_discmap {
|
||||
/* Inode stuff */
|
||||
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_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 */
|
||||
int adfs_map_lookup(struct super_block *sb, u32 frag_id, unsigned int offset);
|
||||
|
||||
@@ -292,7 +292,8 @@ out:
|
||||
* later.
|
||||
*/
|
||||
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 super_block *sb = inode->i_sb;
|
||||
|
||||
@@ -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 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_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool);
|
||||
extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
|
||||
extern int affs_create(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
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_link(struct dentry *olddentry, struct inode *dir,
|
||||
struct dentry *dentry);
|
||||
extern int affs_symlink(struct inode *dir, struct dentry *dentry,
|
||||
const char *symname);
|
||||
extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags);
|
||||
extern int affs_symlink(struct user_namespace *mnt_userns,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
const char *symname);
|
||||
extern int affs_rename2(struct user_namespace *mnt_userns,
|
||||
struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags);
|
||||
|
||||
/* inode.c */
|
||||
|
||||
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 struct inode *affs_iget(struct super_block *sb,
|
||||
unsigned long ino);
|
||||
extern int affs_write_inode(struct inode *inode,
|
||||
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 */
|
||||
|
||||
|
||||
@@ -216,7 +216,8 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
|
||||
}
|
||||
|
||||
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);
|
||||
int error;
|
||||
|
||||
@@ -242,7 +242,8 @@ affs_unlink(struct inode *dir, struct dentry *dentry)
|
||||
}
|
||||
|
||||
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 inode *inode;
|
||||
@@ -273,7 +274,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
|
||||
}
|
||||
|
||||
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;
|
||||
int error;
|
||||
@@ -311,7 +313,8 @@ affs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||
}
|
||||
|
||||
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 buffer_head *bh;
|
||||
@@ -498,9 +501,9 @@ done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
int affs_rename2(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
int affs_rename2(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
struct dentry *old_dentry, struct inode *new_dir,
|
||||
struct dentry *new_dentry, unsigned int flags)
|
||||
{
|
||||
|
||||
if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE))
|
||||
|
||||
34
fs/afs/dir.c
34
fs/afs/dir.c
@@ -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);
|
||||
static int afs_lookup_filldir(struct dir_context *ctx, const char *name, int nlen,
|
||||
loff_t fpos, u64 ino, unsigned dtype);
|
||||
static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
bool excl);
|
||||
static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
|
||||
static int afs_create(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl);
|
||||
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_unlink(struct inode *dir, struct dentry *dentry);
|
||||
static int afs_link(struct dentry *from, struct inode *dir,
|
||||
struct dentry *dentry);
|
||||
static int afs_symlink(struct inode *dir, struct dentry *dentry,
|
||||
const char *content);
|
||||
static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags);
|
||||
static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, const char *content);
|
||||
static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
struct dentry *old_dentry, struct inode *new_dir,
|
||||
struct dentry *new_dentry, unsigned int flags);
|
||||
static int afs_dir_releasepage(struct page *page, gfp_t gfp_flags);
|
||||
static void afs_dir_invalidatepage(struct page *page, unsigned int offset,
|
||||
unsigned int length);
|
||||
@@ -1325,7 +1326,8 @@ static const struct afs_operation_ops afs_mkdir_operation = {
|
||||
/*
|
||||
* 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_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
|
||||
*/
|
||||
static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
||||
bool excl)
|
||||
static int afs_create(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, bool excl)
|
||||
{
|
||||
struct afs_operation *op;
|
||||
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
|
||||
*/
|
||||
static int afs_symlink(struct inode *dir, struct dentry *dentry,
|
||||
const char *content)
|
||||
static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, const char *content)
|
||||
{
|
||||
struct afs_operation *op;
|
||||
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
|
||||
*/
|
||||
static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
||||
struct dentry *old_dentry, struct inode *new_dir,
|
||||
struct dentry *new_dentry, unsigned int flags)
|
||||
{
|
||||
struct afs_operation *op;
|
||||
struct afs_vnode *orig_dvnode, *new_dvnode, *vnode;
|
||||
|
||||
@@ -734,8 +734,8 @@ error_unlock:
|
||||
/*
|
||||
* read the attributes of an inode
|
||||
*/
|
||||
int afs_getattr(const struct path *path, struct kstat *stat,
|
||||
u32 request_mask, unsigned int query_flags)
|
||||
int afs_getattr(struct user_namespace *mnt_userns, const struct path *path,
|
||||
struct kstat *stat, u32 request_mask, unsigned int query_flags)
|
||||
{
|
||||
struct inode *inode = d_inode(path->dentry);
|
||||
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
|
||||
*/
|
||||
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_vnode *vnode = AFS_FS_I(d_inode(dentry));
|
||||
|
||||
@@ -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 bool afs_check_validity(struct afs_vnode *);
|
||||
extern int afs_validate(struct afs_vnode *, struct key *);
|
||||
extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
|
||||
extern int afs_setattr(struct dentry *, struct iattr *);
|
||||
extern int afs_getattr(struct user_namespace *mnt_userns, const struct path *,
|
||||
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 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_rcu(struct afs_cell *);
|
||||
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);
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
* 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);
|
||||
afs_access_t access;
|
||||
|
||||
@@ -395,9 +395,9 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
|
||||
return error;
|
||||
|
||||
if (inode->i_op->setattr)
|
||||
error = inode->i_op->setattr(dentry, attr);
|
||||
error = inode->i_op->setattr(mnt_userns, dentry, attr);
|
||||
else
|
||||
error = simple_setattr(dentry, attr);
|
||||
error = simple_setattr(mnt_userns, dentry, attr);
|
||||
|
||||
if (!error) {
|
||||
fsnotify_change(dentry, ia_valid);
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
|
||||
#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_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);
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long autofs_root_compat_ioctl(struct file *,
|
||||
@@ -524,9 +526,9 @@ static struct dentry *autofs_lookup(struct inode *dir,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int autofs_dir_symlink(struct inode *dir,
|
||||
struct dentry *dentry,
|
||||
const char *symname)
|
||||
static int autofs_dir_symlink(struct user_namespace *mnt_userns,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
const char *symname)
|
||||
{
|
||||
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
|
||||
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;
|
||||
}
|
||||
|
||||
static int autofs_dir_mkdir(struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode)
|
||||
static int autofs_dir_mkdir(struct user_namespace *mnt_userns,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
umode_t mode)
|
||||
{
|
||||
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
|
||||
struct autofs_info *ino = autofs_dentry_ino(dentry);
|
||||
|
||||
@@ -27,8 +27,9 @@ static const struct file_operations bad_file_ops =
|
||||
.open = bad_file_open,
|
||||
};
|
||||
|
||||
static int bad_inode_create (struct inode *dir, struct dentry *dentry,
|
||||
umode_t mode, bool excl)
|
||||
static int bad_inode_create(struct user_namespace *mnt_userns,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
umode_t mode, bool excl)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
@@ -50,14 +51,15 @@ static int bad_inode_unlink(struct inode *dir, struct dentry *dentry)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int bad_inode_symlink (struct inode *dir, struct dentry *dentry,
|
||||
const char *symname)
|
||||
static int bad_inode_symlink(struct user_namespace *mnt_userns,
|
||||
struct inode *dir, struct dentry *dentry,
|
||||
const char *symname)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry,
|
||||
umode_t mode)
|
||||
static int bad_inode_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode)
|
||||
{
|
||||
return -EIO;
|
||||
}
|
||||
@@ -67,13 +69,14 @@ static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static int bad_inode_mknod (struct inode *dir, struct dentry *dentry,
|
||||
umode_t mode, dev_t rdev)
|
||||
static int bad_inode_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||
struct dentry *dentry, umode_t mode, dev_t rdev)
|
||||
{
|
||||
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,
|
||||
unsigned int flags)
|
||||
{
|
||||
@@ -86,18 +89,21 @@ static int bad_inode_readlink(struct dentry *dentry, char __user *buffer,
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -140,13 +146,15 @@ static int bad_inode_atomic_open(struct inode *inode, struct dentry *dentry,
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return -EIO;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user