From 8af96d08f4e02fc40a44bfb560d210d197b92102 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Nov 2015 11:35:26 +0200 Subject: [PATCH] Upgrade Argent kernel to 3.14.50 --- Documentation/filesystems/Locking | 2 - Documentation/filesystems/vfs.txt | 7 --- MAINTAINERS | 21 -------- drivers/block/loop.c | 64 ++-------------------- drivers/block/loop.h | 2 +- fs/Kconfig | 2 - fs/Makefile | 2 - fs/buffer.c | 2 +- fs/ecryptfs/main.c | 7 --- fs/inode.c | 10 +--- fs/internal.h | 7 +++ fs/namei.c | 10 ++-- fs/namespace.c | 29 ---------- fs/notify/group.c | 4 -- fs/notify/mark.c | 4 -- fs/open.c | 25 +-------- fs/proc/base.c | 2 +- fs/proc/nommu.c | 5 +- fs/proc/task_mmu.c | 6 +-- fs/proc/task_nommu.c | 5 +- fs/splice.c | 13 ++--- include/linux/fs.h | 22 -------- include/linux/mm.h | 22 -------- include/linux/mm_types.h | 2 - include/linux/mount.h | 3 -- include/linux/shmem_fs.h | 7 +-- include/linux/splice.h | 6 --- include/uapi/linux/Kbuild | 1 - kernel/fork.c | 2 +- kernel/printk/printk.c | 2 +- mm/Makefile | 2 +- mm/filemap.c | 2 +- mm/fremap.c | 16 +----- mm/madvise.c | 4 +- mm/memory.c | 4 +- mm/mmap.c | 12 ++--- mm/msync.c | 4 +- mm/nommu.c | 10 ++-- mm/shmem.c | 88 +++++++++++-------------------- security/commoncap.c | 2 - security/device_cgroup.c | 2 - security/security.c | 10 ---- 42 files changed, 87 insertions(+), 365 deletions(-) diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index f5d93ce1ce..5b0c083d7c 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking @@ -65,7 +65,6 @@ prototypes: struct file *, unsigned open_flag, umode_t create_mode, int *opened); int (*tmpfile) (struct inode *, struct dentry *, umode_t); - int (*dentry_open)(struct dentry *, struct file *, const struct cred *); locking rules: all may block @@ -94,7 +93,6 @@ fiemap: no update_time: no atomic_open: yes tmpfile: no -dentry_open: no Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on victim. diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index e6e9e81f90..c53784c119 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt @@ -362,7 +362,6 @@ struct inode_operations { int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned open_flag, umode_t create_mode, int *opened); int (*tmpfile) (struct inode *, struct dentry *, umode_t); - int (*dentry_open)(struct dentry *, struct file *, const struct cred *); }; Again, all methods are called without any locks being held, unless @@ -682,12 +681,6 @@ struct address_space_operations { but instead uses bmap to find out where the blocks in the file are and uses those addresses directly. - dentry_open: this is an alternative to f_op->open(), the difference is that - this method may open a file not necessarily originating from the same - filesystem as the one i_op->open() was called on. It may be - useful for stacking filesystems which want to allow native I/O directly - on underlying files. - invalidatepage: If a page has PagePrivate set, then invalidatepage will be called when part or all of the page is to be removed diff --git a/MAINTAINERS b/MAINTAINERS index e8de07c2f5..900d98eec2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1629,20 +1629,6 @@ F: include/linux/audit.h F: include/uapi/linux/audit.h F: kernel/audit* -AUFS (advanced multi layered unification filesystem) FILESYSTEM -M: "J. R. Okajima" -L: linux-unionfs@vger.kernel.org -L: aufs-users@lists.sourceforge.net (members only) -W: http://aufs.sourceforge.net -T: git://git.code.sf.net/p/aufs/aufs3-linux -T: git://github.com/sfjro/aufs3-linux.git -S: Supported -F: Documentation/filesystems/aufs/ -F: Documentation/ABI/testing/debugfs-aufs -F: Documentation/ABI/testing/sysfs-aufs -F: fs/aufs/ -F: include/uapi/linux/aufs_type.h - AUXILIARY DISPLAY DRIVERS M: Miguel Ojeda Sandonis W: http://miguelojeda.es/auxdisplay.htm @@ -6466,13 +6452,6 @@ F: drivers/scsi/osd/ F: include/scsi/osd_* F: fs/exofs/ -OVERLAYFS FILESYSTEM -M: Miklos Szeredi -L: linux-fsdevel@vger.kernel.org -S: Supported -F: fs/overlayfs/* -F: Documentation/filesystems/overlayfs.txt - P54 WIRELESS DRIVER M: Christian Lamparter L: linux-wireless@vger.kernel.org diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 189499096e..66e8c3b94e 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -514,7 +514,7 @@ static void loop_make_request(struct request_queue *q, struct bio *old_bio) } struct switch_request { - struct file *file, *virt_file; + struct file *file; struct completion wait; }; @@ -576,8 +576,7 @@ static int loop_thread(void *data) * First it needs to flush existing IO, it does this by sending a magic * BIO down the pipe. The completion of this BIO does the actual switch. */ -static int loop_switch(struct loop_device *lo, struct file *file, - struct file *virt_file) +static int loop_switch(struct loop_device *lo, struct file *file) { struct switch_request w; struct bio *bio = bio_alloc(GFP_KERNEL, 0); @@ -585,7 +584,6 @@ static int loop_switch(struct loop_device *lo, struct file *file, return -ENOMEM; init_completion(&w.wait); w.file = file; - w.virt_file = virt_file; bio->bi_private = &w; bio->bi_bdev = NULL; loop_make_request(lo->lo_queue, bio); @@ -602,7 +600,7 @@ static int loop_flush(struct loop_device *lo) if (!lo->lo_thread) return 0; - return loop_switch(lo, NULL, NULL); + return loop_switch(lo, NULL); } /* @@ -621,7 +619,6 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p) mapping = file->f_mapping; mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask); lo->lo_backing_file = file; - lo->lo_backing_virt_file = p->virt_file; lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ? mapping->host->i_bdev->bd_block_size : PAGE_SIZE; lo->old_gfp_mask = mapping_gfp_mask(mapping); @@ -630,13 +627,6 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p) complete(&p->wait); } -static struct file *loop_real_file(struct file *file) -{ - struct file *f = NULL; - if (file->f_dentry->d_sb->s_op->real_loop) - f = file->f_dentry->d_sb->s_op->real_loop(file); - return f; -} /* * loop_change_fd switched the backing store of a loopback device to @@ -650,7 +640,6 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, unsigned int arg) { struct file *file, *old_file; - struct file *f, *virt_file = NULL, *old_virt_file; struct inode *inode; int error; @@ -667,16 +656,9 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, file = fget(arg); if (!file) goto out; - f = loop_real_file(file); - if (f) { - virt_file = file; - file = f; - get_file(file); - } inode = file->f_mapping->host; old_file = lo->lo_backing_file; - old_virt_file = lo->lo_backing_virt_file; error = -EINVAL; @@ -688,21 +670,17 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, goto out_putf; /* and ... switch */ - error = loop_switch(lo, file, virt_file); + error = loop_switch(lo, file); if (error) goto out_putf; fput(old_file); - if (old_virt_file) - fput(old_virt_file); if (lo->lo_flags & LO_FLAGS_PARTSCAN) ioctl_by_bdev(bdev, BLKRRPART, 0); return 0; out_putf: fput(file); - if (virt_file) - fput(virt_file); out: return error; } @@ -714,24 +692,6 @@ static inline int is_loop_device(struct file *file) return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR; } -/* - * for AUFS - * no get/put for file. - */ -struct file *loop_backing_file(struct super_block *sb) -{ - struct file *ret; - struct loop_device *l; - - ret = NULL; - if (MAJOR(sb->s_dev) == LOOP_MAJOR) { - l = sb->s_bdev->bd_disk->private_data; - ret = l->lo_backing_file; - } - return ret; -} -EXPORT_SYMBOL(loop_backing_file); - /* loop sysfs attributes */ static ssize_t loop_attr_show(struct device *dev, char *page, @@ -863,7 +823,7 @@ static void loop_config_discard(struct loop_device *lo) static int loop_set_fd(struct loop_device *lo, fmode_t mode, struct block_device *bdev, unsigned int arg) { - struct file *file, *f, *virt_file = NULL; + struct file *file, *f; struct inode *inode; struct address_space *mapping; unsigned lo_blocksize; @@ -878,12 +838,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, file = fget(arg); if (!file) goto out; - f = loop_real_file(file); - if (f) { - virt_file = file; - file = f; - get_file(file); - } error = -EBUSY; if (lo->lo_state != Lo_unbound) @@ -932,7 +886,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, lo->lo_device = bdev; lo->lo_flags = lo_flags; lo->lo_backing_file = file; - lo->lo_backing_virt_file = virt_file; lo->transfer = transfer_none; lo->ioctl = NULL; lo->lo_sizelimit = 0; @@ -977,7 +930,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, lo->lo_thread = NULL; lo->lo_device = NULL; lo->lo_backing_file = NULL; - lo->lo_backing_virt_file = NULL; lo->lo_flags = 0; set_capacity(lo->lo_disk, 0); invalidate_bdev(bdev); @@ -987,8 +939,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, lo->lo_state = Lo_unbound; out_putf: fput(file); - if (virt_file) - fput(virt_file); out: /* This is safe: open() is still holding a reference. */ module_put(THIS_MODULE); @@ -1035,7 +985,6 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer, static int loop_clr_fd(struct loop_device *lo) { struct file *filp = lo->lo_backing_file; - struct file *virt_filp = lo->lo_backing_virt_file; gfp_t gfp = lo->old_gfp_mask; struct block_device *bdev = lo->lo_device; @@ -1069,7 +1018,6 @@ static int loop_clr_fd(struct loop_device *lo) spin_lock_irq(&lo->lo_lock); lo->lo_backing_file = NULL; - lo->lo_backing_virt_file = NULL; spin_unlock_irq(&lo->lo_lock); loop_release_xfer(lo); @@ -1112,8 +1060,6 @@ static int loop_clr_fd(struct loop_device *lo) * bd_mutex which is usually taken before lo_ctl_mutex. */ fput(filp); - if (virt_filp) - fput(virt_filp); return 0; } diff --git a/drivers/block/loop.h b/drivers/block/loop.h index cb918227ed..90df5d6485 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h @@ -44,7 +44,7 @@ struct loop_device { int (*ioctl)(struct loop_device *, int cmd, unsigned long arg); - struct file * lo_backing_file, *lo_backing_virt_file; + struct file * lo_backing_file; struct block_device *lo_device; unsigned lo_blocksize; void *key_data; diff --git a/fs/Kconfig b/fs/Kconfig index 833a2b8303..7385e54be4 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -67,7 +67,6 @@ source "fs/quota/Kconfig" source "fs/autofs4/Kconfig" source "fs/fuse/Kconfig" -source "fs/overlayfs/Kconfig" menu "Caches" @@ -209,7 +208,6 @@ source "fs/ufs/Kconfig" source "fs/exofs/Kconfig" source "fs/f2fs/Kconfig" source "fs/efivarfs/Kconfig" -source "fs/aufs/Kconfig" endif # MISC_FILESYSTEMS diff --git a/fs/Makefile b/fs/Makefile index 18e0bf7bf3..47ac07bb4a 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -104,7 +104,6 @@ obj-$(CONFIG_QNX6FS_FS) += qnx6/ obj-$(CONFIG_AUTOFS4_FS) += autofs4/ obj-$(CONFIG_ADFS_FS) += adfs/ obj-$(CONFIG_FUSE_FS) += fuse/ -obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ obj-$(CONFIG_UDF_FS) += udf/ obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ obj-$(CONFIG_OMFS_FS) += omfs/ @@ -126,4 +125,3 @@ obj-y += exofs/ # Multiple modules obj-$(CONFIG_CEPH_FS) += ceph/ obj-$(CONFIG_PSTORE) += pstore/ obj-$(CONFIG_EFIVAR_FS) += efivarfs/ -obj-$(CONFIG_AUFS_FS) += aufs/ diff --git a/fs/buffer.c b/fs/buffer.c index 37f4df4750..eef21c69f2 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2470,7 +2470,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, * Update file times before taking page lock. We may end up failing the * fault so this update may be superfluous but who really cares... */ - vma_file_update_time(vma); + file_update_time(vma->vm_file); ret = __block_page_mkwrite(vma, vmf, get_block); sb_end_pagefault(sb); diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index d9eb84bda5..34eb8433d9 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -576,13 +576,6 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags s->s_maxbytes = path.dentry->d_sb->s_maxbytes; s->s_blocksize = path.dentry->d_sb->s_blocksize; s->s_magic = ECRYPTFS_SUPER_MAGIC; - s->s_stack_depth = path.dentry->d_sb->s_stack_depth + 1; - - rc = -EINVAL; - if (s->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { - pr_err("eCryptfs: maximum fs stacking depth exceeded\n"); - goto out_free; - } inode = ecryptfs_get_inode(path.dentry->d_inode, s); rc = PTR_ERR(inode); diff --git a/fs/inode.c b/fs/inode.c index b2c3a9a9d8..644875bcc8 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -57,7 +57,6 @@ static struct hlist_head *inode_hashtable __read_mostly; static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock); __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_sb_list_lock); -EXPORT_SYMBOL(inode_sb_list_lock); /* * Empty aops. Can be used for the cases where the user does not @@ -840,8 +839,6 @@ unsigned int get_next_ino(void) unsigned int *p = &get_cpu_var(last_ino); unsigned int res = *p; -start: - #ifdef CONFIG_SMP if (unlikely((res & (LAST_INO_BATCH-1)) == 0)) { static atomic_t shared_last_ino; @@ -851,9 +848,7 @@ unsigned int get_next_ino(void) } #endif - if (unlikely(!++res)) - goto start; /* never zero */ - *p = res; + *p = ++res; put_cpu_var(last_ino); return res; } @@ -1502,7 +1497,7 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, * This does the actual work of updating an inodes time or version. Must have * had called mnt_want_write() before calling this. */ -int update_time(struct inode *inode, struct timespec *time, int flags) +static int update_time(struct inode *inode, struct timespec *time, int flags) { if (inode->i_op->update_time) return inode->i_op->update_time(inode, time, flags); @@ -1518,7 +1513,6 @@ int update_time(struct inode *inode, struct timespec *time, int flags) mark_inode_dirty_sync(inode); return 0; } -EXPORT_SYMBOL(update_time); /** * touch_atime - update the access time diff --git a/fs/internal.h b/fs/internal.h index dd41b12c13..4657424074 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -42,6 +42,7 @@ extern void __init chrdev_init(void); /* * namei.c */ +extern int __inode_permission(struct inode *, int); extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *); extern int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, unsigned int, struct path *); @@ -133,6 +134,12 @@ extern long prune_dcache_sb(struct super_block *sb, unsigned long nr_to_scan, extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); extern int rw_verify_area(int, struct file *, const loff_t *, size_t); +/* + * splice.c + */ +extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, + loff_t *opos, size_t len, unsigned int flags); + /* * pipe.c */ diff --git a/fs/namei.c b/fs/namei.c index 0d497c386a..ccb8000f34 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -415,7 +415,6 @@ int __inode_permission(struct inode *inode, int mask) return security_inode_permission(inode, mask); } -EXPORT_SYMBOL(__inode_permission); /** * sb_permission - Check superblock-level permissions @@ -3040,12 +3039,9 @@ static int do_last(struct nameidata *nd, struct path *path, error = may_open(&nd->path, acc_mode, open_flag); if (error) goto out; - - BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ - error = vfs_open(&nd->path, file, current_cred()); - if (!error) { - *opened |= FILE_OPENED; - } else { + file->f_path.mnt = nd->path.mnt; + error = finish_open(file, nd->path.dentry, NULL, opened); + if (error) { if (error == -EOPENSTALE) goto stale_open; goto out; diff --git a/fs/namespace.c b/fs/namespace.c index e082613bea..fc99d185a4 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -455,7 +455,6 @@ void __mnt_drop_write(struct vfsmount *mnt) mnt_dec_writers(real_mount(mnt)); preempt_enable(); } -EXPORT_SYMBOL_GPL(__mnt_drop_write); /** * mnt_drop_write - give up write access to a mount @@ -1587,33 +1586,6 @@ void drop_collected_mounts(struct vfsmount *mnt) namespace_unlock(); } -/** - * clone_private_mount - create a private clone of a path - * - * This creates a new vfsmount, which will be the clone of @path. The new will - * not be attached anywhere in the namespace and will be private (i.e. changes - * to the originating mount won't be propagated into this). - * - * Release with mntput(). - */ -struct vfsmount *clone_private_mount(struct path *path) -{ - struct mount *old_mnt = real_mount(path->mnt); - struct mount *new_mnt; - - if (IS_MNT_UNBINDABLE(old_mnt)) - return ERR_PTR(-EINVAL); - - down_read(&namespace_sem); - new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); - up_read(&namespace_sem); - if (IS_ERR(new_mnt)) - return ERR_CAST(new_mnt); - - return &new_mnt->mnt; -} -EXPORT_SYMBOL_GPL(clone_private_mount); - int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, struct vfsmount *root) { @@ -1628,7 +1600,6 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, } return 0; } -EXPORT_SYMBOL(iterate_mounts); static void cleanup_group_ids(struct mount *mnt, struct mount *end) { diff --git a/fs/notify/group.c b/fs/notify/group.c index adf290d67d..ad19959804 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "fsnotify.h" @@ -73,7 +72,6 @@ void fsnotify_get_group(struct fsnotify_group *group) { atomic_inc(&group->refcnt); } -EXPORT_SYMBOL(fsnotify_get_group); /* * Drop a reference to a group. Free it if it's through. @@ -83,7 +81,6 @@ void fsnotify_put_group(struct fsnotify_group *group) if (atomic_dec_and_test(&group->refcnt)) fsnotify_final_destroy_group(group); } -EXPORT_SYMBOL(fsnotify_put_group); /* * Create a new fsnotify_group and hold a reference for the group returned. @@ -112,7 +109,6 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops) return group; } -EXPORT_SYMBOL(fsnotify_alloc_group); int fsnotify_fasync(int fd, struct file *file, int on) { diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 176b4357b9..923fe4a5f5 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c @@ -109,7 +109,6 @@ void fsnotify_put_mark(struct fsnotify_mark *mark) mark->free_mark(mark); } } -EXPORT_SYMBOL(fsnotify_put_mark); /* * Any time a mark is getting freed we end up here. @@ -192,7 +191,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark, fsnotify_destroy_mark_locked(mark, group); mutex_unlock(&group->mark_mutex); } -EXPORT_SYMBOL(fsnotify_destroy_mark); void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask) { @@ -277,7 +275,6 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark, return ret; } -EXPORT_SYMBOL(fsnotify_add_mark); int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, struct inode *inode, struct vfsmount *mnt, int allow_dups) @@ -339,7 +336,6 @@ void fsnotify_init_mark(struct fsnotify_mark *mark, atomic_set(&mark->refcnt, 1); mark->free_mark = free_mark; } -EXPORT_SYMBOL(fsnotify_init_mark); static int fsnotify_mark_destroy(void *ignored) { diff --git a/fs/open.c b/fs/open.c index a46ee90410..17679f2b2f 100644 --- a/fs/open.c +++ b/fs/open.c @@ -62,7 +62,6 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, mutex_unlock(&dentry->d_inode->i_mutex); return ret; } -EXPORT_SYMBOL(do_truncate); long vfs_truncate(struct path *path, loff_t length) { @@ -280,7 +279,6 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) sb_end_write(inode->i_sb); return ret; } -EXPORT_SYMBOL(do_fallocate); SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) { @@ -824,7 +822,8 @@ struct file *dentry_open(const struct path *path, int flags, f = get_empty_filp(); if (!IS_ERR(f)) { f->f_flags = flags; - error = vfs_open(path, f, cred); + f->f_path = *path; + error = do_dentry_open(f, NULL, cred); if (!error) { /* from now on we need fput() to dispose of f */ error = open_check_o_direct(f); @@ -841,26 +840,6 @@ struct file *dentry_open(const struct path *path, int flags, } EXPORT_SYMBOL(dentry_open); -/** - * vfs_open - open the file at the given path - * @path: path to open - * @filp: newly allocated file with f_flag initialized - * @cred: credentials to use - */ -int vfs_open(const struct path *path, struct file *filp, - const struct cred *cred) -{ - struct inode *inode = path->dentry->d_inode; - - if (inode->i_op->dentry_open) - return inode->i_op->dentry_open(path->dentry, filp, cred); - else { - filp->f_path = *path; - return do_dentry_open(filp, NULL, cred); - } -} -EXPORT_SYMBOL(vfs_open); - static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op) { int lookup_flags = 0; diff --git a/fs/proc/base.c b/fs/proc/base.c index 115cba0181..489ba8caaf 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1828,7 +1828,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path) down_read(&mm->mmap_sem); vma = find_exact_vma(mm, vm_start, vm_end); if (vma && vma->vm_file) { - *path = vma_pr_or_file(vma)->f_path; + *path = vma->vm_file->f_path; path_get(path); rc = 0; } diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c index 1397181320..d4a35746ca 100644 --- a/fs/proc/nommu.c +++ b/fs/proc/nommu.c @@ -45,10 +45,7 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region) file = region->vm_file; if (file) { - struct inode *inode; - - file = vmr_pr_or_file(region); - inode = file_inode(file); + struct inode *inode = file_inode(region->vm_file); dev = inode->i_sb->s_dev; ino = inode->i_ino; } diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index f422b1ab31..eaa7374305 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -265,10 +265,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) const char *name = NULL; if (file) { - struct inode *inode; - - file = vma_pr_or_file(vma); - inode = file_inode(file); + struct inode *inode = file_inode(vma->vm_file); dev = inode->i_sb->s_dev; ino = inode->i_ino; pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; @@ -1437,7 +1434,6 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) seq_printf(m, "%08lx %s", vma->vm_start, buffer); if (file) { - file = vma_pr_or_file(vma); seq_printf(m, " file="); seq_path(m, &file->f_path, "\n\t= "); } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 0ef7ef4d82..678455d2d6 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c @@ -141,10 +141,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, file = vma->vm_file; if (file) { - struct inode *inode; - - file = vma_pr_or_file(file); - inode = file_inode(file); + struct inode *inode = file_inode(vma->vm_file); dev = inode->i_sb->s_dev; ino = inode->i_ino; pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; diff --git a/fs/splice.c b/fs/splice.c index 0c6c0b777b..f345d53f94 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1115,8 +1115,8 @@ EXPORT_SYMBOL(generic_splice_sendpage); /* * Attempt to initiate a splice from pipe to file. */ -long do_splice_from(struct pipe_inode_info *pipe, struct file *out, - loff_t *ppos, size_t len, unsigned int flags) +static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, + loff_t *ppos, size_t len, unsigned int flags) { ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); @@ -1128,14 +1128,13 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out, return splice_write(pipe, out, ppos, len, flags); } -EXPORT_SYMBOL(do_splice_from); /* * Attempt to initiate a splice from a file to a pipe. */ -long do_splice_to(struct file *in, loff_t *ppos, - struct pipe_inode_info *pipe, size_t len, - unsigned int flags) +static long do_splice_to(struct file *in, loff_t *ppos, + struct pipe_inode_info *pipe, size_t len, + unsigned int flags) { ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); @@ -1155,7 +1154,6 @@ long do_splice_to(struct file *in, loff_t *ppos, return splice_read(in, ppos, pipe, len, flags); } -EXPORT_SYMBOL(do_splice_to); /** * splice_direct_to_actor - splices data directly between two non-pipes @@ -1333,7 +1331,6 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, return ret; } -EXPORT_SYMBOL(do_splice_direct); static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, struct pipe_inode_info *opipe, diff --git a/include/linux/fs.h b/include/linux/fs.h index 08f8e4eb39..23b2a35d71 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -249,12 +249,6 @@ struct iattr { */ #include -/* - * Maximum number of layers of fs stack. Needs to be limited to - * prevent kernel stack overflow - */ -#define FILESYSTEM_MAX_STACK_DEPTH 2 - /** * enum positive_aop_returns - aop return codes with specific semantics * @@ -1335,11 +1329,6 @@ struct super_block { struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; struct list_lru s_inode_lru ____cacheline_aligned_in_smp; struct rcu_head rcu; - - /* - * Indicates how deep in a filesystem stack this SB is - */ - int s_stack_depth; }; extern struct timespec current_fs_time(struct super_block *sb); @@ -1596,7 +1585,6 @@ struct inode_operations { umode_t create_mode, int *opened); int (*tmpfile) (struct inode *, struct dentry *, umode_t); int (*set_acl)(struct inode *, struct posix_acl *, int); - int (*dentry_open)(struct dentry *, struct file *, const struct cred *); } ____cacheline_aligned; ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, @@ -1638,10 +1626,6 @@ struct super_operations { int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); long (*nr_cached_objects)(struct super_block *, int); long (*free_cached_objects)(struct super_block *, long, int); -#if defined(CONFIG_BLK_DEV_LOOP) || defined(CONFIG_BLK_DEV_LOOP_MODULE) - /* and aufs */ - struct file *(*real_loop)(struct file *); -#endif }; /* @@ -2095,7 +2079,6 @@ extern struct file *file_open_name(struct filename *, int, umode_t); extern struct file *filp_open(const char *, int, umode_t); extern struct file *file_open_root(struct dentry *, struct vfsmount *, const char *, int); -extern int vfs_open(const struct path *, struct file *, const struct cred *); extern struct file * dentry_open(const struct path *, int, const struct cred *); extern int filp_close(struct file *, fl_owner_t id); @@ -2309,7 +2292,6 @@ extern sector_t bmap(struct inode *, sector_t); #endif extern int notify_change(struct dentry *, struct iattr *, struct inode **); extern int inode_permission(struct inode *, int); -extern int __inode_permission(struct inode *, int); extern int generic_permission(struct inode *, int); static inline bool execute_ok(struct inode *inode) @@ -2518,9 +2500,6 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, struct file *out, loff_t *, size_t len, unsigned int flags); -extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, - loff_t *opos, size_t len, unsigned int flags); - extern void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); @@ -2690,7 +2669,6 @@ extern int inode_change_ok(const struct inode *, struct iattr *); extern int inode_newsize_ok(const struct inode *, loff_t offset); extern void setattr_copy(struct inode *inode, const struct iattr *attr); -extern int update_time(struct inode *, struct timespec *, int); extern int file_update_time(struct file *file); extern int generic_show_options(struct seq_file *m, struct dentry *root); diff --git a/include/linux/mm.h b/include/linux/mm.h index 8fda4b2d38..a7b311dfa7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1163,28 +1163,6 @@ static inline int fixup_user_fault(struct task_struct *tsk, } #endif -#ifdef CONFIG_MMU -extern void vma_do_file_update_time(struct vm_area_struct *, const char[], int); -extern struct file *vma_do_pr_or_file(struct vm_area_struct *, const char[], - int); -extern void vma_do_get_file(struct vm_area_struct *, const char[], int); -extern void vma_do_fput(struct vm_area_struct *, const char[], int); - -#define vma_file_update_time(vma) vma_do_file_update_time(vma, __func__, \ - __LINE__) -#define vma_pr_or_file(vma) vma_do_pr_or_file(vma, __func__, \ - __LINE__) -#define vma_get_file(vma) vma_do_get_file(vma, __func__, __LINE__) -#define vma_fput(vma) vma_do_fput(vma, __func__, __LINE__) -#else -extern struct file *vmr_do_pr_or_file(struct vm_region *, const char[], int); -extern void vmr_do_fput(struct vm_region *, const char[], int); - -#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \ - __LINE__) -#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__) -#endif /* CONFIG_MMU */ - extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf, int len, int write); diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index ca020f325e..2b58d192ea 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -231,7 +231,6 @@ struct vm_region { unsigned long vm_top; /* region allocated to here */ unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ struct file *vm_file; /* the backing file or NULL */ - struct file *vm_prfile; /* the virtual backing file or NULL */ int vm_usage; /* region usage count (access under nommu_region_sem) */ bool vm_icache_flushed : 1; /* true if the icache has been flushed for @@ -300,7 +299,6 @@ struct vm_area_struct { unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE units, *not* PAGE_CACHE_SIZE */ struct file * vm_file; /* File we map to (can be NULL). */ - struct file *vm_prfile; /* shadow of vm_file */ void * vm_private_data; /* was vm_pte (shared mem) */ #ifndef CONFIG_MMU diff --git a/include/linux/mount.h b/include/linux/mount.h index fff78cb99f..b0c1e6574e 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -81,9 +81,6 @@ extern void mnt_pin(struct vfsmount *mnt); extern void mnt_unpin(struct vfsmount *mnt); extern int __mnt_is_readonly(struct vfsmount *mnt); -struct path; -extern struct vfsmount *clone_private_mount(struct path *path); - struct file_system_type; extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, int flags, const char *name, diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 4d389c5dd0..4d1771c2d2 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -24,13 +24,10 @@ struct shmem_inode_info { }; struct shmem_sb_info { - struct mutex idr_lock; - bool idr_nouse; - struct idr idr; /* manages inode-number */ unsigned long max_blocks; /* How many blocks are allowed */ struct percpu_counter used_blocks; /* How many are allocated */ - int max_inodes; /* How many inodes are allowed */ - int free_inodes; /* How many are left for allocation */ + unsigned long max_inodes; /* How many inodes are allowed */ + unsigned long free_inodes; /* How many are left for allocation */ spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ kuid_t uid; /* Mount uid for root directory */ kgid_t gid; /* Mount gid for root directory */ diff --git a/include/linux/splice.h b/include/linux/splice.h index 304169ea44..0e43906d2f 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h @@ -93,10 +93,4 @@ extern void splice_shrink_spd(struct splice_pipe_desc *); extern void spd_release_page(struct splice_pipe_desc *, unsigned int); extern const struct pipe_buf_operations page_cache_pipe_buf_ops; - -extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out, - loff_t *ppos, size_t len, unsigned int flags); -extern long do_splice_to(struct file *in, loff_t *ppos, - struct pipe_inode_info *pipe, size_t len, - unsigned int flags); #endif diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 9faebdc746..3ce25b5d75 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -56,7 +56,6 @@ header-y += atmppp.h header-y += atmsap.h header-y += atmsvc.h header-y += audit.h -header-y += aufs_type.h header-y += auto_fs.h header-y += auto_fs4.h header-y += auxvec.h diff --git a/kernel/fork.c b/kernel/fork.c index 8fa0a967a2..e2c6853962 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -414,7 +414,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) struct inode *inode = file_inode(file); struct address_space *mapping = file->f_mapping; - vma_get_file(tmp); + get_file(file); if (tmp->vm_flags & VM_DENYWRITE) atomic_dec(&inode->i_writecount); mutex_lock(&mapping->i_mmap_mutex); diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index d3a0e6cb8e..02e7fb4edb 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -59,7 +59,7 @@ /* We show everything that is MORE important than this.. */ #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ -#define DEFAULT_CONSOLE_LOGLEVEL 4 /* anything MORE serious than KERN_WARNING */ +#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ int console_printk[4] = { DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ diff --git a/mm/Makefile b/mm/Makefile index c52f298692..c561f1f6bc 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -17,7 +17,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \ util.o mmzone.o vmstat.o backing-dev.o \ mm_init.o mmu_context.o percpu.o slab_common.o \ compaction.o balloon_compaction.o vmacache.o \ - interval_tree.o list_lru.o prfile.o $(mmu-y) + interval_tree.o list_lru.o $(mmu-y) obj-y += init-mm.o diff --git a/mm/filemap.c b/mm/filemap.c index 58502d11ed..217cfd3b32 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1939,7 +1939,7 @@ int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) int ret = VM_FAULT_LOCKED; sb_start_pagefault(inode->i_sb); - vma_file_update_time(vma); + file_update_time(vma->vm_file); lock_page(page); if (page->mapping != inode->i_mapping) { unlock_page(page); diff --git a/mm/fremap.c b/mm/fremap.c index 5397350859..34feba60a1 100644 --- a/mm/fremap.c +++ b/mm/fremap.c @@ -223,28 +223,16 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, */ if (mapping_cap_account_dirty(mapping)) { unsigned long addr; - struct file *file = vma->vm_file, - *prfile = vma->vm_prfile; - + struct file *file = get_file(vma->vm_file); /* mmap_region may free vma; grab the info now */ vm_flags = vma->vm_flags; - vma_get_file(vma); addr = mmap_region(file, start, size, vm_flags, pgoff); - vma_fput(vma); + fput(file); if (IS_ERR_VALUE(addr)) { err = addr; } else { BUG_ON(addr != start); - if (prfile) { - struct vm_area_struct *new_vma; - - new_vma = find_vma(mm, addr); - if (!new_vma->vm_prfile) - new_vma->vm_prfile = prfile; - if (new_vma != vma) - get_file(prfile); - } err = 0; } goto out_freed; diff --git a/mm/madvise.c b/mm/madvise.c index 134e15d338..a402f8fdc6 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -327,12 +327,12 @@ static long madvise_remove(struct vm_area_struct *vma, * vma's reference to the file) can go away as soon as we drop * mmap_sem. */ - vma_get_file(vma); + get_file(f); up_read(¤t->mm->mmap_sem); error = do_fallocate(f, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, offset, end - start); - vma_fput(vma); + fput(f); down_read(¤t->mm->mmap_sem); return error; } diff --git a/mm/memory.c b/mm/memory.c index 96bddcbc91..e9ddc7acee 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2761,7 +2761,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, set_page_dirty_balance(dirty_page, page_mkwrite); /* file_update_time outside page_lock */ if (vma->vm_file) - vma_file_update_time(vma); + file_update_time(vma->vm_file); } put_page(dirty_page); if (page_mkwrite) { @@ -3477,7 +3477,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* file_update_time outside page_lock */ if (vma->vm_file && !page_mkwrite) - vma_file_update_time(vma); + file_update_time(vma->vm_file); } else { unlock_page(vmf.page); if (anon) diff --git a/mm/mmap.c b/mm/mmap.c index 837741ec09..d4c97ba684 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -250,7 +250,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) if (vma->vm_ops && vma->vm_ops->close) vma->vm_ops->close(vma); if (vma->vm_file) - vma_fput(vma); + fput(vma->vm_file); mpol_put(vma_policy(vma)); kmem_cache_free(vm_area_cachep, vma); return next; @@ -864,7 +864,7 @@ again: remove_next = 1 + (end > next->vm_end); if (remove_next) { if (file) { uprobe_munmap(next, next->vm_start, next->vm_end); - vma_fput(vma); + fput(file); } if (next->anon_vma) anon_vma_merge(vma, next); @@ -1644,8 +1644,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr, unmap_and_free_vma: if (vm_flags & VM_DENYWRITE) allow_write_access(file); - vma_fput(vma); vma->vm_file = NULL; + fput(file); /* Undo any partial mapping done by a device driver. */ unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); @@ -2439,7 +2439,7 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, goto out_free_mpol; if (new->vm_file) - vma_get_file(new); + get_file(new->vm_file); if (new->vm_ops && new->vm_ops->open) new->vm_ops->open(new); @@ -2458,7 +2458,7 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, if (new->vm_ops && new->vm_ops->close) new->vm_ops->close(new); if (new->vm_file) - vma_fput(new); + fput(new->vm_file); unlink_anon_vmas(new); out_free_mpol: mpol_put(vma_policy(new)); @@ -2847,7 +2847,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, if (anon_vma_clone(new_vma, vma)) goto out_free_mempol; if (new_vma->vm_file) - vma_get_file(new_vma); + get_file(new_vma->vm_file); if (new_vma->vm_ops && new_vma->vm_ops->open) new_vma->vm_ops->open(new_vma); vma_link(mm, new_vma, prev, rb_link, rb_parent); diff --git a/mm/msync.c b/mm/msync.c index 02d770eb9f..632df4527c 100644 --- a/mm/msync.c +++ b/mm/msync.c @@ -80,10 +80,10 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) start = vma->vm_end; if ((flags & MS_SYNC) && file && (vma->vm_flags & VM_SHARED)) { - vma_get_file(vma); + get_file(file); up_read(&mm->mmap_sem); error = vfs_fsync(file, 0); - vma_fput(vma); + fput(file); if (error || start >= end) goto out; down_read(&mm->mmap_sem); diff --git a/mm/nommu.c b/mm/nommu.c index 244dd6ad52..76b3f90ada 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -654,7 +654,7 @@ static void __put_nommu_region(struct vm_region *region) up_write(&nommu_region_sem); if (region->vm_file) - vmr_fput(region); + fput(region->vm_file); /* IO memory and memory shared directly out of the pagecache * from ramfs/tmpfs mustn't be released here */ @@ -819,7 +819,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma) if (vma->vm_ops && vma->vm_ops->close) vma->vm_ops->close(vma); if (vma->vm_file) - vma_fput(vma); + fput(vma->vm_file); put_nommu_region(vma->vm_region); kmem_cache_free(vm_area_cachep, vma); } @@ -1385,7 +1385,7 @@ unsigned long do_mmap_pgoff(struct file *file, goto error_just_free; } } - vmr_fput(region); + fput(region->vm_file); kmem_cache_free(vm_region_jar, region); region = pregion; result = start; @@ -1461,10 +1461,10 @@ unsigned long do_mmap_pgoff(struct file *file, up_write(&nommu_region_sem); error: if (region->vm_file) - vmr_fput(region); + fput(region->vm_file); kmem_cache_free(vm_region_jar, region); if (vma->vm_file) - vma_fput(vma); + fput(vma->vm_file); kmem_cache_free(vm_area_cachep, vma); kleave(" = %d", ret); return ret; diff --git a/mm/shmem.c b/mm/shmem.c index a47afc8c26..85d8a1a362 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -107,13 +107,9 @@ static unsigned long shmem_default_max_blocks(void) return totalram_pages / 2; } -static int shmem_default_max_inodes(void) +static unsigned long shmem_default_max_inodes(void) { - unsigned long ul; - - ul = INT_MAX; - ul = min3(ul, totalram_pages - totalhigh_pages, totalram_pages / 2); - return ul; + return min(totalram_pages - totalhigh_pages, totalram_pages / 2); } #endif @@ -574,7 +570,6 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr) static void shmem_evict_inode(struct inode *inode) { struct shmem_inode_info *info = SHMEM_I(inode); - struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); if (inode->i_mapping->a_ops == &shmem_aops) { shmem_unacct_size(info->flags, inode->i_size); @@ -590,11 +585,6 @@ static void shmem_evict_inode(struct inode *inode) simple_xattrs_free(&info->xattrs); WARN_ON(inode->i_blocks); - if (!sbinfo->idr_nouse && inode->i_ino) { - mutex_lock(&sbinfo->idr_lock); - idr_remove(&sbinfo->idr, inode->i_ino); - mutex_unlock(&sbinfo->idr_lock); - } shmem_free_inode(inode->i_sb); clear_inode(inode); } @@ -1385,13 +1375,13 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode struct inode *inode; struct shmem_inode_info *info; struct shmem_sb_info *sbinfo = SHMEM_SB(sb); - int ino; if (shmem_reserve_inode(sb)) return NULL; inode = new_inode(sb); if (inode) { + inode->i_ino = get_next_ino(); inode_init_owner(inode, dir, mode); inode->i_blocks = 0; inode->i_mapping->backing_dev_info = &shmem_backing_dev_info; @@ -1432,25 +1422,6 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode mpol_shared_policy_init(&info->policy, NULL); break; } - - if (!sbinfo->idr_nouse) { - /* inum 0 and 1 are unused */ - mutex_lock(&sbinfo->idr_lock); - ino = idr_alloc(&sbinfo->idr, inode, 2, INT_MAX, - GFP_NOFS); - if (ino > 0) { - inode->i_ino = ino; - mutex_unlock(&sbinfo->idr_lock); - __insert_inode_hash(inode, inode->i_ino); - } else { - inode->i_ino = 0; - mutex_unlock(&sbinfo->idr_lock); - iput(inode); - /* shmem_free_inode() will be called */ - inode = NULL; - } - } else - inode->i_ino = get_next_ino(); } else shmem_free_inode(sb); return inode; @@ -2394,7 +2365,8 @@ static struct dentry *shmem_get_parent(struct dentry *child) static int shmem_match(struct inode *ino, void *vfh) { __u32 *fh = vfh; - __u64 inum = fh[1]; + __u64 inum = fh[2]; + inum = (inum << 32) | fh[1]; return ino->i_ino == inum && fh[0] == ino->i_generation; } @@ -2405,11 +2377,14 @@ static struct dentry *shmem_fh_to_dentry(struct super_block *sb, struct dentry *dentry = NULL; u64 inum; - if (fh_len < 2) + if (fh_len < 3) return NULL; - inum = fid->raw[1]; - inode = ilookup5(sb, inum, shmem_match, fid->raw); + inum = fid->raw[2]; + inum = (inum << 32) | fid->raw[1]; + + inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]), + shmem_match, fid->raw); if (inode) { dentry = d_find_alias(inode); iput(inode); @@ -2421,15 +2396,30 @@ static struct dentry *shmem_fh_to_dentry(struct super_block *sb, static int shmem_encode_fh(struct inode *inode, __u32 *fh, int *len, struct inode *parent) { - if (*len < 2) { - *len = 2; + if (*len < 3) { + *len = 3; return FILEID_INVALID; } + if (inode_unhashed(inode)) { + /* Unfortunately insert_inode_hash is not idempotent, + * so as we hash inodes here rather than at creation + * time, we need a lock to ensure we only try + * to do it once + */ + static DEFINE_SPINLOCK(lock); + spin_lock(&lock); + if (inode_unhashed(inode)) + __insert_inode_hash(inode, + inode->i_ino + inode->i_generation); + spin_unlock(&lock); + } + fh[0] = inode->i_generation; fh[1] = inode->i_ino; + fh[2] = ((__u64)inode->i_ino) >> 32; - *len = 2; + *len = 3; return 1; } @@ -2494,7 +2484,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, goto bad_val; } else if (!strcmp(this_char,"nr_inodes")) { sbinfo->max_inodes = memparse(value, &rest); - if (*rest || sbinfo->max_inodes < 2) + if (*rest) goto bad_val; } else if (!strcmp(this_char,"mode")) { if (remount) @@ -2547,7 +2537,7 @@ static int shmem_remount_fs(struct super_block *sb, int *flags, char *data) { struct shmem_sb_info *sbinfo = SHMEM_SB(sb); struct shmem_sb_info config = *sbinfo; - int inodes; + unsigned long inodes; int error = -EINVAL; config.mpol = NULL; @@ -2595,7 +2585,7 @@ static int shmem_show_options(struct seq_file *seq, struct dentry *root) seq_printf(seq, ",size=%luk", sbinfo->max_blocks << (PAGE_CACHE_SHIFT - 10)); if (sbinfo->max_inodes != shmem_default_max_inodes()) - seq_printf(seq, ",nr_inodes=%d", sbinfo->max_inodes); + seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) seq_printf(seq, ",mode=%03ho", sbinfo->mode); if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID)) @@ -2613,8 +2603,6 @@ static void shmem_put_super(struct super_block *sb) { struct shmem_sb_info *sbinfo = SHMEM_SB(sb); - if (!sbinfo->idr_nouse) - idr_destroy(&sbinfo->idr); percpu_counter_destroy(&sbinfo->used_blocks); mpol_put(sbinfo->mpol); kfree(sbinfo); @@ -2633,8 +2621,6 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent) if (!sbinfo) return -ENOMEM; - mutex_init(&sbinfo->idr_lock); - idr_init(&sbinfo->idr); sbinfo->mode = S_IRWXUGO | S_ISVTX; sbinfo->uid = current_fsuid(); sbinfo->gid = current_fsgid(); @@ -2738,15 +2724,6 @@ static void shmem_destroy_inodecache(void) kmem_cache_destroy(shmem_inode_cachep); } -static __init void shmem_no_idr(struct super_block *sb) -{ - struct shmem_sb_info *sbinfo; - - sbinfo = SHMEM_SB(sb); - sbinfo->idr_nouse = true; - idr_destroy(&sbinfo->idr); -} - static const struct address_space_operations shmem_aops = { .writepage = shmem_writepage, .set_page_dirty = __set_page_dirty_no_writeback, @@ -2886,7 +2863,6 @@ int __init shmem_init(void) printk(KERN_ERR "Could not kern_mount tmpfs\n"); goto out1; } - shmem_no_idr(shm_mnt->mnt_sb); return 0; out1: diff --git a/security/commoncap.c b/security/commoncap.c index 65a8e533f6..963dc59816 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -991,11 +991,9 @@ int cap_mmap_addr(unsigned long addr) } return ret; } -EXPORT_SYMBOL(cap_mmap_addr); int cap_mmap_file(struct file *file, unsigned long reqprot, unsigned long prot, unsigned long flags) { return 0; } -EXPORT_SYMBOL(cap_mmap_file); diff --git a/security/device_cgroup.c b/security/device_cgroup.c index ffd4259d47..6e4e6eb732 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -862,7 +861,6 @@ int __devcgroup_inode_permission(struct inode *inode, int mask) return __devcgroup_check_permission(type, imajor(inode), iminor(inode), access); } -EXPORT_SYMBOL(__devcgroup_inode_permission); int devcgroup_inode_mknod(int mode, dev_t dev) { diff --git a/security/security.c b/security/security.c index f9e9e175ff..919cad93ac 100644 --- a/security/security.c +++ b/security/security.c @@ -407,7 +407,6 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry) return 0; return security_ops->path_rmdir(dir, dentry); } -EXPORT_SYMBOL(security_path_rmdir); int security_path_unlink(struct path *dir, struct dentry *dentry) { @@ -424,7 +423,6 @@ int security_path_symlink(struct path *dir, struct dentry *dentry, return 0; return security_ops->path_symlink(dir, dentry, old_name); } -EXPORT_SYMBOL(security_path_symlink); int security_path_link(struct dentry *old_dentry, struct path *new_dir, struct dentry *new_dentry) @@ -433,7 +431,6 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir, return 0; return security_ops->path_link(old_dentry, new_dir, new_dentry); } -EXPORT_SYMBOL(security_path_link); int security_path_rename(struct path *old_dir, struct dentry *old_dentry, struct path *new_dir, struct dentry *new_dentry) @@ -452,7 +449,6 @@ int security_path_truncate(struct path *path) return 0; return security_ops->path_truncate(path); } -EXPORT_SYMBOL(security_path_truncate); int security_path_chmod(struct path *path, umode_t mode) { @@ -460,7 +456,6 @@ int security_path_chmod(struct path *path, umode_t mode) return 0; return security_ops->path_chmod(path, mode); } -EXPORT_SYMBOL(security_path_chmod); int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) { @@ -468,7 +463,6 @@ int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) return 0; return security_ops->path_chown(path, uid, gid); } -EXPORT_SYMBOL(security_path_chown); int security_path_chroot(struct path *path) { @@ -545,7 +539,6 @@ int security_inode_readlink(struct dentry *dentry) return 0; return security_ops->inode_readlink(dentry); } -EXPORT_SYMBOL(security_inode_readlink); int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) { @@ -560,7 +553,6 @@ int security_inode_permission(struct inode *inode, int mask) return 0; return security_ops->inode_permission(inode, mask); } -EXPORT_SYMBOL(security_inode_permission); int security_inode_setattr(struct dentry *dentry, struct iattr *attr) { @@ -683,7 +675,6 @@ int security_file_permission(struct file *file, int mask) return fsnotify_perm(file, mask); } -EXPORT_SYMBOL(security_file_permission); int security_file_alloc(struct file *file) { @@ -744,7 +735,6 @@ int security_mmap_file(struct file *file, unsigned long prot, return ret; return ima_file_mmap(file, prot); } -EXPORT_SYMBOL(security_mmap_file); int security_mmap_addr(unsigned long addr) {