aufs: Update to aufs3.x-rcN-20131104

mmap() holds reference to the union file as well as the branch file.
This behaviour requires an extra patch and used to be conditional on
CONFIG_AUFS_PROC_MAP.  It is now unconditional because otherwise the
aufs inode number may be reused and this can break userland file
caching.  So add the extra patch and drop our patch to disable
CONFIG_AUFS_PROC_MAP.

svn path=/dists/trunk/linux/; revision=20778
This commit is contained in:
Ben Hutchings 2013-11-04 03:23:54 +00:00
parent 85d54e2cc1
commit e835bd7651
9 changed files with 439 additions and 102 deletions

2
debian/changelog vendored
View File

@ -3,6 +3,8 @@ linux (3.12~rc7-1~exp2) UNRELEASED; urgency=low
* namespaces: Enable USER_NS (Closes: #712870)
- Restrict creation of user namespaces to root (CAP_SYS_ADMIN) by
default (sysctl: kern.unprivileged_userns_clone)
* aufs: Update to aufs3.x-rcN-20131104
- mmap() holds a reference to the union file as well as the branch file
-- Ben Hutchings <ben@decadent.org.uk> Fri, 01 Nov 2013 23:36:11 +0000

View File

@ -1,18 +0,0 @@
From: Ben Hutchings <ben@decadent.org.uk>
Subject: AUFS_PROC_MAP is BROKEN
Date: Thu, 07 Feb 2013 05:02:18 +0000
Bug-Debian: http://bugs.debian.org/693332
Forwarded: not-needed
This config option depends on aufs3-proc_map.patch, which we don't apply.
--- a/fs/aufs/Kconfig
+++ b/fs/aufs/Kconfig
@@ -102,6 +102,7 @@ config AUFS_RDU
config AUFS_PROC_MAP
bool "support for /proc/maps and lsof(1)"
+ depends on BROKEN
depends on PROC_FS
help
When you issue mmap(2) in aufs, it is actually a direct mmap(2)

View File

@ -1,7 +1,7 @@
From: J. R. Okajima <hooanon05@yahoo.co.jp>
Date: Wed Oct 9 20:55:35 2013 +0900
Subject: aufs3.x-rcN-20131014
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/64a158346b45c0d81ba202eeab568f57f7522162/tree/
Date: Thu Oct 31 22:12:22 2013 +0900
Subject: aufs3.x-rcN-20131104
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/f1b435357e96ad15a4a034e000d5e33bde427cc9/tree/
Bug-Debian: http://bugs.debian.org/541828
Patch generated by debian/patches/features/all/aufs3/gen-patch
@ -94,8 +94,8 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+ When the aufs mount option 'noxino' is specified, it
+ will be empty. About XINO files, see the aufs manual.
--- a/Documentation/filesystems/aufs/README 1970-01-01 01:00:00.000000000 +0100
+++ b/Documentation/filesystems/aufs/README 2013-10-28 03:48:03.320849456 +0000
@@ -0,0 +1,347 @@
+++ b/Documentation/filesystems/aufs/README 2013-11-03 20:29:04.115645964 +0000
@@ -0,0 +1,344 @@
+
+Aufs3 -- advanced multi layered unification filesystem version 3.x
+http://aufs.sf.net
@ -266,9 +266,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+1.
+- apply ./aufs3-kbuild.patch to your kernel source files.
+- apply ./aufs3-base.patch too.
+- apply ./aufs3-proc_map.patch too, if you want to make /proc/PID/maps (and
+ others including lsof(1)) show the file path on aufs instead of the
+ path on the branch fs.
+- apply ./aufs3-mmap.patch too.
+- apply ./aufs3-standalone.patch too, if you have a plan to set
+ CONFIG_AUFS_FS=m. otherwise you don't need ./aufs3-standalone.patch.
+- copy ./{Documentation,fs,include/uapi/linux/aufs_type.h} files to your
@ -288,9 +286,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+2.
+- module only (CONFIG_AUFS_FS=m).
+- apply ./aufs3-base.patch to your kernel source files.
+- apply ./aufs3-proc_map.patch too to your kernel source files,
+ if you want to make /proc/PID/maps (and others including lsof(1)) show
+ the file path on aufs instead of the path on the branch fs.
+- apply ./aufs3-mmap.patch too.
+- apply ./aufs3-standalone.patch too.
+- build your kernel, don't forget "make headers_install", and reboot.
+- edit ./config.mk and set other aufs configurations if necessary.
@ -426,6 +422,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+lauri kasvandik made a donation (2013/5).
+"pemasu from Finland" made a donation (2013/7).
+The Parted Magic Project made a donation (2013/9).
+Pavel Barta made a donation (2013/10).
+
+Thank you very much.
+Donations are always, including future donations, very important and
@ -1428,8 +1425,8 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+/new.
+Otherwise from /new.
--- a/fs/aufs/Kconfig 1970-01-01 01:00:00.000000000 +0100
+++ b/fs/aufs/Kconfig 2013-06-02 18:23:34.000000000 +0100
@@ -0,0 +1,202 @@
+++ b/fs/aufs/Kconfig 2013-11-03 20:29:04.115645964 +0000
@@ -0,0 +1,179 @@
+config AUFS_FS
+ tristate "Aufs (Advanced multi layered unification filesystem) support"
+ help
@ -1531,29 +1528,6 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+ shows better performance in most cases.
+ See detail in aufs.5.
+
+config AUFS_PROC_MAP
+ bool "support for /proc/maps and lsof(1)"
+ depends on PROC_FS
+ help
+ When you issue mmap(2) in aufs, it is actually a direct mmap(2)
+ call to the file on the branch fs since the file in aufs is
+ purely virtual. And the file path printed in /proc/maps (and
+ others) will be the path on the branch fs. In most cases, it
+ does no harm. But some utilities like lsof(1) may confuse since
+ the utility or user may expect the file path in aufs to be
+ printed.
+ To address this issue, aufs provides a patch which introduces a
+ new member called vm_prfile into struct vm_are_struct. The patch
+ is meaningless without enabling this configuration since nobody
+ sets the new vm_prfile member.
+ If you don't apply the patch, then enabling this configuration
+ will cause a compile error.
+ This approach is fragile since if someone else make some changes
+ around vm_file, then vm_prfile may not work anymore. As a
+ workaround such case, aufs provides this configuration. If you
+ disable it, then lsof(1) may produce incorrect result but the
+ problem will be gone even if the aufs patch is applied (I hope).
+
+config AUFS_SP_IATTR
+ bool "Respect the attributes (mtime/ctime mainly) of special files"
+ help
@ -1633,7 +1607,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+ When aufs supports Magic SysRq, enabled automatically.
+endif
--- a/fs/aufs/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ b/fs/aufs/Makefile 2013-10-28 03:48:03.324849456 +0000
+++ b/fs/aufs/Makefile 2013-11-03 20:29:04.115645964 +0000
@@ -0,0 +1,42 @@
+
+include ${src}/magic.mk
@ -1647,9 +1621,9 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+ccflags-y += -DDEBUG
+# sparse requires the full pathname
+ifdef M
+ccflags-y += -include ${M}/../../include/linux/aufs_type.h
+ccflags-y += -include ${M}/../../include/uapi/linux/aufs_type.h
+else
+ccflags-y += -include ${srctree}/include/linux/aufs_type.h
+ccflags-y += -include ${srctree}/include/uapi/linux/aufs_type.h
+endif
+
+obj-$(CONFIG_AUFS_FS) += aufs.o
@ -1741,7 +1715,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+#endif /* __KERNEL__ */
+#endif /* __AUFS_H__ */
--- a/fs/aufs/branch.c 1970-01-01 01:00:00.000000000 +0100
+++ b/fs/aufs/branch.c 2013-10-28 03:48:03.324849456 +0000
+++ b/fs/aufs/branch.c 2013-11-03 20:29:04.119645964 +0000
@@ -0,0 +1,1212 @@
+/*
+ * Copyright (C) 2005-2013 Junjiro R. Okajima
@ -2110,7 +2084,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+
+ /*
+ * a limit for rmdir/rename a dir
+ * cf. AUFS_MAX_NAMELEN in include/linux/aufs_type.h
+ * cf. AUFS_MAX_NAMELEN in include/uapi/linux/aufs_type.h
+ */
+ err = vfs_statfs(&br->br_path, &kst);
+ if (unlikely(err))
@ -3224,8 +3198,8 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+#endif /* __KERNEL__ */
+#endif /* __AUFS_BRANCH_H__ */
--- a/fs/aufs/conf.mk 1970-01-01 01:00:00.000000000 +0100
+++ b/fs/aufs/conf.mk 2012-01-10 02:15:56.000000000 +0000
@@ -0,0 +1,38 @@
+++ b/fs/aufs/conf.mk 2013-11-03 20:29:04.119645964 +0000
@@ -0,0 +1,37 @@
+
+AuConfStr = CONFIG_AUFS_FS=${CONFIG_AUFS_FS}
+
@ -3240,7 +3214,6 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+ HNOTIFY HFSNOTIFY \
+ EXPORT INO_T_64 \
+ RDU \
+ PROC_MAP \
+ SP_IATTR \
+ SHWH \
+ BR_RAMFS \
@ -12017,8 +11990,8 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+#endif /* CONFIG_AUFS_DEBUG */
+};
--- a/fs/aufs/file.h 1970-01-01 01:00:00.000000000 +0100
+++ b/fs/aufs/file.h 2013-10-28 03:48:03.332849456 +0000
@@ -0,0 +1,312 @@
+++ b/fs/aufs/file.h 2013-11-03 20:29:04.119645964 +0000
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2005-2013 Junjiro R. Okajima
+ *
@ -12319,14 +12292,12 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+static inline void au_vm_prfile_set(struct vm_area_struct *vma,
+ struct file *file)
+{
+#ifdef CONFIG_AUFS_PROC_MAP
+ get_file(file);
+ vma->vm_prfile = file;
+#ifndef CONFIG_MMU
+ get_file(file);
+ vma->vm_region->vm_prfile = file;
+#endif
+#endif
+}
+
+#endif /* __KERNEL__ */
@ -31642,30 +31613,8 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+out:
+ return err;
+}
--- a/include/linux/aufs_type.h 1970-01-01 01:00:00.000000000 +0100
+++ b/include/linux/aufs_type.h 2013-05-04 18:39:11.000000000 +0100
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2012-2013 Junjiro R. Okajima
+ *
+ * This program, aufs is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <uapi/linux/aufs_type.h>
--- a/include/uapi/linux/aufs_type.h 1970-01-01 01:00:00.000000000 +0100
+++ b/include/uapi/linux/aufs_type.h 2013-10-28 03:48:03.336849456 +0000
+++ b/include/uapi/linux/aufs_type.h 2013-11-03 20:29:04.119645964 +0000
@@ -0,0 +1,282 @@
+/*
+ * Copyright (C) 2005-2013 Junjiro R. Okajima
@ -31709,7 +31658,7 @@ Patch generated by debian/patches/features/all/aufs3/gen-patch
+
+#include <linux/limits.h>
+
+#define AUFS_VERSION "3.x-rcN-20131014"
+#define AUFS_VERSION "3.x-rcN-20131104"
+
+/* todo? move this to linux-2.6.19/include/magic.h */
+#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')

