--- a/mm/shmem.c +++ b/mm/shmem.c @@ -2965,6 +2965,15 @@ static struct dentry_operations anon_ops .d_dname = simple_dname }; +void shmem_set_file(struct vm_area_struct *vma, struct file *file) +{ + if (vma->vm_file) + fput(vma->vm_file); + vma->vm_file = file; + vma->vm_ops = &shmem_vm_ops; +} +EXPORT_SYMBOL_GPL(shmem_set_file); + /** * shmem_file_setup - get an unlinked file living in tmpfs * @name: name for dentry (to be seen in /proc/<pid>/maps @@ -3038,11 +3047,8 @@ int shmem_zero_setup(struct vm_area_stru file = shmem_file_setup("dev/zero", size, vma->vm_flags); if (IS_ERR(file)) return PTR_ERR(file); + shmem_set_file(vma, file); - if (vma->vm_file) - fput(vma->vm_file); - vma->vm_file = file; - vma->vm_ops = &shmem_vm_ops; return 0; } --- a/fs/file.c +++ b/fs/file.c @@ -218,6 +218,7 @@ static inline void __set_open_fd(int fd, { __set_bit(fd, fdt->open_fds); } +EXPORT_SYMBOL_GPL(expand_files); static inline void __clear_open_fd(int fd, struct fdtable *fdt) { --- a/kernel/exit.c +++ b/kernel/exit.c @@ -502,6 +502,8 @@ static void exit_mm(struct task_struct * mm_update_next_owner(mm); mmput(mm); } +EXPORT_SYMBOL_GPL(get_files_struct); +EXPORT_SYMBOL_GPL(put_files_struct); /* * When we die, we re-parent all our children, and try to: --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3719,6 +3719,7 @@ int can_nice(const struct task_struct *p return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) || capable(CAP_SYS_NICE)); } +EXPORT_SYMBOL_GPL(can_nice); #ifdef __ARCH_WANT_SYS_NICE --- a/mm/memory.c +++ b/mm/memory.c @@ -1413,6 +1413,7 @@ void zap_page_range(struct vm_area_struc mmu_notifier_invalidate_range_end(mm, start, end); tlb_finish_mmu(&tlb, start, end); } +EXPORT_SYMBOL_GPL(zap_page_range); /** * zap_page_range_single - remove user pages in a given range --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1281,6 +1281,7 @@ void unmap_kernel_range(unsigned long ad vunmap_page_range(addr, end); flush_tlb_kernel_range(addr, end); } +EXPORT_SYMBOL_GPL(unmap_kernel_range); int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) { @@ -1412,6 +1413,7 @@ struct vm_struct *get_vm_area(unsigned l NUMA_NO_NODE, GFP_KERNEL, __builtin_return_address(0)); } +EXPORT_SYMBOL_GPL(get_vm_area); struct vm_struct *get_vm_area_caller(unsigned long size, unsigned long flags, const void *caller) --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -47,6 +47,8 @@ extern int shmem_init(void); extern int shmem_fill_super(struct super_block *sb, void *data, int silent); extern struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); + +extern void shmem_set_file(struct vm_area_struct *vma, struct file *file); extern int shmem_zero_setup(struct vm_area_struct *); extern int shmem_lock(struct file *file, int lock, struct user_struct *user); extern void shmem_unlock_mapping(struct address_space *mapping);