aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <benh@debian.org>2015-06-16 22:42:42 +0000
committerBen Hutchings <benh@debian.org>2015-06-16 22:42:42 +0000
commitecabdfe56de875c56aa5c49dc579ff8477271091 (patch)
tree6a58756d6789fed2282f1f664adc69d25c669c62
parentde305c0c146c1f2a5f7a132fb81e31ec6175ea69 (diff)
downloadkernel_replicant_linux-ecabdfe56de875c56aa5c49dc579ff8477271091.tar.gz
kernel_replicant_linux-ecabdfe56de875c56aa5c49dc579ff8477271091.tar.bz2
kernel_replicant_linux-ecabdfe56de875c56aa5c49dc579ff8477271091.zip
aufs: Apply patches to enable building aufs out-of-tree
svn path=/dists/trunk/linux/; revision=22759
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/features/all/aufs4/aufs4-base.patch181
-rw-r--r--debian/patches/features/all/aufs4/aufs4-mmap.patch450
-rw-r--r--debian/patches/features/all/aufs4/aufs4-standalone.patch338
-rw-r--r--debian/patches/series7
5 files changed, 977 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 819133b9593a..348c1323b454 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ linux (4.1~rc5-1~exp1) UNRELEASED; urgency=medium
- linux-source: Fix timestamps in the tarball
- linux-doc: Drop original timestamp (and name) when compressing
* mac80211: Fix fatal kernel-doc errors
+ * aufs: Apply patches to enable building aufs out-of-tree
[ maximilian attems ]
* [x86] Enable SND_SOC_INTEL_BROADWELL_MACH. (closes: #785422)
diff --git a/debian/patches/features/all/aufs4/aufs4-base.patch b/debian/patches/features/all/aufs4/aufs4-base.patch
new file mode 100644
index 000000000000..37e7ba5ffc21
--- /dev/null
+++ b/debian/patches/features/all/aufs4/aufs4-base.patch
@@ -0,0 +1,181 @@
+From: J. R. Okajima <hooanon05@yahoo.co.jp>
+Date: Sat Jun 6 21:25:05 2015 +0900
+Subject: aufs4.x-rcN base patch
+Origin: https://github.com/sfjro/aufs4-standalone/tree/aa65d099b5220918a0509c91ece96b79f7cb4b2d
+Bug-Debian: https://bugs.debian.org/541828
+
+Patch headers added by debian/patches/features/all/aufs4/gen-patch
+
+aufs4.x-rcN base patch
+
+diff --git a/MAINTAINERS b/MAINTAINERS
+index af802b3..b29cdd2 100644
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -1880,6 +1880,19 @@ 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" <hooanon05g@gmail.com>
++L: linux-unionfs@vger.kernel.org
++L: aufs-users@lists.sourceforge.net (members only)
++W: http://aufs.sourceforge.net
++T: git://github.com/sfjro/aufs4-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 <miguel.ojeda.sandonis@gmail.com>
+ W: http://miguelojeda.es/auxdisplay.htm
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+index d7173cb..0160952 100644
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -540,6 +540,24 @@ 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_GPL(loop_backing_file);
++
+ /* loop sysfs attributes */
+
+ static ssize_t loop_attr_show(struct device *dev, char *page,
+diff --git a/fs/dcache.c b/fs/dcache.c
+index 37b5afd..bc261e2 100644
+--- a/fs/dcache.c
++++ b/fs/dcache.c
+@@ -1164,7 +1164,7 @@ enum d_walk_ret {
+ *
+ * The @enter() and @finish() callbacks are called with d_lock held.
+ */
+-static void d_walk(struct dentry *parent, void *data,
++void d_walk(struct dentry *parent, void *data,
+ enum d_walk_ret (*enter)(void *, struct dentry *),
+ void (*finish)(void *))
+ {
+diff --git a/fs/read_write.c b/fs/read_write.c
+index 819ef3f..fd0414e 100644
+--- a/fs/read_write.c
++++ b/fs/read_write.c
+@@ -494,6 +494,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
+ }
+ EXPORT_SYMBOL(__vfs_write);
+
++vfs_readf_t vfs_readf(struct file *file)
++{
++ const struct file_operations *fop = file->f_op;
++
++ if (fop->read)
++ return fop->read;
++ if (fop->read_iter)
++ return new_sync_read;
++ return ERR_PTR(-ENOSYS);
++}
++
++vfs_writef_t vfs_writef(struct file *file)
++{
++ const struct file_operations *fop = file->f_op;
++
++ if (fop->write)
++ return fop->write;
++ if (fop->write_iter)
++ return new_sync_write;
++ return ERR_PTR(-ENOSYS);
++}
++
+ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
+ {
+ mm_segment_t old_fs;
+diff --git a/fs/splice.c b/fs/splice.c
+index bfe62ae..fa5eee5 100644
+--- a/fs/splice.c
++++ b/fs/splice.c
+@@ -1101,8 +1101,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+ /*
+ * Attempt to initiate a splice from pipe to file.
+ */
+-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+- loff_t *ppos, size_t len, unsigned int flags)
++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);
+@@ -1118,9 +1118,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+ /*
+ * Attempt to initiate a splice from a file to a pipe.
+ */
+-static long do_splice_to(struct file *in, loff_t *ppos,
+- struct pipe_inode_info *pipe, size_t len,
+- unsigned int flags)
++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);
+diff --git a/include/linux/file.h b/include/linux/file.h
+index f87d308..9a290b3 100644
+--- a/include/linux/file.h
++++ b/include/linux/file.h
+@@ -19,6 +19,7 @@ struct dentry;
+ struct path;
+ extern struct file *alloc_file(struct path *, fmode_t mode,
+ const struct file_operations *fop);
++extern struct file *get_empty_filp(void);
+
+ static inline void fput_light(struct file *file, int fput_needed)
+ {
+diff --git a/include/linux/fs.h b/include/linux/fs.h
+index 35ec87e..3229f97 100644
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -1649,6 +1649,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
+ struct iovec *fast_pointer,
+ struct iovec **ret_pointer);
+
++typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
++typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
++ loff_t *);
++vfs_readf_t vfs_readf(struct file *file);
++vfs_writef_t vfs_writef(struct file *file);
++
+ extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
+ extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *);
+ extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
+diff --git a/include/linux/splice.h b/include/linux/splice.h
+index da2751d..2e0fca6 100644
+--- a/include/linux/splice.h
++++ b/include/linux/splice.h
+@@ -83,4 +83,10 @@ 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/debian/patches/features/all/aufs4/aufs4-mmap.patch b/debian/patches/features/all/aufs4/aufs4-mmap.patch
new file mode 100644
index 000000000000..2901e0d5f146
--- /dev/null
+++ b/debian/patches/features/all/aufs4/aufs4-mmap.patch
@@ -0,0 +1,450 @@
+From: J. R. Okajima <hooanon05@yahoo.co.jp>
+Date: Sat May 2 13:25:44 2015 +0900
+Subject: aufs4.x-rcN mmap patch
+Origin: https://github.com/sfjro/aufs4-standalone/tree/aa65d099b5220918a0509c91ece96b79f7cb4b2d
+Bug-Debian: https://bugs.debian.org/541828
+
+Patch headers added by debian/patches/features/all/aufs4/gen-patch
+
+aufs4.x-rcN mmap patch
+
+diff --git a/fs/buffer.c b/fs/buffer.c
+index c7a5602..8c50a22 100644
+--- a/fs/buffer.c
++++ b/fs/buffer.c
+@@ -2450,7 +2450,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...
+ */
+- file_update_time(vma->vm_file);
++ vma_file_update_time(vma);
+
+ ret = __block_page_mkwrite(vma, vmf, get_block);
+ sb_end_pagefault(sb);
+diff --git a/fs/proc/base.c b/fs/proc/base.c
+index 093ca14..fc1ac03 100644
+--- a/fs/proc/base.c
++++ b/fs/proc/base.c
+@@ -1744,7 +1744,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->vm_file->f_path;
++ *path = vma_pr_or_file(vma)->f_path;
+ path_get(path);
+ rc = 0;
+ }
+diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
+index d4a3574..1397181 100644
+--- a/fs/proc/nommu.c
++++ b/fs/proc/nommu.c
+@@ -45,7 +45,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
+ file = region->vm_file;
+
+ if (file) {
+- struct inode *inode = file_inode(region->vm_file);
++ struct inode *inode;
++
++ file = vmr_pr_or_file(region);
++ inode = file_inode(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 6dee68d..9afa35d 100644
+--- a/fs/proc/task_mmu.c
++++ b/fs/proc/task_mmu.c
+@@ -279,7 +279,10 @@ 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_inode(vma->vm_file);
++ struct inode *inode;
++
++ file = vma_pr_or_file(vma);
++ inode = file_inode(file);
+ dev = inode->i_sb->s_dev;
+ ino = inode->i_ino;
+ pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
+@@ -1479,7 +1482,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
+ struct proc_maps_private *proc_priv = &numa_priv->proc_maps;
+ struct vm_area_struct *vma = v;
+ struct numa_maps *md = &numa_priv->md;
+- struct file *file = vma->vm_file;
++ struct file *file = vma_pr_or_file(vma);
+ struct mm_struct *mm = vma->vm_mm;
+ struct mm_walk walk = {
+ .hugetlb_entry = gather_hugetlb_stats,
+diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
+index 599ec2e..de6cd6e 100644
+--- a/fs/proc/task_nommu.c
++++ b/fs/proc/task_nommu.c
+@@ -160,7 +160,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
+ file = vma->vm_file;
+
+ if (file) {
+- struct inode *inode = file_inode(vma->vm_file);
++ struct inode *inode;
++
++ file = vma_pr_or_file(file);
++ inode = file_inode(file);
+ dev = inode->i_sb->s_dev;
+ ino = inode->i_ino;
+ pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
+diff --git a/include/linux/mm.h b/include/linux/mm.h
+index 0755b9f..073d61e 100644
+--- a/include/linux/mm.h
++++ b/include/linux/mm.h
+@@ -1172,6 +1172,28 @@ 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 8d37e26..ce89d4c 100644
+--- a/include/linux/mm_types.h
++++ b/include/linux/mm_types.h
+@@ -241,6 +241,7 @@ 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
+@@ -305,6 +306,7 @@ 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/kernel/fork.c b/kernel/fork.c
+index 03c1eaa..7e215ba 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -456,7 +456,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;
+
+- get_file(file);
++ vma_get_file(tmp);
+ if (tmp->vm_flags & VM_DENYWRITE)
+ atomic_dec(&inode->i_writecount);
+ i_mmap_lock_write(mapping);
+diff --git a/mm/Makefile b/mm/Makefile
+index 98c4eae..3f0c9b9 100644
+--- a/mm/Makefile
++++ b/mm/Makefile
+@@ -21,7 +21,7 @@ obj-y := filemap.o mempool.o oom_kill.o \
+ mm_init.o mmu_context.o percpu.o slab_common.o \
+ compaction.o vmacache.o \
+ interval_tree.o list_lru.o workingset.o \
+- debug.o $(mmu-y)
++ prfile.o debug.o $(mmu-y)
+
+ obj-y += init-mm.o
+
+diff --git a/mm/filemap.c b/mm/filemap.c
+index 6bf5e42..a863d0f 100644
+--- a/mm/filemap.c
++++ b/mm/filemap.c
+@@ -2062,7 +2062,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);
+- file_update_time(vma->vm_file);
++ vma_file_update_time(vma);
+ lock_page(page);
+ if (page->mapping != inode->i_mapping) {
+ unlock_page(page);
+diff --git a/mm/madvise.c b/mm/madvise.c
+index d551475..1ebf71b 100644
+--- a/mm/madvise.c
++++ b/mm/madvise.c
+@@ -320,12 +320,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.
+ */
+- get_file(f);
++ vma_get_file(vma);
+ up_read(&current->mm->mmap_sem);
+ error = vfs_fallocate(f,
+ FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
+ offset, end - start);
+- fput(f);
++ vma_fput(vma);
+ down_read(&current->mm->mmap_sem);
+ return error;
+ }
+diff --git a/mm/memory.c b/mm/memory.c
+index 22e037e..62096a2 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -2034,7 +2034,7 @@ static inline int wp_page_reuse(struct mm_struct *mm,
+ }
+
+ if (!page_mkwrite)
+- file_update_time(vma->vm_file);
++ vma_file_update_time(vma);
+ }
+
+ return VM_FAULT_WRITE;
+diff --git a/mm/mmap.c b/mm/mmap.c
+index bb50cac..1ab5e596 100644
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -274,7 +274,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)
+- fput(vma->vm_file);
++ vma_fput(vma);
+ mpol_put(vma_policy(vma));
+ kmem_cache_free(vm_area_cachep, vma);
+ return next;
+@@ -886,7 +886,7 @@ again: remove_next = 1 + (end > next->vm_end);
+ if (remove_next) {
+ if (file) {
+ uprobe_munmap(next, next->vm_start, next->vm_end);
+- fput(file);
++ vma_fput(vma);
+ }
+ if (next->anon_vma)
+ anon_vma_merge(vma, next);
+@@ -1671,8 +1671,8 @@ out:
+ return addr;
+
+ unmap_and_free_vma:
++ 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);
+@@ -2473,7 +2473,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+ goto out_free_mpol;
+
+ if (new->vm_file)
+- get_file(new->vm_file);
++ vma_get_file(new);
+
+ if (new->vm_ops && new->vm_ops->open)
+ new->vm_ops->open(new);
+@@ -2492,7 +2492,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)
+- fput(new->vm_file);
++ vma_fput(new);
+ unlink_anon_vmas(new);
+ out_free_mpol:
+ mpol_put(vma_policy(new));
+@@ -2635,7 +2635,6 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+ struct vm_area_struct *vma;
+ unsigned long populate = 0;
+ unsigned long ret = -EINVAL;
+- struct file *file;
+
+ pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. "
+ "See Documentation/vm/remap_file_pages.txt.\n",
+@@ -2679,10 +2678,10 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+ munlock_vma_pages_range(vma, start, start + size);
+ }
+
+- file = get_file(vma->vm_file);
++ vma_get_file(vma);
+ ret = do_mmap_pgoff(vma->vm_file, start, size,
+ prot, flags, pgoff, &populate);
+- fput(file);
++ vma_fput(vma);
+ out:
+ up_write(&mm->mmap_sem);
+ if (populate)
+@@ -2949,7 +2948,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)
+- get_file(new_vma->vm_file);
++ vma_get_file(new_vma);
+ 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 bb04d53..5c24c54 100644
+--- a/mm/msync.c
++++ b/mm/msync.c
+@@ -84,10 +84,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)) {
+- get_file(file);
++ vma_get_file(vma);
+ up_read(&mm->mmap_sem);
+ error = vfs_fsync_range(file, fstart, fend, 1);
+- fput(file);
++ vma_fput(vma);
+ if (error || start >= end)
+ goto out;
+ down_read(&mm->mmap_sem);
+diff --git a/mm/nommu.c b/mm/nommu.c
+index e544508..dd6f74a 100644
+--- a/mm/nommu.c
++++ b/mm/nommu.c
+@@ -693,7 +693,7 @@ static void __put_nommu_region(struct vm_region *region)
+ up_write(&nommu_region_sem);
+
+ if (region->vm_file)
+- fput(region->vm_file);
++ vmr_fput(region);
+
+ /* IO memory and memory shared directly out of the pagecache
+ * from ramfs/tmpfs mustn't be released here */
+@@ -858,7 +858,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)
+- fput(vma->vm_file);
++ vma_fput(vma);
+ put_nommu_region(vma->vm_region);
+ kmem_cache_free(vm_area_cachep, vma);
+ }
+@@ -1398,7 +1398,7 @@ unsigned long do_mmap_pgoff(struct file *file,
+ goto error_just_free;
+ }
+ }
+- fput(region->vm_file);
++ vmr_fput(region);
+ kmem_cache_free(vm_region_jar, region);
+ region = pregion;
+ result = start;
+@@ -1474,10 +1474,10 @@ error_just_free:
+ up_write(&nommu_region_sem);
+ error:
+ if (region->vm_file)
+- fput(region->vm_file);
++ vmr_fput(region);
+ kmem_cache_free(vm_region_jar, region);
+ if (vma->vm_file)
+- fput(vma->vm_file);
++ vma_fput(vma);
+ kmem_cache_free(vm_area_cachep, vma);
+ kleave(" = %d", ret);
+ return ret;
+diff --git a/mm/prfile.c b/mm/prfile.c
+new file mode 100644
+index 0000000..6c145eb
+--- /dev/null
++++ b/mm/prfile.c
+@@ -0,0 +1,86 @@
++/*
++ * Mainly for aufs which mmap(2) diffrent file and wants to print different path
++ * in /proc/PID/maps.
++ * Call these functions via macros defined in linux/mm.h.
++ *
++ * See Documentation/filesystems/aufs/design/06mmap.txt
++ *
++ * Copyright (c) 2014 Junjro R. Okajima
++ * Copyright (c) 2014 Ian Campbell
++ */
++
++#include <linux/mm.h>
++#include <linux/file.h>
++#include <linux/fs.h>
++
++/* #define PRFILE_TRACE */
++static inline void prfile_trace(struct file *f, struct file *pr,
++ const char func[], int line, const char func2[])
++{
++#ifdef PRFILE_TRACE
++ if (pr)
++ pr_info("%s:%d: %s, %p\n", func, line, func2,
++ f ? (char *)f->f_path.dentry->d_name.name : "(null)");
++#endif
++}
++
++#ifdef CONFIG_MMU
++void vma_do_file_update_time(struct vm_area_struct *vma, const char func[],
++ int line)
++{
++ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
++
++ prfile_trace(f, pr, func, line, __func__);
++ file_update_time(f);
++ if (f && pr)
++ file_update_time(pr);
++}
++
++struct file *vma_do_pr_or_file(struct vm_area_struct *vma, const char func[],
++ int line)
++{
++ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
++
++ prfile_trace(f, pr, func, line, __func__);
++ return (f && pr) ? pr : f;
++}
++
++void vma_do_get_file(struct vm_area_struct *vma, const char func[], int line)
++{
++ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
++
++ prfile_trace(f, pr, func, line, __func__);
++ get_file(f);
++ if (f && pr)
++ get_file(pr);
++}
++
++void vma_do_fput(struct vm_area_struct *vma, const char func[], int line)
++{
++ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
++
++ prfile_trace(f, pr, func, line, __func__);
++ fput(f);
++ if (f && pr)
++ fput(pr);
++}
++#else
++struct file *vmr_do_pr_or_file(struct vm_region *region, const char func[],
++ int line)
++{
++ struct file *f = region->vm_file, *pr = region->vm_prfile;
++
++ prfile_trace(f, pr, func, line, __func__);
++ return (f && pr) ? pr : f;
++}
++
++void vmr_do_fput(struct vm_region *region, const char func[], int line)
++{
++ struct file *f = region->vm_file, *pr = region->vm_prfile;
++
++ prfile_trace(f, pr, func, line, __func__);
++ fput(f);
++ if (f && pr)
++ fput(pr);
++}
++#endif /* CONFIG_MMU */
diff --git a/debian/patches/features/all/aufs4/aufs4-standalone.patch b/debian/patches/features/all/aufs4/aufs4-standalone.patch
new file mode 100644
index 000000000000..1729e1329678
--- /dev/null
+++ b/debian/patches/features/all/aufs4/aufs4-standalone.patch
@@ -0,0 +1,338 @@
+From: J. R. Okajima <hooanon05@yahoo.co.jp>
+Date: Sat Jun 6 21:25:05 2015 +0900
+Subject: aufs4.x-rcN standalone patch
+Origin: https://github.com/sfjro/aufs4-standalone/tree/aa65d099b5220918a0509c91ece96b79f7cb4b2d
+Bug-Debian: https://bugs.debian.org/541828
+
+Patch headers added by debian/patches/features/all/aufs4/gen-patch
+
+aufs4.x-rcN standalone patch
+
+diff --git a/fs/dcache.c b/fs/dcache.c
+index bc261e2..8d7951d 100644
+--- a/fs/dcache.c
++++ b/fs/dcache.c
+@@ -1269,6 +1269,7 @@ rename_retry:
+ seq = 1;
+ goto again;
+ }
++EXPORT_SYMBOL_GPL(d_walk);
+
+ /*
+ * Search for at least 1 mount point in the dentry's subdirs.
+diff --git a/fs/file_table.c b/fs/file_table.c
+index 294174d..3cea027 100644
+--- a/fs/file_table.c
++++ b/fs/file_table.c
+@@ -147,6 +147,7 @@ over:
+ }
+ return ERR_PTR(-ENFILE);
+ }
++EXPORT_SYMBOL_GPL(get_empty_filp);
+
+ /**
+ * alloc_file - allocate and initialize a 'struct file'
+@@ -308,6 +309,7 @@ void put_filp(struct file *file)
+ file_free(file);
+ }
+ }
++EXPORT_SYMBOL_GPL(put_filp);
+
+ void __init files_init(unsigned long mempages)
+ {
+diff --git a/fs/inode.c b/fs/inode.c
+index ea37cd1..58f5f58 100644
+--- a/fs/inode.c
++++ b/fs/inode.c
+@@ -58,6 +58,7 @@ 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_GPL(inode_sb_list_lock);
+
+ /*
+ * Empty aops. Can be used for the cases where the user does not
+diff --git a/fs/namespace.c b/fs/namespace.c
+index 1b9e111..d45b81b 100644
+--- a/fs/namespace.c
++++ b/fs/namespace.c
+@@ -463,6 +463,7 @@ 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
+@@ -1768,6 +1769,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+ }
+ return 0;
+ }
++EXPORT_SYMBOL_GPL(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 d16b62c..06ca6bc 100644
+--- a/fs/notify/group.c
++++ b/fs/notify/group.c
+@@ -22,6 +22,7 @@
+ #include <linux/srcu.h>
+ #include <linux/rculist.h>
+ #include <linux/wait.h>
++#include <linux/module.h>
+
+ #include <linux/fsnotify_backend.h>
+ #include "fsnotify.h"
+@@ -72,6 +73,7 @@ void fsnotify_get_group(struct fsnotify_group *group)
+ {
+ atomic_inc(&group->refcnt);
+ }
++EXPORT_SYMBOL_GPL(fsnotify_get_group);
+
+ /*
+ * Drop a reference to a group. Free it if it's through.
+@@ -81,6 +83,7 @@ void fsnotify_put_group(struct fsnotify_group *group)
+ if (atomic_dec_and_test(&group->refcnt))
+ fsnotify_final_destroy_group(group);
+ }
++EXPORT_SYMBOL_GPL(fsnotify_put_group);
+
+ /*
+ * Create a new fsnotify_group and hold a reference for the group returned.
+@@ -109,6 +112,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
+
+ return group;
+ }
++EXPORT_SYMBOL_GPL(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 92e48c7..d2c4b68 100644
+--- a/fs/notify/mark.c
++++ b/fs/notify/mark.c
+@@ -109,6 +109,7 @@ void fsnotify_put_mark(struct fsnotify_mark *mark)
+ mark->free_mark(mark);
+ }
+ }
++EXPORT_SYMBOL_GPL(fsnotify_put_mark);
+
+ /* Calculate mask of events for a list of marks */
+ u32 fsnotify_recalc_mask(struct hlist_head *head)
+@@ -202,6 +203,7 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark,
+ fsnotify_destroy_mark_locked(mark, group);
+ mutex_unlock(&group->mark_mutex);
+ }
++EXPORT_SYMBOL_GPL(fsnotify_destroy_mark);
+
+ /*
+ * Destroy all marks in the given list. The marks must be already detached from
+@@ -376,6 +378,7 @@ err:
+
+ return ret;
+ }
++EXPORT_SYMBOL_GPL(fsnotify_add_mark);
+
+ int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
+ struct inode *inode, struct vfsmount *mnt, int allow_dups)
+@@ -455,6 +458,7 @@ void fsnotify_init_mark(struct fsnotify_mark *mark,
+ atomic_set(&mark->refcnt, 1);
+ mark->free_mark = free_mark;
+ }
++EXPORT_SYMBOL_GPL(fsnotify_init_mark);
+
+ static int fsnotify_mark_destroy(void *ignored)
+ {
+diff --git a/fs/open.c b/fs/open.c
+index 98e5a52..a94e2e7 100644
+--- a/fs/open.c
++++ b/fs/open.c
+@@ -62,6 +62,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
+ mutex_unlock(&dentry->d_inode->i_mutex);
+ return ret;
+ }
++EXPORT_SYMBOL_GPL(do_truncate);
+
+ long vfs_truncate(struct path *path, loff_t length)
+ {
+@@ -676,6 +677,7 @@ int open_check_o_direct(struct file *f)
+ }
+ return 0;
+ }
++EXPORT_SYMBOL_GPL(open_check_o_direct);
+
+ static int do_dentry_open(struct file *f,
+ int (*open)(struct inode *, struct file *),
+diff --git a/fs/read_write.c b/fs/read_write.c
+index fd0414e..8ace6ec 100644
+--- a/fs/read_write.c
++++ b/fs/read_write.c
+@@ -504,6 +504,7 @@ vfs_readf_t vfs_readf(struct file *file)
+ return new_sync_read;
+ return ERR_PTR(-ENOSYS);
+ }
++EXPORT_SYMBOL_GPL(vfs_readf);
+
+ vfs_writef_t vfs_writef(struct file *file)
+ {
+@@ -515,6 +516,7 @@ vfs_writef_t vfs_writef(struct file *file)
+ return new_sync_write;
+ return ERR_PTR(-ENOSYS);
+ }
++EXPORT_SYMBOL_GPL(vfs_writef);
+
+ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
+ {
+diff --git a/fs/splice.c b/fs/splice.c
+index fa5eee5..bfb3324 100644
+--- a/fs/splice.c
++++ b/fs/splice.c
+@@ -1114,6 +1114,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+
+ return splice_write(pipe, out, ppos, len, flags);
+ }
++EXPORT_SYMBOL_GPL(do_splice_from);
+
+ /*
+ * Attempt to initiate a splice from a file to a pipe.
+@@ -1140,6 +1141,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
+
+ return splice_read(in, ppos, pipe, len, flags);
+ }
++EXPORT_SYMBOL_GPL(do_splice_to);
+
+ /**
+ * splice_direct_to_actor - splices data directly between two non-pipes
+diff --git a/fs/xattr.c b/fs/xattr.c
+index 4ef6985..6bb6303 100644
+--- a/fs/xattr.c
++++ b/fs/xattr.c
+@@ -207,6 +207,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
+ *xattr_value = value;
+ return error;
+ }
++EXPORT_SYMBOL_GPL(vfs_getxattr_alloc);
+
+ /* Compare an extended attribute value with the given value */
+ int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
+diff --git a/security/commoncap.c b/security/commoncap.c
+index f2875cd..ebf06ec 100644
+--- a/security/commoncap.c
++++ b/security/commoncap.c
+@@ -975,9 +975,11 @@ int cap_mmap_addr(unsigned long addr)
+ }
+ return ret;
+ }
++EXPORT_SYMBOL_GPL(cap_mmap_addr);
+
+ int cap_mmap_file(struct file *file, unsigned long reqprot,
+ unsigned long prot, unsigned long flags)
+ {
+ return 0;
+ }
++EXPORT_SYMBOL_GPL(cap_mmap_file);
+diff --git a/security/device_cgroup.c b/security/device_cgroup.c
+index 188c1d2..426d9af 100644
+--- a/security/device_cgroup.c
++++ b/security/device_cgroup.c
+@@ -7,6 +7,7 @@
+ #include <linux/device_cgroup.h>
+ #include <linux/cgroup.h>
+ #include <linux/ctype.h>
++#include <linux/export.h>
+ #include <linux/list.h>
+ #include <linux/uaccess.h>
+ #include <linux/seq_file.h>
+@@ -849,6 +850,7 @@ int __devcgroup_inode_permission(struct inode *inode, int mask)
+ return __devcgroup_check_permission(type, imajor(inode), iminor(inode),
+ access);
+ }
++EXPORT_SYMBOL_GPL(__devcgroup_inode_permission);
+
+ int devcgroup_inode_mknod(int mode, dev_t dev)
+ {
+diff --git a/security/security.c b/security/security.c
+index 8e9b1f4..c1c7cd1 100644
+--- a/security/security.c
++++ b/security/security.c
+@@ -430,6 +430,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
+ return 0;
+ return security_ops->path_rmdir(dir, dentry);
+ }
++EXPORT_SYMBOL_GPL(security_path_rmdir);
+
+ int security_path_unlink(struct path *dir, struct dentry *dentry)
+ {
+@@ -446,6 +447,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
+ return 0;
+ return security_ops->path_symlink(dir, dentry, old_name);
+ }
++EXPORT_SYMBOL_GPL(security_path_symlink);
+
+ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
+ struct dentry *new_dentry)
+@@ -454,6 +456,7 @@ 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_GPL(security_path_link);
+
+ int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
+ struct path *new_dir, struct dentry *new_dentry,
+@@ -481,6 +484,7 @@ int security_path_truncate(struct path *path)
+ return 0;
+ return security_ops->path_truncate(path);
+ }
++EXPORT_SYMBOL_GPL(security_path_truncate);
+
+ int security_path_chmod(struct path *path, umode_t mode)
+ {
+@@ -488,6 +492,7 @@ int security_path_chmod(struct path *path, umode_t mode)
+ return 0;
+ return security_ops->path_chmod(path, mode);
+ }
++EXPORT_SYMBOL_GPL(security_path_chmod);
+
+ int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
+ {
+@@ -495,6 +500,7 @@ 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_GPL(security_path_chown);
+
+ int security_path_chroot(struct path *path)
+ {
+@@ -580,6 +586,7 @@ int security_inode_readlink(struct dentry *dentry)
+ return 0;
+ return security_ops->inode_readlink(dentry);
+ }
++EXPORT_SYMBOL_GPL(security_inode_readlink);
+
+ int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
+ {
+@@ -594,6 +601,7 @@ int security_inode_permission(struct inode *inode, int mask)
+ return 0;
+ return security_ops->inode_permission(inode, mask);
+ }
++EXPORT_SYMBOL_GPL(security_inode_permission);
+
+ int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
+ {
+@@ -716,6 +724,7 @@ int security_file_permission(struct file *file, int mask)
+
+ return fsnotify_perm(file, mask);
+ }
++EXPORT_SYMBOL_GPL(security_file_permission);
+
+ int security_file_alloc(struct file *file)
+ {
+@@ -775,6 +784,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
+ return ret;
+ return ima_file_mmap(file, prot);
+ }
++EXPORT_SYMBOL_GPL(security_mmap_file);
+
+ int security_mmap_addr(unsigned long addr)
+ {
diff --git a/debian/patches/series b/debian/patches/series
index 6d8ab9adae41..57870940c8af 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,6 +17,13 @@ bugfix/all/firmware_class-log-every-success-and-failure.patch
bugfix/all/firmware-remove-redundant-log-messages-from-drivers.patch
bugfix/all/radeon-firmware-is-required-for-drm-and-kms-on-r600-onward.patch
+# Patches from aufs4 repository, imported with
+# debian/patches/features/all/aufs4/gen-patch. These are only the
+# changes needed to allow aufs to be built out-of-tree.
+features/all/aufs4/aufs4-base.patch
+features/all/aufs4/aufs4-mmap.patch
+features/all/aufs4/aufs4-standalone.patch
+
# Change some defaults for security reasons
debian/af_802154-Disable-auto-loading-as-mitigation-against.patch
debian/rds-Disable-auto-loading-as-mitigation-against-local.patch