View File

@ -1,7 +1,7 @@
From: J. R. Okajima <hooanon05@yahoo.co.jp>
Date: Thu Sep 19 16:30:08 2013 +0900
Date: Thu Oct 31 22:12:22 2013 +0900
Subject: aufs3.x-rcN base patch
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/64a158346b45c0d81ba202eeab568f57f7522162/tree/
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/f1b435357e96ad15a4a034e000d5e33bde427cc9/tree/
Bug-Debian: http://bugs.debian.org/541828
Patch headers added by debian/patches/features/all/aufs3/gen-patch
@ -38,7 +38,7 @@ index 40e7155..6e43ab0 100644
static ssize_t loop_attr_show(struct device *dev, char *page,
diff --git a/fs/file_table.c b/fs/file_table.c
index abdd15a..da0ee1e 100644
index e900ca5..ccd02ee 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -36,7 +36,7 @@ struct files_stat_struct files_stat = {

View File

@ -1,7 +1,7 @@
From: J. R. Okajima <hooanon05@yahoo.co.jp>
Date: Sat Sep 14 01:15:30 2013 +0900
Subject: aufs3.x-rcN kbuild patch
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/64a158346b45c0d81ba202eeab568f57f7522162/tree/
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/f1b435357e96ad15a4a034e000d5e33bde427cc9/tree/
Bug-Debian: http://bugs.debian.org/541828
Patch headers added by debian/patches/features/all/aufs3/gen-patch

View File

@ -0,0 +1,404 @@
From: J. R. Okajima <hooanon05@yahoo.co.jp>
Date: Thu Oct 31 22:12:22 2013 +0900
Subject: aufs3.x-rcN mmap patch
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/f1b435357e96ad15a4a034e000d5e33bde427cc9/tree/
Bug-Debian: http://bugs.debian.org/541828
Patch headers added by debian/patches/features/all/aufs3/gen-patch
aufs3.x-rcN mmap patch
diff --git a/fs/buffer.c b/fs/buffer.c
index 6024877..95bbf13 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2446,7 +2446,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/nommu.c b/fs/proc/nommu.c
index ccfd99b..bca7789 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -45,7 +45,9 @@ 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 390bdab..ad05546 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -272,7 +272,9 @@ 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;
@@ -1412,6 +1414,7 @@ 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 56123a6..d19737f 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -149,7 +149,9 @@ 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 8b6e55e..1359c80 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -17,6 +17,9 @@
#include <linux/pfn.h>
#include <linux/bit_spinlock.h>
#include <linux/shrinker.h>
+#include <linux/dcache.h>
+#include <linux/file.h>
+#include <linux/fs.h>
struct mempolicy;
struct anon_vma;
@@ -1017,6 +1020,87 @@ static inline int fixup_user_fault(struct task_struct *tsk,
}
#endif
+/*
+ * Mainly for aufs which mmap(2) diffrent file and wants to print different path
+ * in /proc/PID/maps.
+ */
+/* #define AUFS_DEBUG_MMAP */
+static inline void aufs_trace(struct file *f, struct file *pr,
+ const char func[], int line, const char func2[])
+{
+#ifdef AUFS_DEBUG_MMAP
+ if (pr)
+ pr_info("%s:%d: %s, %p\n", func, line, func2,
+ f ? (char *)f->f_dentry->d_name.name : "(null)");
+#endif
+}
+
+static inline 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;
+ aufs_trace(f, pr, func, line, __func__);
+ return (f && pr) ? pr : f;
+}
+
+static inline void vmr_do_fput(struct vm_region *region,
+ const char func[], int line)
+{
+ struct file *f = region->vm_file, *pr = region->vm_prfile;
+ aufs_trace(f, pr, func, line, __func__);
+ fput(f);
+ if (f && pr)
+ fput(pr);
+}
+
+static inline 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;
+ aufs_trace(f, pr, func, line, __func__);
+ file_update_time(f);
+ if (f && pr)
+ file_update_time(pr);
+}
+
+static inline 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;
+ aufs_trace(f, pr, func, line, __func__);
+ return (f && pr) ? pr : f;
+}
+
+static inline 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;
+ aufs_trace(f, pr, func, line, __func__);
+ get_file(f);
+ if (f && pr)
+ get_file(pr);
+}
+
+static inline void vma_do_fput(struct vm_area_struct *vma,
+ const char func[], int line)
+{
+ struct file *f = vma->vm_file, *pr = vma->vm_prfile;
+ aufs_trace(f, pr, func, line, __func__);
+ fput(f);
+ if (f && pr)
+ fput(pr);
+}
+
+#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \
+ __LINE__)
+#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__)
+#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__)
+
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 d9851ee..4bde7bf 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -213,6 +213,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
@@ -281,6 +282,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 086fe73..003e30c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -412,7 +412,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);
mutex_lock(&mapping->i_mmap_mutex);
diff --git a/mm/filemap.c b/mm/filemap.c
index ae4846f..3f890ee 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1735,7 +1735,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/fremap.c b/mm/fremap.c
index 5bff081..246a9c7 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -207,11 +207,12 @@ get_write_lock:
*/
if (mapping_cap_account_dirty(mapping)) {
unsigned long addr;
- struct file *file = get_file(vma->vm_file);
+ struct file *file = vma->vm_file;
+ vma_get_file(vma);
addr = mmap_region(file, start, size,
vma->vm_flags, pgoff);
- fput(file);
+ vma_fput(vma);
if (IS_ERR_VALUE(addr)) {
err = addr;
} else {
diff --git a/mm/madvise.c b/mm/madvise.c
index 539eeb9..5e700b1 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.
*/
- get_file(f);
+ vma_get_file(vma);
up_read(&current->mm->mmap_sem);
error = do_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 1311f26..ff5a749 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2745,7 +2745,7 @@ reuse:
set_page_dirty_balance(dirty_page, page_mkwrite);
/* file_update_time outside page_lock */
if (vma->vm_file)
- file_update_time(vma->vm_file);
+ vma_file_update_time(vma);
}
put_page(dirty_page);
if (page_mkwrite) {
@@ -3456,7 +3456,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)
- file_update_time(vma->vm_file);
+ vma_file_update_time(vma);
} else {
unlock_page(vmf.page);
if (anon)
diff --git a/mm/mmap.c b/mm/mmap.c
index 9d54851..64ae6ce 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)
- fput(vma->vm_file);
+ vma_fput(vma);
mpol_put(vma_policy(vma));
kmem_cache_free(vm_area_cachep, vma);
return next;
@@ -860,7 +860,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);
@@ -1622,8 +1622,8 @@ out:
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);
@@ -2412,7 +2412,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);
@@ -2431,7 +2431,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));
@@ -2828,7 +2828,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 632df45..02d770e 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)) {
- get_file(file);
+ vma_get_file(vma);
up_read(&mm->mmap_sem);
error = vfs_fsync(file, 0);
- 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 ecd1f15..d4306cd 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -652,7 +652,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 */
@@ -810,7 +810,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);
}
@@ -1376,7 +1376,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;
@@ -1452,10 +1452,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;

View File

@ -1,7 +1,7 @@
From: J. R. Okajima <hooanon05@yahoo.co.jp>
Date: Tue Oct 1 17:43:27 2013 +0900
Date: Thu Oct 31 22:12:22 2013 +0900
Subject: aufs3.x-rcN standalone patch
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/64a158346b45c0d81ba202eeab568f57f7522162/tree/
Origin: http://sourceforge.net/p/aufs/aufs3-standalone/ci/f1b435357e96ad15a4a034e000d5e33bde427cc9/tree/
Bug-Debian: http://bugs.debian.org/541828
Patch headers added by debian/patches/features/all/aufs3/gen-patch
@ -9,7 +9,7 @@ Patch headers added by debian/patches/features/all/aufs3/gen-patch
aufs3.x-rcN standalone patch
diff --git a/fs/file_table.c b/fs/file_table.c
index da0ee1e..0a02e12 100644
index ccd02ee..710c617 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -37,6 +37,7 @@ struct files_stat_struct files_stat = {

View File

@ -13,7 +13,7 @@ else
fi
bug_line='Bug-Debian: http://bugs.debian.org/541828'
for patch in aufs3-{base,kbuild,standalone}.patch; do
for patch in aufs3-{base,kbuild,mmap,standalone}.patch; do
{
echo "$from_line"
if [ -d "$GIT_DIR" ]; then
@ -44,7 +44,7 @@ done
echo
cd "$aufs_dir" && \
{ find Documentation fs -type f; \
ls include/{uapi/,}linux/aufs_type.h; } | \
echo include/uapi/linux/aufs_type.h; } | \
LC_ALL=C sort | \
while read file; do
diff -uN a/"$file" "$file" | filterdiff --addnewprefix=b/

View File

@ -19,13 +19,13 @@ bugfix/all/radeon-firmware-is-required-for-drm-and-kms-on-r600-onward.patch
# Patches and source files from aufs3 repository, imported with
# debian/patches/features/all/aufs3/gen-patch.
features/all/aufs3/aufs3-base.patch
features/all/aufs3/aufs3-standalone.patch
features/all/aufs3/aufs3-kbuild.patch
features/all/aufs3/aufs3-base.patch
features/all/aufs3/aufs3-mmap.patch
features/all/aufs3/aufs3-standalone.patch
features/all/aufs3/aufs3-add.patch
# Debian-specific changes
debian/aufs3-mark-as-staging.patch
debian/AUFS_PROC_MAP-is-BROKEN.patch
# Change some defaults for security reasons
features/all/sysrq-mask.patch