[packages/kernel] - started update to 4.11, apparmor patch diabled - a lot of FAILED hunks

baggins baggins at pld-linux.org
Sat May 6 22:29:30 CEST 2017


commit 521ced186fdfe27c112e57dac8af155cddf13974
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat May 6 22:28:48 2017 +0200

    - started update to 4.11, apparmor patch diabled - a lot of FAILED hunks

 kernel-aufs4.patch | 878 ++++++++++++++++++++++++++++++++++++-----------------
 kernel.spec        |  10 +-
 2 files changed, 602 insertions(+), 286 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 34ee31a9..c1d30634 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -71,9 +71,9 @@
 %define		have_pcmcia	0
 %endif
 
-%define		rel		1
-%define		basever		4.10
-%define		postver		.13
+%define		rel		0.1
+%define		basever		4.11
+%define		postver		.0
 
 # define this to '-%{basever}' for longterm branch
 %define		versuffix	%{nil}
@@ -122,7 +122,7 @@ Epoch:		3
 License:	GPL v2
 Group:		Base/Kernel
 Source0:	https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{basever}.tar.xz
-# Source0-md5:	b5e7f6b9b2fe1b6cc7bc56a3a0bfc090
+# Source0-md5:	251a5deee0fa6daf3f356b1bbda9eab8
 %if "%{postver}" != ".0"
 Patch0:		https://www.kernel.org/pub/linux/kernel/v4.x/patch-%{version}.xz
 # Patch0-md5:	f7f6515047207f3e4f0f32238e3ec80e
@@ -711,7 +711,7 @@ rm -f localversion-rt
 %endif
 
 # apparmor
-%patch5000 -p1
+#%patch5000 -p1
 
 %patch250 -p1
 
diff --git a/kernel-aufs4.patch b/kernel-aufs4.patch
index cc61c35d..3d47d24a 100644
--- a/kernel-aufs4.patch
+++ b/kernel-aufs4.patch
@@ -22,7 +22,7 @@ index 7bbaca9..a026491 100644
  obj-$(CONFIG_EFIVAR_FS)		+= efivarfs/
 +obj-$(CONFIG_AUFS_FS)           += aufs/
 diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
-index f330ba4..67d88cd 100644
+index dd9820b..d0435d9 100644
 --- a/include/uapi/linux/Kbuild
 +++ b/include/uapi/linux/Kbuild
 @@ -59,6 +59,7 @@ header-y += atmsvc.h
@@ -36,10 +36,10 @@ index f330ba4..67d88cd 100644
 aufs4.x-rcN base patch
 
 diff --git a/MAINTAINERS b/MAINTAINERS
-index 107c10e..dd8df20 100644
+index 1b0a87f..76fd7cc 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
-@@ -2308,6 +2308,19 @@ F:	include/linux/audit.h
+@@ -2319,6 +2319,19 @@ F:	include/linux/audit.h
  F:	include/uapi/linux/audit.h
  F:	kernel/audit*
  
@@ -60,7 +60,7 @@ index 107c10e..dd8df20 100644
  M:	Miguel Ojeda Sandonis <miguel.ojeda.sandonis at gmail.com>
  W:	http://miguelojeda.es/auxdisplay.htm
 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index f347285..b63f68b 100644
+index 0ecb646..cf39138 100644
 --- a/drivers/block/loop.c
 +++ b/drivers/block/loop.c
 @@ -701,6 +701,24 @@ static inline int is_loop_device(struct file *file)
@@ -102,10 +102,10 @@ index 95d71ed..8ca5f09 100644
  		   void (*finish)(void *))
  {
 diff --git a/fs/fcntl.c b/fs/fcntl.c
-index e1c54f2..9f07008 100644
+index be8fbe2..f5f4f94 100644
 --- a/fs/fcntl.c
 +++ b/fs/fcntl.c
-@@ -29,7 +29,7 @@
+@@ -30,7 +30,7 @@
  
  #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
  
@@ -114,7 +114,7 @@ index e1c54f2..9f07008 100644
  {
  	struct inode * inode = file_inode(filp);
  	int error = 0;
-@@ -60,6 +60,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
+@@ -61,6 +61,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
  
  	if (filp->f_op->check_flags)
  		error = filp->f_op->check_flags(arg);
@@ -137,10 +137,10 @@ index 88110fd..9a9ba3a 100644
  	int (*update_time)(struct inode *, struct timespec *, int);
  
 diff --git a/fs/read_write.c b/fs/read_write.c
-index 5816d4c..670b365 100644
+index c4f88af..ac71b96 100644
 --- a/fs/read_write.c
 +++ b/fs/read_write.c
-@@ -515,6 +515,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
+@@ -513,6 +513,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
  }
  EXPORT_SYMBOL(__vfs_write);
  
@@ -170,10 +170,10 @@ index 5816d4c..670b365 100644
  {
  	mm_segment_t old_fs;
 diff --git a/fs/splice.c b/fs/splice.c
-index 873d831..7899532 100644
+index 006ba50..46c87af 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -856,8 +856,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+@@ -859,8 +859,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
  /*
   * Attempt to initiate a splice from pipe to file.
   */
@@ -184,7 +184,7 @@ index 873d831..7899532 100644
  {
  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
  				loff_t *, size_t, unsigned int);
-@@ -873,9 +873,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -876,9 +876,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.
   */
@@ -198,7 +198,7 @@ index 873d831..7899532 100644
  	ssize_t (*splice_read)(struct file *, loff_t *,
  			       struct pipe_inode_info *, size_t, unsigned int);
 diff --git a/fs/sync.c b/fs/sync.c
-index 2a54c1f..7a5fa3f 100644
+index 11ba023..abf6a5d 100644
 --- a/fs/sync.c
 +++ b/fs/sync.c
 @@ -27,7 +27,7 @@
@@ -223,10 +223,10 @@ index 61eb82c..e700888 100644
  static inline void fput_light(struct file *file, int fput_needed)
  {
 diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 2ba0743..d1c583b 100644
+index 7251f7b..3668627 100644
 --- a/include/linux/fs.h
 +++ b/include/linux/fs.h
-@@ -1240,6 +1240,7 @@ extern void fasync_free(struct fasync_struct *);
+@@ -1246,6 +1246,7 @@ extern void fasync_free(struct fasync_struct *);
  /* can be called from interrupts */
  extern void kill_fasync(struct fasync_struct **, int, int);
  
@@ -234,7 +234,7 @@ index 2ba0743..d1c583b 100644
  extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
  extern void f_setown(struct file *filp, unsigned long arg, int force);
  extern void f_delown(struct file *filp);
-@@ -1664,6 +1665,7 @@ struct file_operations {
+@@ -1673,6 +1674,7 @@ struct file_operations {
  	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
  	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
  	int (*check_flags)(int);
@@ -242,7 +242,7 @@ index 2ba0743..d1c583b 100644
  	int (*flock) (struct file *, int, struct file_lock *);
  	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
  	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
-@@ -1717,6 +1719,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
+@@ -1749,6 +1751,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
  			      struct iovec *fast_pointer,
  			      struct iovec **ret_pointer);
  
@@ -255,7 +255,7 @@ index 2ba0743..d1c583b 100644
  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 *);
-@@ -2108,6 +2116,7 @@ extern int current_umask(void);
+@@ -2127,6 +2135,7 @@ extern int current_umask(void);
  extern void ihold(struct inode * inode);
  extern void iput(struct inode *);
  extern int generic_update_time(struct inode *, struct timespec *, int);
@@ -263,7 +263,7 @@ index 2ba0743..d1c583b 100644
  
  /* /sys/fs */
  extern struct kobject *fs_kobj;
-@@ -2387,6 +2396,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
+@@ -2407,6 +2416,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
  	return false;
  }
  #endif
@@ -289,10 +289,10 @@ index 00a2116..1f0a4a2 100644
 aufs4.x-rcN mmap patch
 
 diff --git a/fs/proc/base.c b/fs/proc/base.c
-index 87c9a9a..a0196f0 100644
+index c87b6b9..6b71643 100644
 --- a/fs/proc/base.c
 +++ b/fs/proc/base.c
-@@ -1958,7 +1958,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path)
+@@ -1946,7 +1946,7 @@ static int 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) {
@@ -318,10 +318,10 @@ index 7563437..7c0dc0f 100644
  		ino = inode->i_ino;
  	}
 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
-index 8f96a49..0d10404 100644
+index f08bd31..e1b9a37 100644
 --- a/fs/proc/task_mmu.c
 +++ b/fs/proc/task_mmu.c
-@@ -291,7 +291,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
+@@ -292,7 +292,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
  	const char *name = NULL;
  
  	if (file) {
@@ -333,7 +333,7 @@ index 8f96a49..0d10404 100644
  		dev = inode->i_sb->s_dev;
  		ino = inode->i_ino;
  		pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
-@@ -1628,7 +1631,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
+@@ -1629,7 +1632,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;
@@ -343,10 +343,10 @@ index 8f96a49..0d10404 100644
  	struct mm_walk walk = {
  		.hugetlb_entry = gather_hugetlb_stats,
 diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
-index 3717562..6a328f1 100644
+index 23266694..58e59b6 100644
 --- a/fs/proc/task_nommu.c
 +++ b/fs/proc/task_nommu.c
-@@ -155,7 +155,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
+@@ -157,7 +157,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
  	file = vma->vm_file;
  
  	if (file) {
@@ -359,10 +359,10 @@ index 3717562..6a328f1 100644
  		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 b84615b..3978a35 100644
+index 00a8fa7..a90742b 100644
 --- a/include/linux/mm.h
 +++ b/include/linux/mm.h
-@@ -1257,6 +1257,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
+@@ -1294,6 +1294,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
  }
  #endif
  
@@ -392,10 +392,10 @@ index b84615b..3978a35 100644
  		unsigned int gup_flags);
  extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
 diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
-index 808751d..66fc765 100644
+index f60f45f..38c5f76 100644
 --- a/include/linux/mm_types.h
 +++ b/include/linux/mm_types.h
-@@ -275,6 +275,7 @@ struct vm_region {
+@@ -259,6 +259,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 */
@@ -403,7 +403,7 @@ index 808751d..66fc765 100644
  
  	int		vm_usage;	/* region usage count (access under nommu_region_sem) */
  	bool		vm_icache_flushed : 1; /* true if the icache has been flushed for
-@@ -349,6 +350,7 @@ struct vm_area_struct {
+@@ -333,6 +334,7 @@ struct vm_area_struct {
  	unsigned long vm_pgoff;		/* Offset (within vm_file) in PAGE_SIZE
  					   units */
  	struct file * vm_file;		/* File we map to (can be NULL). */
@@ -412,10 +412,10 @@ index 808751d..66fc765 100644
  
  #ifndef CONFIG_MMU
 diff --git a/kernel/fork.c b/kernel/fork.c
-index 11c5c8a..48e7ef7 100644
+index 6c463c80..24ae37c 100644
 --- a/kernel/fork.c
 +++ b/kernel/fork.c
-@@ -626,7 +626,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
+@@ -641,7 +641,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
  			struct inode *inode = file_inode(file);
  			struct address_space *mapping = file->f_mapping;
  
@@ -425,12 +425,12 @@ index 11c5c8a..48e7ef7 100644
  				atomic_dec(&inode->i_writecount);
  			i_mmap_lock_write(mapping);
 diff --git a/mm/Makefile b/mm/Makefile
-index 295bd7a..14fa1c8 100644
+index 026f6a8..723da17 100644
 --- a/mm/Makefile
 +++ b/mm/Makefile
-@@ -37,7 +37,7 @@ obj-y			:= filemap.o mempool.o oom_kill.o \
+@@ -39,7 +39,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 \
+ 			   compaction.o vmacache.o swap_slots.o \
  			   interval_tree.o list_lru.o workingset.o \
 -			   debug.o $(mmu-y)
 +			   prfile.o debug.o $(mmu-y)
@@ -438,20 +438,20 @@ index 295bd7a..14fa1c8 100644
  obj-y += init-mm.o
  
 diff --git a/mm/filemap.c b/mm/filemap.c
-index 3f9afde..bb050b0 100644
+index 1694623..68cd758 100644
 --- a/mm/filemap.c
 +++ b/mm/filemap.c
-@@ -2397,7 +2397,7 @@ int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
+@@ -2406,7 +2406,7 @@ int filemap_page_mkwrite(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);
+-	file_update_time(vmf->vma->vm_file);
++	vma_file_update_time(vmf->vma);
  	lock_page(page);
  	if (page->mapping != inode->i_mapping) {
  		unlock_page(page);
 diff --git a/mm/mmap.c b/mm/mmap.c
-index dc4291d..4b3a2aa 100644
+index bfbe885..8bd32f9 100644
 --- a/mm/mmap.c
 +++ b/mm/mmap.c
 @@ -170,7 +170,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
@@ -463,7 +463,7 @@ index dc4291d..4b3a2aa 100644
  	mpol_put(vma_policy(vma));
  	kmem_cache_free(vm_area_cachep, vma);
  	return next;
-@@ -879,7 +879,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
+@@ -881,7 +881,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
  	if (remove_next) {
  		if (file) {
  			uprobe_munmap(next, next->vm_start, next->vm_end);
@@ -472,7 +472,7 @@ index dc4291d..4b3a2aa 100644
  		}
  		if (next->anon_vma)
  			anon_vma_merge(vma, next);
-@@ -1727,8 +1727,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
+@@ -1731,8 +1731,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
  	return addr;
  
  unmap_and_free_vma:
@@ -482,7 +482,7 @@ index dc4291d..4b3a2aa 100644
  
  	/* Undo any partial mapping done by a device driver. */
  	unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end);
-@@ -2533,7 +2533,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2537,7 +2537,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
  		goto out_free_mpol;
  
  	if (new->vm_file)
@@ -491,7 +491,7 @@ index dc4291d..4b3a2aa 100644
  
  	if (new->vm_ops && new->vm_ops->open)
  		new->vm_ops->open(new);
-@@ -2552,7 +2552,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2556,7 +2556,7 @@ 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)
@@ -500,7 +500,7 @@ index dc4291d..4b3a2aa 100644
  	unlink_anon_vmas(new);
   out_free_mpol:
  	mpol_put(vma_policy(new));
-@@ -2703,7 +2703,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2710,7 +2710,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
  	struct vm_area_struct *vma;
  	unsigned long populate = 0;
  	unsigned long ret = -EINVAL;
@@ -509,7 +509,7 @@ index dc4291d..4b3a2aa 100644
  
  	pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.\n",
  		     current->comm, current->pid);
-@@ -2778,10 +2778,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2785,10 +2785,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
  		}
  	}
  
@@ -518,7 +518,7 @@ index dc4291d..4b3a2aa 100644
 +	file = vma->vm_file;
 +	prfile = vma->vm_prfile;
  	ret = do_mmap_pgoff(vma->vm_file, start, size,
- 			prot, flags, pgoff, &populate);
+ 			prot, flags, pgoff, &populate, NULL);
 +	if (!IS_ERR_VALUE(ret) && file && prfile) {
 +		struct vm_area_struct *new_vma;
 +
@@ -538,7 +538,7 @@ index dc4291d..4b3a2aa 100644
  out:
  	up_write(&mm->mmap_sem);
  	if (populate)
-@@ -3056,7 +3073,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+@@ -3079,7 +3096,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)
@@ -548,10 +548,10 @@ index dc4291d..4b3a2aa 100644
  			new_vma->vm_ops->open(new_vma);
  		vma_link(mm, new_vma, prev, rb_link, rb_parent);
 diff --git a/mm/nommu.c b/mm/nommu.c
-index 24f9f5f..ac0d37a 100644
+index 2d131b9..5dc9a19 100644
 --- a/mm/nommu.c
 +++ b/mm/nommu.c
-@@ -636,7 +636,7 @@ static void __put_nommu_region(struct vm_region *region)
+@@ -637,7 +637,7 @@ static void __put_nommu_region(struct vm_region *region)
  		up_write(&nommu_region_sem);
  
  		if (region->vm_file)
@@ -560,7 +560,7 @@ index 24f9f5f..ac0d37a 100644
  
  		/* IO memory and memory shared directly out of the pagecache
  		 * from ramfs/tmpfs mustn't be released here */
-@@ -794,7 +794,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma)
+@@ -795,7 +795,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)
@@ -569,7 +569,7 @@ index 24f9f5f..ac0d37a 100644
  	put_nommu_region(vma->vm_region);
  	kmem_cache_free(vm_area_cachep, vma);
  }
-@@ -1320,7 +1320,7 @@ unsigned long do_mmap(struct file *file,
+@@ -1322,7 +1322,7 @@ unsigned long do_mmap(struct file *file,
  					goto error_just_free;
  				}
  			}
@@ -578,7 +578,7 @@ index 24f9f5f..ac0d37a 100644
  			kmem_cache_free(vm_region_jar, region);
  			region = pregion;
  			result = start;
-@@ -1395,10 +1395,10 @@ unsigned long do_mmap(struct file *file,
+@@ -1397,10 +1397,10 @@ unsigned long do_mmap(struct file *file,
  	up_write(&nommu_region_sem);
  error:
  	if (region->vm_file)
@@ -706,10 +706,10 @@ index 8ca5f09..b1ff5be 100644
  /**
   * d_ancestor - search for an ancestor
 diff --git a/fs/exec.c b/fs/exec.c
-index e579466..2566b16 100644
+index 65145a3..8d35776 100644
 --- a/fs/exec.c
 +++ b/fs/exec.c
-@@ -104,6 +104,7 @@ bool path_noexec(const struct path *path)
+@@ -109,6 +109,7 @@ bool path_noexec(const struct path *path)
  	return (path->mnt->mnt_flags & MNT_NOEXEC) ||
  	       (path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC);
  }
@@ -718,10 +718,10 @@ index e579466..2566b16 100644
  #ifdef CONFIG_USELIB
  /*
 diff --git a/fs/fcntl.c b/fs/fcntl.c
-index 9f07008..d60b682 100644
+index f5f4f94..c671660 100644
 --- a/fs/fcntl.c
 +++ b/fs/fcntl.c
-@@ -82,6 +82,7 @@ int setfl(int fd, struct file * filp, unsigned long arg)
+@@ -83,6 +83,7 @@ int setfl(int fd, struct file * filp, unsigned long arg)
   out:
  	return error;
  }
@@ -730,10 +730,10 @@ index 9f07008..d60b682 100644
  static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
                       int force)
 diff --git a/fs/file_table.c b/fs/file_table.c
-index 6d982b5..9a3c6c8 100644
+index 954d510..4fb5b10 100644
 --- a/fs/file_table.c
 +++ b/fs/file_table.c
-@@ -147,6 +147,7 @@ struct file *get_empty_filp(void)
+@@ -148,6 +148,7 @@ struct file *get_empty_filp(void)
  	}
  	return ERR_PTR(-ENFILE);
  }
@@ -741,7 +741,7 @@ index 6d982b5..9a3c6c8 100644
  
  /**
   * alloc_file - allocate and initialize a 'struct file'
-@@ -258,6 +259,7 @@ void flush_delayed_fput(void)
+@@ -259,6 +260,7 @@ void flush_delayed_fput(void)
  {
  	delayed_fput(NULL);
  }
@@ -749,7 +749,7 @@ index 6d982b5..9a3c6c8 100644
  
  static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);
  
-@@ -300,6 +302,7 @@ void __fput_sync(struct file *file)
+@@ -301,6 +303,7 @@ void __fput_sync(struct file *file)
  }
  
  EXPORT_SYMBOL(fput);
@@ -757,7 +757,7 @@ index 6d982b5..9a3c6c8 100644
  
  void put_filp(struct file *file)
  {
-@@ -308,6 +311,7 @@ void put_filp(struct file *file)
+@@ -309,6 +312,7 @@ void put_filp(struct file *file)
  		file_free(file);
  	}
  }
@@ -778,10 +778,10 @@ index 9a9ba3a..a3a18d8 100644
  /**
   *	touch_atime	-	update the access time
 diff --git a/fs/namespace.c b/fs/namespace.c
-index 487ba30..642069d 100644
+index cc1375ef..9b4c67c 100644
 --- a/fs/namespace.c
 +++ b/fs/namespace.c
-@@ -462,6 +462,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
+@@ -465,6 +465,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
  	mnt_dec_writers(real_mount(mnt));
  	preempt_enable();
  }
@@ -789,7 +789,7 @@ index 487ba30..642069d 100644
  
  /**
   * mnt_drop_write - give up write access to a mount
-@@ -1872,6 +1873,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+@@ -1884,6 +1885,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
  	}
  	return 0;
  }
@@ -870,7 +870,7 @@ index 6043306..fdb50e4 100644
  /*
   * Destroy all marks in destroy_list, waits for SRCU period to finish before
 diff --git a/fs/open.c b/fs/open.c
-index 9921f70..80d94c0 100644
+index 949cef2..9a892fb8 100644
 --- a/fs/open.c
 +++ b/fs/open.c
 @@ -64,6 +64,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
@@ -881,7 +881,7 @@ index 9921f70..80d94c0 100644
  
  long vfs_truncate(const struct path *path, loff_t length)
  {
-@@ -695,6 +696,7 @@ int open_check_o_direct(struct file *f)
+@@ -693,6 +694,7 @@ int open_check_o_direct(struct file *f)
  	}
  	return 0;
  }
@@ -890,10 +890,10 @@ index 9921f70..80d94c0 100644
  static int do_dentry_open(struct file *f,
  			  struct inode *inode,
 diff --git a/fs/read_write.c b/fs/read_write.c
-index 670b365..f9f8bb1 100644
+index ac71b96..b69e687 100644
 --- a/fs/read_write.c
 +++ b/fs/read_write.c
-@@ -525,6 +525,7 @@ vfs_readf_t vfs_readf(struct file *file)
+@@ -523,6 +523,7 @@ vfs_readf_t vfs_readf(struct file *file)
  		return new_sync_read;
  	return ERR_PTR(-ENOSYS);
  }
@@ -901,7 +901,7 @@ index 670b365..f9f8bb1 100644
  
  vfs_writef_t vfs_writef(struct file *file)
  {
-@@ -536,6 +537,7 @@ vfs_writef_t vfs_writef(struct file *file)
+@@ -534,6 +535,7 @@ vfs_writef_t vfs_writef(struct file *file)
  		return new_sync_write;
  	return ERR_PTR(-ENOSYS);
  }
@@ -910,10 +910,10 @@ index 670b365..f9f8bb1 100644
  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 7899532..c0df111 100644
+index 46c87af..0efa652 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -869,6 +869,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -872,6 +872,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  
  	return splice_write(pipe, out, ppos, len, flags);
  }
@@ -921,7 +921,7 @@ index 7899532..c0df111 100644
  
  /*
   * Attempt to initiate a splice from a file to a pipe.
-@@ -898,6 +899,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
+@@ -901,6 +902,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
  
  	return splice_read(in, ppos, pipe, len, flags);
  }
@@ -930,7 +930,7 @@ index 7899532..c0df111 100644
  /**
   * splice_direct_to_actor - splices data directly between two non-pipes
 diff --git a/fs/sync.c b/fs/sync.c
-index 7a5fa3f..c9b9d46 100644
+index abf6a5d..c86fe9c 100644
 --- a/fs/sync.c
 +++ b/fs/sync.c
 @@ -38,6 +38,7 @@ int __sync_filesystem(struct super_block *sb, int wait)
@@ -963,10 +963,10 @@ index d513051..e056d54 100644
  }
 +EXPORT_SYMBOL_GPL(task_work_run);
 diff --git a/security/commoncap.c b/security/commoncap.c
-index 8df676f..6b5cc07 100644
+index 78b3783..c8b3e88 100644
 --- a/security/commoncap.c
 +++ b/security/commoncap.c
-@@ -1061,12 +1061,14 @@ int cap_mmap_addr(unsigned long addr)
+@@ -1062,12 +1062,14 @@ int cap_mmap_addr(unsigned long addr)
  	}
  	return ret;
  }
@@ -1002,10 +1002,10 @@ index 03c1652..f88c84b 100644
  int devcgroup_inode_mknod(int mode, dev_t dev)
  {
 diff --git a/security/security.c b/security/security.c
-index f825304..8dd441d 100644
+index d0e07f2..5e323b0 100644
 --- a/security/security.c
 +++ b/security/security.c
-@@ -443,6 +443,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
+@@ -481,6 +481,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
  		return 0;
  	return call_int_hook(path_rmdir, 0, dir, dentry);
  }
@@ -1013,7 +1013,7 @@ index f825304..8dd441d 100644
  
  int security_path_unlink(const struct path *dir, struct dentry *dentry)
  {
-@@ -459,6 +460,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry,
+@@ -497,6 +498,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry,
  		return 0;
  	return call_int_hook(path_symlink, 0, dir, dentry, old_name);
  }
@@ -1021,7 +1021,7 @@ index f825304..8dd441d 100644
  
  int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
  		       struct dentry *new_dentry)
-@@ -467,6 +469,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
+@@ -505,6 +507,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
  		return 0;
  	return call_int_hook(path_link, 0, old_dentry, new_dir, new_dentry);
  }
@@ -1029,7 +1029,7 @@ index f825304..8dd441d 100644
  
  int security_path_rename(const struct path *old_dir, struct dentry *old_dentry,
  			 const struct path *new_dir, struct dentry *new_dentry,
-@@ -494,6 +497,7 @@ int security_path_truncate(const struct path *path)
+@@ -532,6 +535,7 @@ int security_path_truncate(const struct path *path)
  		return 0;
  	return call_int_hook(path_truncate, 0, path);
  }
@@ -1037,7 +1037,7 @@ index f825304..8dd441d 100644
  
  int security_path_chmod(const struct path *path, umode_t mode)
  {
-@@ -501,6 +505,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
+@@ -539,6 +543,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
  		return 0;
  	return call_int_hook(path_chmod, 0, path, mode);
  }
@@ -1045,7 +1045,7 @@ index f825304..8dd441d 100644
  
  int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
  {
-@@ -508,6 +513,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
+@@ -546,6 +551,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
  		return 0;
  	return call_int_hook(path_chown, 0, path, uid, gid);
  }
@@ -1053,7 +1053,7 @@ index f825304..8dd441d 100644
  
  int security_path_chroot(const struct path *path)
  {
-@@ -593,6 +599,7 @@ int security_inode_readlink(struct dentry *dentry)
+@@ -631,6 +637,7 @@ int security_inode_readlink(struct dentry *dentry)
  		return 0;
  	return call_int_hook(inode_readlink, 0, dentry);
  }
@@ -1061,7 +1061,7 @@ index f825304..8dd441d 100644
  
  int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
  			       bool rcu)
-@@ -608,6 +615,7 @@ int security_inode_permission(struct inode *inode, int mask)
+@@ -646,6 +653,7 @@ int security_inode_permission(struct inode *inode, int mask)
  		return 0;
  	return call_int_hook(inode_permission, 0, inode, mask);
  }
@@ -1069,7 +1069,7 @@ index f825304..8dd441d 100644
  
  int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
  {
-@@ -779,6 +787,7 @@ int security_file_permission(struct file *file, int mask)
+@@ -817,6 +825,7 @@ int security_file_permission(struct file *file, int mask)
  
  	return fsnotify_perm(file, mask);
  }
@@ -1077,7 +1077,7 @@ index f825304..8dd441d 100644
  
  int security_file_alloc(struct file *file)
  {
-@@ -838,6 +847,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
+@@ -876,6 +885,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
  		return ret;
  	return ima_file_mmap(file, prot);
  }
@@ -1087,7 +1087,7 @@ index f825304..8dd441d 100644
  {
 diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Documentation/ABI/testing/debugfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/debugfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/debugfs-aufs	2016-10-09 16:55:36.476034536 +0200
++++ linux/Documentation/ABI/testing/debugfs-aufs	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,50 @@
 +What:		/debug/aufs/si_<id>/
 +Date:		March 2009
@@ -1141,7 +1141,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document
 +		will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentation/ABI/testing/sysfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/sysfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/sysfs-aufs	2016-10-09 16:55:36.476034536 +0200
++++ linux/Documentation/ABI/testing/sysfs-aufs	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,31 @@
 +What:		/sys/fs/aufs/si_<id>/
 +Date:		March 2009
@@ -1176,7 +1176,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentat
 +		will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt linux/Documentation/filesystems/aufs/design/01intro.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/01intro.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/01intro.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,170 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -1350,7 +1350,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt lin
 +about it. But currently I have implemented it in kernel space.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt linux/Documentation/filesystems/aufs/design/02struct.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/02struct.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/02struct.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,258 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -1612,7 +1612,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt li
 +For this purpose, use "aumvdown" command in aufs-util.git.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.txt linux/Documentation/filesystems/aufs/design/03atomic_open.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/03atomic_open.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/03atomic_open.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,85 @@
 +
 +# Copyright (C) 2015-2017 Junjiro R. Okajima
@@ -1701,7 +1701,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.t
 +       be implemented in aufs, but not all I am afraid.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt linux/Documentation/filesystems/aufs/design/03lookup.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/03lookup.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/03lookup.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,113 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -1818,7 +1818,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt li
 +   by over-mounting something (or another method).
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt linux/Documentation/filesystems/aufs/design/04branch.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/04branch.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/04branch.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,74 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -1896,7 +1896,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt li
 +    same named entry on the upper branch.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt linux/Documentation/filesystems/aufs/design/05wbr_policy.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,64 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -1964,7 +1964,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.tx
 +  copyup policy.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt linux/Documentation/filesystems/aufs/design/06fhsm.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06fhsm.txt	2017-03-02 14:24:13.850255360 +0100
++++ linux/Documentation/filesystems/aufs/design/06fhsm.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,120 @@
 +
 +# Copyright (C) 2011-2017 Junjiro R. Okajima
@@ -2088,7 +2088,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt linu
 +should restore the original file state after an error happens.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linux/Documentation/filesystems/aufs/design/06mmap.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06mmap.txt	2017-03-02 14:24:13.853588785 +0100
++++ linux/Documentation/filesystems/aufs/design/06mmap.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,72 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -2164,7 +2164,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linu
 +I have to give up this "looks-smater" approach.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt linux/Documentation/filesystems/aufs/design/06xattr.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06xattr.txt	2017-03-02 14:24:13.853588785 +0100
++++ linux/Documentation/filesystems/aufs/design/06xattr.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,96 @@
 +
 +# Copyright (C) 2014-2017 Junjiro R. Okajima
@@ -2264,7 +2264,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt lin
 +now, aufs implements the branch attributes to ignore the error.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt linux/Documentation/filesystems/aufs/design/07export.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/07export.txt	2017-03-02 14:24:13.853588785 +0100
++++ linux/Documentation/filesystems/aufs/design/07export.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,58 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -2326,7 +2326,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt li
 +  lookup_one_len(), vfs_getattr(), encode_fh() and others.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linux/Documentation/filesystems/aufs/design/08shwh.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/08shwh.txt	2017-03-02 14:24:13.853588785 +0100
++++ linux/Documentation/filesystems/aufs/design/08shwh.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,52 @@
 +
 +# Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -2382,7 +2382,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linu
 +initramfs will use it to replace the old one at the next boot.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt linux/Documentation/filesystems/aufs/design/10dynop.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/10dynop.txt	2017-03-02 14:24:13.853588785 +0100
++++ linux/Documentation/filesystems/aufs/design/10dynop.txt	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,47 @@
 +
 +# Copyright (C) 2010-2017 Junjiro R. Okajima
@@ -2433,7 +2433,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt lin
 +regular files only.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documentation/filesystems/aufs/README
 --- /usr/share/empty/Documentation/filesystems/aufs/README	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/README	2016-12-17 12:28:17.595211562 +0100
++++ linux/Documentation/filesystems/aufs/README	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,393 @@
 +
 +Aufs4 -- advanced multi layered unification filesystem version 4.x
@@ -2830,7 +2830,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +# End: ;
 diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 --- /usr/share/empty/fs/aufs/aufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/aufs.h	2017-03-02 14:24:13.853588785 +0100
++++ linux/fs/aufs/aufs.h	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,59 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -2893,8 +2893,8 @@ diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 +#endif /* __AUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 --- /usr/share/empty/fs/aufs/branch.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.c	2017-03-02 14:24:13.853588785 +0100
-@@ -0,0 +1,1412 @@
++++ linux/fs/aufs/branch.c	2017-05-06 22:16:52.774886674 +0200
+@@ -0,0 +1,1423 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -2933,7 +2933,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +	if (br->br_xino.xi_file)
 +		fput(br->br_xino.xi_file);
-+	mutex_destroy(&br->br_xino.xi_nondir_mtx);
++	for (i = br->br_xino.xi_nondir.total - 1; i >= 0; i--)
++		AuDebugOn(br->br_xino.xi_nondir.array[i]);
++	au_delayed_kfree(br->br_xino.xi_nondir.array);
 +
 +	AuDebugOn(au_br_count(br));
 +	au_br_count_fin(br);
@@ -3028,14 +3030,19 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	int err;
 +
 +	err = -ENOMEM;
-+	root = sb->s_root;
 +	add_branch = kzalloc(sizeof(*add_branch), GFP_NOFS);
 +	if (unlikely(!add_branch))
 +		goto out;
++	add_branch->br_xino.xi_nondir.total = 8; /* initial size */
++	add_branch->br_xino.xi_nondir.array
++		= kzalloc(sizeof(ino_t) * add_branch->br_xino.xi_nondir.total,
++			  GFP_NOFS);
++	if (unlikely(!add_branch->br_xino.xi_nondir.array))
++		goto out_br;
 +
 +	err = au_hnotify_init_br(add_branch, perm);
 +	if (unlikely(err))
-+		goto out_br;
++		goto out_xinondir;
 +
 +	if (au_br_writable(perm)) {
 +		/* may be freed separately at changing the branch permission */
@@ -3051,6 +3058,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +			goto out_wbr;
 +	}
 +
++	root = sb->s_root;
 +	err = au_sbr_realloc(au_sbi(sb), new_nbranch, /*may_shrink*/0);
 +	if (!err)
 +		err = au_di_realloc(au_di(root), new_nbranch, /*may_shrink*/0);
@@ -3066,6 +3074,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		au_delayed_kfree(add_branch->br_wbr);
 +out_hnotify:
 +	au_hnotify_fin_br(add_branch);
++out_xinondir:
++	au_delayed_kfree(add_branch->br_xino.xi_nondir.array);
 +out_br:
 +	au_delayed_kfree(add_branch);
 +out:
@@ -3279,7 +3289,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	struct inode *h_inode;
 +
 +	err = 0;
-+	mutex_init(&br->br_xino.xi_nondir_mtx);
++	spin_lock_init(&br->br_xino.xi_nondir.spin);
++	init_waitqueue_head(&br->br_xino.xi_nondir.wqh);
 +	br->br_perm = add->perm;
 +	br->br_path = add->path; /* set first, path_get() later */
 +	spin_lock_init(&br->br_dykey_lock);
@@ -4309,8 +4320,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +}
 diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 --- /usr/share/empty/fs/aufs/branch.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.h	2017-03-02 14:24:13.853588785 +0100
-@@ -0,0 +1,309 @@
++++ linux/fs/aufs/branch.h	2017-05-06 22:16:52.774886674 +0200
+@@ -0,0 +1,321 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -4347,7 +4358,14 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +/* a xino file */
 +struct au_xino_file {
 +	struct file		*xi_file;
-+	struct mutex		xi_nondir_mtx;
++	struct {
++		spinlock_t		spin;
++		ino_t			*array;
++		int			total;
++		/* reserved for future use */
++		/* unsigned long	*bitmap; */
++		wait_queue_head_t	wqh;
++	} xi_nondir;
 +
 +	/* todo: make xino files an array to support huge inode number */
 +
@@ -4546,6 +4564,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +struct file *au_xino_def(struct super_block *sb);
 +int au_xino_path(struct seq_file *seq, struct file *file);
 +
++void au_xinondir_leave(struct super_block *sb, aufs_bindex_t bindex,
++		       ino_t h_ino, int idx);
++int au_xinondir_enter(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
++		      int *idx);
++
 +/* ---------------------------------------------------------------------- */
 +
 +/* Superblock to branch */
@@ -4622,7 +4645,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +#endif /* __AUFS_BRANCH_H__ */
 diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 --- /usr/share/empty/fs/aufs/conf.mk	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/conf.mk	2016-10-09 16:55:36.486034798 +0200
++++ linux/fs/aufs/conf.mk	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,38 @@
 +
 +AuConfStr = CONFIG_AUFS_FS=${CONFIG_AUFS_FS}
@@ -4664,8 +4687,8 @@ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 +-include ${srctree}/${src}/conf_priv.mk
 diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 --- /usr/share/empty/fs/aufs/cpup.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.c	2017-03-02 14:24:13.856922210 +0100
-@@ -0,0 +1,1388 @@
++++ linux/fs/aufs/cpup.c	2017-05-06 22:16:52.774886674 +0200
+@@ -0,0 +1,1407 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -5061,7 +5084,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +			.label = &&out_src
 +		}
 +	};
-+	struct super_block *sb;
++	struct super_block *sb, *h_src_sb;
 +	struct inode *h_src_inode;
 +	struct task_struct *tsk = current;
 +
@@ -5079,9 +5102,28 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +	/* try stopping to update while we copyup */
 +	h_src_inode = d_inode(file[SRC].dentry);
-+	if (!au_test_nfs(h_src_inode->i_sb))
++	h_src_sb = h_src_inode->i_sb;
++	if (!au_test_nfs(h_src_sb))
 +		IMustLock(h_src_inode);
-+	err = au_copy_file(file[DST].file, file[SRC].file, cpg->len);
++
++	if (h_src_sb != file_inode(file[DST].file)->i_sb
++	    || !file[DST].file->f_op->clone_file_range)
++		err = au_copy_file(file[DST].file, file[SRC].file, cpg->len);
++	else {
++		if (!au_test_nfs(h_src_sb)) {
++			inode_unlock(h_src_inode);
++			err = vfsub_clone_file_range(file[SRC].file,
++						     file[DST].file, cpg->len);
++			inode_lock(h_src_inode);
++		} else
++			err = vfsub_clone_file_range(file[SRC].file,
++						     file[DST].file, cpg->len);
++		if (unlikely(err == -EOPNOTSUPP && au_test_nfs(h_src_sb)))
++			/* the backend fs on NFS may not support cloning */
++			err = au_copy_file(file[DST].file, file[SRC].file,
++					   cpg->len);
++		AuTraceErr(err);
++	}
 +
 +	/* i wonder if we had O_NO_DELAY_FPUT flag */
 +	if (tsk->flags & PF_KTHREAD)
@@ -5129,10 +5171,10 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +		h_path.mnt = au_sbr_mnt(cpg->dentry->d_sb, cpg->bsrc);
 +		h_src_attr->iflags = h_src_inode->i_flags;
 +		if (!au_test_nfs(h_src_inode->i_sb))
-+			err = vfs_getattr(&h_path, &h_src_attr->st);
++			err = vfsub_getattr(&h_path, &h_src_attr->st);
 +		else {
 +			inode_unlock(h_src_inode);
-+			err = vfs_getattr(&h_path, &h_src_attr->st);
++			err = vfsub_getattr(&h_path, &h_src_attr->st);
 +			inode_lock_nested(h_src_inode, AuLsc_I_CHILD);
 +		}
 +		if (unlikely(err)) {
@@ -6056,7 +6098,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +}
 diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 --- /usr/share/empty/fs/aufs/cpup.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.h	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/cpup.h	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,94 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -6154,7 +6196,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 +#endif /* __AUFS_CPUP_H__ */
 diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 --- /usr/share/empty/fs/aufs/dbgaufs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dbgaufs.c	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dbgaufs.c	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,438 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -6220,15 +6262,15 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	if (!xf)
 +		goto out;
 +
-+	err = vfs_getattr(&xf->f_path, &st);
++	err = vfsub_getattr(&xf->f_path, &st);
 +	if (!err) {
 +		if (do_fcnt)
 +			p->n = snprintf
-+				(p->a, sizeof(p->a), "%ld, %llux%lu %lld\n",
++				(p->a, sizeof(p->a), "%ld, %llux%u %lld\n",
 +				 (long)file_count(xf), st.blocks, st.blksize,
 +				 (long long)st.size);
 +		else
-+			p->n = snprintf(p->a, sizeof(p->a), "%llux%lu %lld\n",
++			p->n = snprintf(p->a, sizeof(p->a), "%llux%u %lld\n",
 +					st.blocks, st.blksize,
 +					(long long)st.size);
 +		AuDebugOn(p->n >= sizeof(p->a));
@@ -6596,7 +6638,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 --- /usr/share/empty/fs/aufs/dbgaufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dbgaufs.h	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dbgaufs.h	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,48 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -6648,7 +6690,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 +#endif /* __DBGAUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 --- /usr/share/empty/fs/aufs/dcsub.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dcsub.c	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dcsub.c	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,225 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -6877,7 +6919,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 --- /usr/share/empty/fs/aufs/dcsub.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dcsub.h	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dcsub.h	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,136 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -7017,7 +7059,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 +#endif /* __AUFS_DCSUB_H__ */
 diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 --- /usr/share/empty/fs/aufs/debug.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/debug.c	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/debug.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,440 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -7367,7 +7409,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +		return;
 +	dpri("nw %d, gen %u, kobj %d\n",
 +	     atomic_read(&sbinfo->si_nowait.nw_len), sbinfo->si_generation,
-+	     atomic_read(&sbinfo->si_kobj.kref.refcount));
++	     kref_read(&sbinfo->si_kobj.kref));
 +	for (bindex = 0; bindex <= sbinfo->si_bbot; bindex++)
 +		do_pri_br(bindex, sbinfo->si_branch[0 + bindex]);
 +}
@@ -7461,7 +7503,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +}
 diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h
 --- /usr/share/empty/fs/aufs/debug.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/debug.h	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/debug.h	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,225 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -7690,7 +7732,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h
 +#endif /* __AUFS_DEBUG_H__ */
 diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 --- /usr/share/empty/fs/aufs/dentry.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dentry.c	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dentry.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,1130 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -8824,7 +8866,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +};
 diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 --- /usr/share/empty/fs/aufs/dentry.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dentry.h	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dentry.h	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,255 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -9083,7 +9125,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +#endif /* __AUFS_DENTRY_H__ */
 diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 --- /usr/share/empty/fs/aufs/dinfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dinfo.c	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dinfo.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,553 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -9363,11 +9405,11 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +		  || d_inode(d1) == d_inode(d2)
 +		  || d1->d_sb != d2->d_sb);
 +
-+	if (isdir && au_test_subdir(d1, d2)) {
++	if ((isdir && au_test_subdir(d1, d2))
++	    || d1 < d2) {
 +		di_write_lock_child(d1);
 +		di_write_lock_child2(d2);
 +	} else {
-+		/* there should be no races */
 +		di_write_lock_child(d2);
 +		di_write_lock_child2(d1);
 +	}
@@ -9379,11 +9421,11 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +		  || d_inode(d1) == d_inode(d2)
 +		  || d1->d_sb != d2->d_sb);
 +
-+	if (isdir && au_test_subdir(d1, d2)) {
++	if ((isdir && au_test_subdir(d1, d2))
++	    || d1 < d2) {
 +		di_write_lock_parent(d1);
 +		di_write_lock_parent2(d2);
 +	} else {
-+		/* there should be no races */
 +		di_write_lock_parent(d2);
 +		di_write_lock_parent2(d1);
 +	}
@@ -9640,7 +9682,7 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 --- /usr/share/empty/fs/aufs/dir.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.c	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dir.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,762 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -10062,7 +10104,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	struct super_block *sb;
 +	struct inode *inode;
 +
-+	err = au_reval_and_lock_fdi(file, reopen_dir, /*wlock*/1);
++	err = au_reval_and_lock_fdi(file, reopen_dir, /*wlock*/1, /*fi_lsc*/0);
 +	if (unlikely(err))
 +		goto out;
 +
@@ -10131,7 +10173,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +
 +	sb = dentry->d_sb;
 +	si_read_lock(sb, AuLock_FLUSH);
-+	err = au_reval_and_lock_fdi(file, reopen_dir, /*wlock*/1);
++	err = au_reval_and_lock_fdi(file, reopen_dir, /*wlock*/1, /*fi_lsc*/0);
 +	if (unlikely(err))
 +		goto out;
 +	err = au_alive_dir(dentry);
@@ -10406,7 +10448,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +};
 diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 --- /usr/share/empty/fs/aufs/dir.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.h	2017-03-02 14:24:13.856922210 +0100
++++ linux/fs/aufs/dir.h	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,137 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -10547,7 +10589,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +#endif /* __AUFS_DIR_H__ */
 diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 --- /usr/share/empty/fs/aufs/dynop.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/dynop.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,371 @@
 +/*
 + * Copyright (C) 2010-2017 Junjiro R. Okajima
@@ -10922,7 +10964,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 --- /usr/share/empty/fs/aufs/dynop.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.h	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/dynop.h	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,74 @@
 +/*
 + * Copyright (C) 2010-2017 Junjiro R. Okajima
@@ -11000,7 +11042,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 +#endif /* __AUFS_DYNOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 --- /usr/share/empty/fs/aufs/export.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/export.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/export.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,836 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -11840,7 +11882,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +}
 diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c
 --- /usr/share/empty/fs/aufs/fhsm.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/fhsm.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/fhsm.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,426 @@
 +/*
 + * Copyright (C) 2011-2017 Junjiro R. Okajima
@@ -12270,8 +12312,8 @@ diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c
 +}
 diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 --- /usr/share/empty/fs/aufs/file.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.c	2017-03-02 14:24:13.860255635 +0100
-@@ -0,0 +1,857 @@
++++ linux/fs/aufs/file.c	2017-05-06 22:16:52.778220093 +0200
+@@ -0,0 +1,860 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -12994,7 +13036,7 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +
 +/* common function to regular file and dir */
 +int au_reval_and_lock_fdi(struct file *file, int (*reopen)(struct file *file),
-+			  int wlock)
++			  int wlock, unsigned int fi_lsc)
 +{
 +	int err;
 +	unsigned int sigen, figen;
@@ -13007,9 +13049,12 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +	dentry = file->f_path.dentry;
 +	inode = d_inode(dentry);
 +	sigen = au_sigen(dentry->d_sb);
-+	fi_write_lock(file);
++	fi_write_lock_nested(file, fi_lsc);
 +	figen = au_figen(file);
-+	di_write_lock_child(dentry);
++	if (!fi_lsc)
++		di_write_lock_child(dentry);
++	else
++		di_write_lock_child2(dentry);
 +	btop = au_dbtop(dentry);
 +	pseudo_link = (btop != au_ibtop(inode));
 +	if (sigen == figen && !pseudo_link && au_fbtop(file) == btop) {
@@ -13131,8 +13176,8 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +};
 diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 --- /usr/share/empty/fs/aufs/file.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.h	2017-03-02 14:24:13.860255635 +0100
-@@ -0,0 +1,294 @@
++++ linux/fs/aufs/file.h	2017-05-06 22:16:52.778220093 +0200
+@@ -0,0 +1,333 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -13223,7 +13268,7 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +struct au_pin;
 +int au_ready_to_write(struct file *file, loff_t len, struct au_pin *pin);
 +int au_reval_and_lock_fdi(struct file *file, int (*reopen)(struct file *file),
-+			  int wlock);
++			  int wlock, unsigned int fi_lsc);
 +int au_do_flush(struct file *file, fl_owner_t id,
 +		int (*flush)(struct file *file, fl_owner_t id));
 +
@@ -13249,7 +13294,7 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +extern const struct file_operations aufs_file_fop;
 +int au_do_open_nondir(struct file *file, int flags, struct file *h_file);
 +int aufs_release_nondir(struct inode *inode __maybe_unused, struct file *file);
-+struct file *au_read_pre(struct file *file, int keep_fi);
++struct file *au_read_pre(struct file *file, int keep_fi, unsigned int lsc);
 +
 +/* finfo.c */
 +void au_hfput(struct au_hfile *hf, int execed);
@@ -13288,6 +13333,45 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 + */
 +AuSimpleRwsemFuncs(fi, struct file *f, &au_fi(f)->fi_rwsem);
 +
++/* lock subclass for finfo */
++enum {
++	AuLsc_FI_1,
++	AuLsc_FI_2
++};
++
++static inline void fi_read_lock_nested(struct file *f, unsigned int lsc)
++{
++	au_rw_read_lock_nested(&au_fi(f)->fi_rwsem, lsc);
++}
++
++static inline void fi_write_lock_nested(struct file *f, unsigned int lsc)
++{
++	au_rw_write_lock_nested(&au_fi(f)->fi_rwsem, lsc);
++}
++
++/*
++ * fi_read_lock_1, fi_write_lock_1,
++ * fi_read_lock_2, fi_write_lock_2
++ */
++#define AuReadLockFunc(name) \
++static inline void fi_read_lock_##name(struct file *f) \
++{ fi_read_lock_nested(f, AuLsc_FI_##name); }
++
++#define AuWriteLockFunc(name) \
++static inline void fi_write_lock_##name(struct file *f) \
++{ fi_write_lock_nested(f, AuLsc_FI_##name); }
++
++#define AuRWLockFuncs(name) \
++	AuReadLockFunc(name) \
++	AuWriteLockFunc(name)
++
++AuRWLockFuncs(1);
++AuRWLockFuncs(2);
++
++#undef AuReadLockFunc
++#undef AuWriteLockFunc
++#undef AuRWLockFuncs
++
 +#define FiMustNoWaiters(f)	AuRwMustNoWaiters(&au_fi(f)->fi_rwsem)
 +#define FiMustAnyLock(f)	AuRwMustAnyLock(&au_fi(f)->fi_rwsem)
 +#define FiMustWriteLock(f)	AuRwMustWriteLock(&au_fi(f)->fi_rwsem)
@@ -13429,7 +13513,7 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +#endif /* __AUFS_FILE_H__ */
 diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 --- /usr/share/empty/fs/aufs/finfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/finfo.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/finfo.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,151 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -13584,8 +13668,8 @@ diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 --- /usr/share/empty/fs/aufs/f_op.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op.c	2017-03-02 14:24:13.860255635 +0100
-@@ -0,0 +1,723 @@
++++ linux/fs/aufs/f_op.c	2017-05-06 22:16:52.778220093 +0200
+@@ -0,0 +1,819 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -13730,12 +13814,12 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 + */
 +
 +/* Callers should call au_read_post() or fput() in the end */
-+struct file *au_read_pre(struct file *file, int keep_fi)
++struct file *au_read_pre(struct file *file, int keep_fi, unsigned int lsc)
 +{
 +	struct file *h_file;
 +	int err;
 +
-+	err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/0);
++	err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/0, lsc);
 +	if (!err) {
 +		di_read_unlock(file->f_path.dentry, AuLock_IR);
 +		h_file = au_hf_top(file);
@@ -13756,6 +13840,10 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +}
 +
 +struct au_write_pre {
++	/* input */
++	unsigned int lsc;
++
++	/* output */
 +	blkcnt_t blks;
 +	aufs_bindex_t btop;
 +};
@@ -13771,9 +13859,13 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	struct file *h_file;
 +	struct dentry *dentry;
 +	int err;
++	unsigned int lsc;
 +	struct au_pin pin;
 +
-+	err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1);
++	lsc = 0;
++	if (wpre)
++		lsc = wpre->lsc;
++	err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1, lsc);
 +	h_file = ERR_PTR(err);
 +	if (unlikely(err))
 +		goto out;
@@ -13835,7 +13927,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	sb = inode->i_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
-+	h_file = au_read_pre(file, /*keep_fi*/0);
++	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
 +		goto out;
@@ -13885,6 +13977,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	inode = file_inode(file);
 +	au_mtx_and_read_lock(inode);
 +
++	wpre.lsc = 0;
 +	h_file = au_write_pre(file, /*do_ready*/1, &wpre);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
@@ -13944,7 +14037,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	sb = inode->i_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
-+	h_file = au_read_pre(file, /*keep_fi*/1);
++	h_file = au_read_pre(file, /*keep_fi*/1, /*lsc*/0);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
 +		goto out;
@@ -13979,6 +14072,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	inode = file_inode(file);
 +	au_mtx_and_read_lock(inode);
 +
++	wpre.lsc = 0;
 +	h_file = au_write_pre(file, /*do_ready*/1, &wpre);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
@@ -14006,7 +14100,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	sb = inode->i_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
-+	h_file = au_read_pre(file, /*keep_fi*/0);
++	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
 +		goto out;
@@ -14033,6 +14127,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	inode = file_inode(file);
 +	au_mtx_and_read_lock(inode);
 +
++	wpre.lsc = 0;
 +	h_file = au_write_pre(file, /*do_ready*/1, &wpre);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
@@ -14058,6 +14153,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	inode = file_inode(file);
 +	au_mtx_and_read_lock(inode);
 +
++	wpre.lsc = 0;
 +	h_file = au_write_pre(file, /*do_ready*/1, &wpre);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
@@ -14074,6 +14170,88 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	return err;
 +}
 +
++static ssize_t aufs_copy_file_range(struct file *src, loff_t src_pos,
++				    struct file *dst, loff_t dst_pos,
++				    size_t len, unsigned int flags)
++{
++	ssize_t err;
++	struct au_write_pre wpre;
++	enum { SRC, DST };
++	struct {
++		struct inode *inode;
++		struct file *h_file;
++		struct super_block *h_sb;
++	} a[2];
++#define a_src	a[SRC]
++#define a_dst	a[DST]
++
++	err = -EINVAL;
++	a_src.inode = file_inode(src);
++	if (unlikely(!S_ISREG(a_src.inode->i_mode)))
++		goto out;
++	a_dst.inode = file_inode(dst);
++	if (unlikely(!S_ISREG(a_dst.inode->i_mode)))
++		goto out;
++
++	au_mtx_and_read_lock(a_dst.inode);
++	/*
++	 * in order to match the order in di_write_lock2_{child,parent}(),
++	 * use f_path.dentry for this comparision.
++	 */
++	if (src->f_path.dentry < dst->f_path.dentry) {
++		a_src.h_file = au_read_pre(src, /*keep_fi*/1, AuLsc_FI_1);
++		err = PTR_ERR(a_src.h_file);
++		if (IS_ERR(a_src.h_file))
++			goto out_si;
++
++		wpre.lsc = AuLsc_FI_2;
++		a_dst.h_file = au_write_pre(dst, /*do_ready*/1, &wpre);
++		err = PTR_ERR(a_dst.h_file);
++		if (IS_ERR(a_dst.h_file)) {
++			au_read_post(a_src.inode, a_src.h_file);
++			goto out_si;
++		}
++	} else {
++		wpre.lsc = AuLsc_FI_1;
++		a_dst.h_file = au_write_pre(dst, /*do_ready*/1, &wpre);
++		err = PTR_ERR(a_dst.h_file);
++		if (IS_ERR(a_dst.h_file))
++			goto out_si;
++
++		a_src.h_file = au_read_pre(src, /*keep_fi*/1, AuLsc_FI_2);
++		err = PTR_ERR(a_src.h_file);
++		if (IS_ERR(a_src.h_file)) {
++			au_write_post(a_dst.inode, a_dst.h_file, &wpre,
++				      /*written*/0);
++			goto out_si;
++		}
++	}
++
++	err = -EXDEV;
++	a_src.h_sb = file_inode(a_src.h_file)->i_sb;
++	a_dst.h_sb = file_inode(a_dst.h_file)->i_sb;
++	if (unlikely(a_src.h_sb != a_dst.h_sb)) {
++		AuDbgFile(src);
++		AuDbgFile(dst);
++		goto out_file;
++	}
++
++	err = vfsub_copy_file_range(a_src.h_file, src_pos, a_dst.h_file,
++				    dst_pos, len, flags);
++
++out_file:
++	au_write_post(a_dst.inode, a_dst.h_file, &wpre, err);
++	fi_read_unlock(src);
++	au_read_post(a_src.inode, a_src.h_file);
++out_si:
++	si_read_unlock(a_dst.inode->i_sb);
++	inode_unlock(a_dst.inode);
++out:
++	return err;
++#undef a_src
++#undef a_dst
++}
++
 +/* ---------------------------------------------------------------------- */
 +
 +/*
@@ -14164,7 +14342,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	 *			 au_flag_conv(vma->vm_flags));
 +	 */
 +	if (!err)
-+		err = h_file->f_op->mmap(h_file, vma);
++		err = call_mmap(h_file, vma);
 +	if (!err) {
 +		au_vm_prfile_set(vma, file);
 +		fsstack_copy_attr_atime(inode, file_inode(h_file));
@@ -14203,6 +14381,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	inode = file_inode(file);
 +	au_mtx_and_read_lock(inode);
 +
++	wpre.lsc = 0;
 +	h_file = au_write_pre(file, /*do_ready*/1, &wpre);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
@@ -14227,7 +14406,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	sb = file->f_path.dentry->d_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
-+	h_file = au_read_pre(file, /*keep_fi*/0);
++	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
 +		goto out;
@@ -14250,7 +14429,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	sb = file->f_path.dentry->d_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
-+	h_file = au_read_pre(file, /*keep_fi*/0);
++	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
 +		goto out;
@@ -14307,11 +14486,12 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +	.aio_splice_write = aufs_aio_splice_write,
 +	.aio_splice_read  = aufs_aio_splice_read,
 +#endif
-+	.fallocate	= aufs_fallocate
++	.fallocate	= aufs_fallocate,
++	.copy_file_range = aufs_copy_file_range
 +};
 diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 --- /usr/share/empty/fs/aufs/fstype.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/fstype.h	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/fstype.h	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,400 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -14715,7 +14895,7 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +#endif /* __AUFS_FSTYPE_H__ */
 diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 --- /usr/share/empty/fs/aufs/hfsnotify.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsnotify.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/hfsnotify.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,287 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -15006,7 +15186,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 +};
 diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 --- /usr/share/empty/fs/aufs/hfsplus.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsplus.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/hfsplus.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,56 @@
 +/*
 + * Copyright (C) 2010-2017 Junjiro R. Okajima
@@ -15066,7 +15246,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 +}
 diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
 --- /usr/share/empty/fs/aufs/hnotify.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hnotify.c	2017-03-02 14:24:13.860255635 +0100
++++ linux/fs/aufs/hnotify.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,723 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -15793,7 +15973,7 @@ diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
 +}
 diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c
 --- /usr/share/empty/fs/aufs/iinfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/iinfo.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/iinfo.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,285 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -16082,8 +16262,8 @@ diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 --- /usr/share/empty/fs/aufs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.c	2017-03-02 14:24:13.863589061 +0100
-@@ -0,0 +1,519 @@
++++ linux/fs/aufs/inode.c	2017-05-06 22:16:52.781553511 +0200
+@@ -0,0 +1,527 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -16421,32 +16601,34 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +int au_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
 +	   unsigned int d_type, ino_t *ino)
 +{
-+	int err;
-+	struct mutex *mtx;
++	int err, idx;
++	const int isnondir = d_type != DT_DIR;
 +
 +	/* prevent hardlinked inode number from race condition */
-+	mtx = NULL;
-+	if (d_type != DT_DIR) {
-+		mtx = &au_sbr(sb, bindex)->br_xino.xi_nondir_mtx;
-+		mutex_lock(mtx);
++	if (isnondir) {
++		err = au_xinondir_enter(sb, bindex, h_ino, &idx);
++		if (unlikely(err))
++			goto out;
 +	}
++
 +	err = au_xino_read(sb, bindex, h_ino, ino);
 +	if (unlikely(err))
-+		goto out;
++		goto out_xinondir;
 +
 +	if (!*ino) {
 +		err = -EIO;
 +		*ino = au_xino_new_ino(sb);
 +		if (unlikely(!*ino))
-+			goto out;
++			goto out_xinondir;
 +		err = au_xino_write(sb, bindex, h_ino, *ino);
 +		if (unlikely(err))
-+			goto out;
++			goto out_xinondir;
 +	}
 +
++out_xinondir:
++	if (isnondir && idx >= 0)
++		au_xinondir_leave(sb, bindex, h_ino, idx);
 +out:
-+	if (mtx)
-+		mutex_unlock(mtx);
 +	return err;
 +}
 +
@@ -16457,9 +16639,8 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +	struct inode *inode, *h_inode;
 +	struct dentry *h_dentry;
 +	struct super_block *sb;
-+	struct mutex *mtx;
 +	ino_t h_ino, ino;
-+	int err;
++	int err, idx, hlinked;
 +	aufs_bindex_t btop;
 +
 +	sb = dentry->d_sb;
@@ -16467,28 +16648,30 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +	h_dentry = au_h_dptr(dentry, btop);
 +	h_inode = d_inode(h_dentry);
 +	h_ino = h_inode->i_ino;
++	hlinked = !d_is_dir(h_dentry) && h_inode->i_nlink > 1;
 +
++new_ino:
 +	/*
 +	 * stop 'race'-ing between hardlinks under different
 +	 * parents.
 +	 */
-+	mtx = NULL;
-+	if (!d_is_dir(h_dentry))
-+		mtx = &au_sbr(sb, btop)->br_xino.xi_nondir_mtx;
++	if (hlinked) {
++		err = au_xinondir_enter(sb, btop, h_ino, &idx);
++		inode = ERR_PTR(err);
++		if (unlikely(err))
++			goto out;
++	}
 +
-+new_ino:
-+	if (mtx)
-+		mutex_lock(mtx);
 +	err = au_xino_read(sb, btop, h_ino, &ino);
 +	inode = ERR_PTR(err);
 +	if (unlikely(err))
-+		goto out;
++		goto out_xinondir;
 +
 +	if (!ino) {
 +		ino = au_xino_new_ino(sb);
 +		if (unlikely(!ino)) {
 +			inode = ERR_PTR(-EIO);
-+			goto out;
++			goto out_xinondir;
 +		}
 +	}
 +
@@ -16496,7 +16679,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +	inode = au_iget_locked(sb, ino);
 +	err = PTR_ERR(inode);
 +	if (IS_ERR(inode))
-+		goto out;
++		goto out_xinondir;
 +
 +	AuDbg("%lx, new %d\n", inode->i_state, !!(inode->i_state & I_NEW));
 +	if (inode->i_state & I_NEW) {
@@ -16504,7 +16687,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +		err = set_inode(inode, dentry);
 +		if (!err) {
 +			unlock_new_inode(inode);
-+			goto out; /* success */
++			goto out_xinondir; /* success */
 +		}
 +
 +		/*
@@ -16523,19 +16706,23 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +		 * horrible race condition between lookup, readdir and copyup
 +		 * (or something).
 +		 */
-+		if (mtx)
-+			mutex_unlock(mtx);
++		if (hlinked && idx >= 0)
++			au_xinondir_leave(sb, btop, h_ino, idx);
 +		err = reval_inode(inode, dentry);
 +		if (unlikely(err < 0)) {
-+			mtx = NULL;
++			hlinked = 0;
 +			goto out_iput;
 +		}
-+
-+		if (!err) {
-+			mtx = NULL;
++		if (!err)
 +			goto out; /* success */
-+		} else if (mtx)
-+			mutex_lock(mtx);
++		else if (hlinked && idx >= 0) {
++			err = au_xinondir_enter(sb, btop, h_ino, &idx);
++			if (unlikely(err)) {
++				iput(inode);
++				inode = ERR_PTR(err);
++				goto out;
++			}
++		}
 +	}
 +
 +	if (unlikely(au_test_fs_unique_ino(h_inode)))
@@ -16547,17 +16734,18 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +	err = au_xino_write(sb, btop, h_ino, /*ino*/0);
 +	if (!err) {
 +		iput(inode);
-+		if (mtx)
-+			mutex_unlock(mtx);
++		if (hlinked && idx >= 0)
++			au_xinondir_leave(sb, btop, h_ino, idx);
 +		goto new_ino;
 +	}
 +
 +out_iput:
 +	iput(inode);
 +	inode = ERR_PTR(err);
++out_xinondir:
++	if (hlinked && idx >= 0)
++		au_xinondir_leave(sb, btop, h_ino, idx);
 +out:
-+	if (mtx)
-+		mutex_unlock(mtx);
 +	return inode;
 +}
 +
@@ -16605,7 +16793,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +}
 diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 --- /usr/share/empty/fs/aufs/inode.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.h	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/inode.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,692 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -17301,7 +17489,7 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 +#endif /* __AUFS_INODE_H__ */
 diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 --- /usr/share/empty/fs/aufs/ioctl.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/ioctl.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/ioctl.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,219 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -17524,8 +17712,8 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 +#endif
 diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 --- /usr/share/empty/fs/aufs/i_op_add.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_add.c	2017-03-02 14:24:13.863589061 +0100
-@@ -0,0 +1,928 @@
++++ linux/fs/aufs/i_op_add.c	2017-05-06 22:16:52.778220093 +0200
+@@ -0,0 +1,920 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -17983,18 +18171,11 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +		goto out_parent;
 +
 +	h_parent = au_h_dptr(parent, bindex);
-+	err = inode_permission(d_inode(h_parent), MAY_WRITE | MAY_EXEC);
-+	if (unlikely(err))
-+		goto out_mnt;
-+
-+	err = -ENOMEM;
-+	h_dentry = d_alloc(h_parent, &dentry->d_name);
-+	if (unlikely(!h_dentry))
++	h_dentry = vfs_tmpfile(h_parent, mode, /*open_flag*/0);
++	if (IS_ERR(h_dentry)) {
++		err = PTR_ERR(h_dentry);
 +		goto out_mnt;
-+
-+	err = h_dir->i_op->tmpfile(h_dir, h_dentry, mode);
-+	if (unlikely(err))
-+		goto out_dentry;
++	}
 +
 +	au_set_dbtop(dentry, bindex);
 +	au_set_dbbot(dentry, bindex);
@@ -18015,9 +18196,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +		if (au_ibtop(dir) == au_dbtop(dentry))
 +			au_cpup_attr_timesizes(dir);
 +	}
-+
-+out_dentry:
 +	dput(h_dentry);
++
 +out_mnt:
 +	vfsub_mnt_drop_write(h_mnt);
 +out_parent:
@@ -18456,8 +18636,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 --- /usr/share/empty/fs/aufs/i_op.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op.c	2017-03-02 14:24:13.860255635 +0100
-@@ -0,0 +1,1448 @@
++++ linux/fs/aufs/i_op.c	2017-05-06 22:16:52.778220093 +0200
+@@ -0,0 +1,1452 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -19370,7 +19550,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +		/* currently ftruncate(2) only */
 +		AuDebugOn(!d_is_reg(dentry));
 +		file = ia->ia_file;
-+		err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1);
++		err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1,
++					    /*fi_lsc*/0);
 +		if (unlikely(err))
 +			goto out_si;
 +		ia->ia_file = au_hf_top(file);
@@ -19665,15 +19846,17 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +	return err;
 +}
 +
-+static int aufs_getattr(struct vfsmount *mnt __maybe_unused,
-+			struct dentry *dentry, struct kstat *st)
++static int aufs_getattr(const struct path *path, struct kstat *st,
++			u32 request, unsigned int query)
 +{
 +	int err;
 +	unsigned char positive;
 +	struct path h_path;
++	struct dentry *dentry;
 +	struct inode *inode;
 +	struct super_block *sb;
 +
++	dentry = path->dentry;
 +	inode = d_inode(dentry);
 +	sb = dentry->d_sb;
 +	err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM);
@@ -19688,7 +19871,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +
 +	positive = d_is_positive(h_path.dentry);
 +	if (positive)
-+		err = vfs_getattr(&h_path, st);
++		/* no vfsub version */
++		err = vfs_getattr(&h_path, st, request, query);
 +	if (!err) {
 +		if (positive)
 +			au_refresh_iattr(inode, st,
@@ -19908,7 +20092,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +};
 diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 --- /usr/share/empty/fs/aufs/i_op_del.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_del.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/i_op_del.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,511 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -20423,7 +20607,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 --- /usr/share/empty/fs/aufs/i_op_ren.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_ren.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/i_op_ren.c	2017-05-06 22:16:52.778220093 +0200
 @@ -0,0 +1,1165 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -21592,7 +21776,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +}
 diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig
 --- /usr/share/empty/fs/aufs/Kconfig	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/Kconfig	2016-10-09 16:55:36.482701377 +0200
++++ linux/fs/aufs/Kconfig	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,185 @@
 +config AUFS_FS
 +	tristate "Aufs (Advanced multi layered unification filesystem) support"
@@ -21781,7 +21965,7 @@ diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig
 +endif
 diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c
 --- /usr/share/empty/fs/aufs/loop.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/loop.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/loop.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,147 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -21932,7 +22116,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c
 +}
 diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h
 --- /usr/share/empty/fs/aufs/loop.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/loop.h	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/loop.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,52 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -21988,7 +22172,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h
 +#endif /* __AUFS_LOOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk
 --- /usr/share/empty/fs/aufs/magic.mk	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/magic.mk	2016-10-09 16:55:36.492701639 +0200
++++ linux/fs/aufs/magic.mk	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,30 @@
 +
 +# defined in ${srctree}/fs/fuse/inode.c
@@ -22022,7 +22206,7 @@ diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk
 +endif
 diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 --- /usr/share/empty/fs/aufs/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/Makefile	2016-10-09 16:55:36.486034798 +0200
++++ linux/fs/aufs/Makefile	2017-05-06 22:16:52.774886674 +0200
 @@ -0,0 +1,44 @@
 +
 +include ${src}/magic.mk
@@ -22070,7 +22254,7 @@ diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 +aufs-$(CONFIG_AUFS_MAGIC_SYSRQ) += sysrq.o
 diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 --- /usr/share/empty/fs/aufs/module.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/module.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/module.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,333 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -22407,7 +22591,7 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 +module_exit(aufs_exit);
 diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 --- /usr/share/empty/fs/aufs/module.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/module.h	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/module.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,156 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -22567,7 +22751,7 @@ diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 +#endif /* __AUFS_MODULE_H__ */
 diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c
 --- /usr/share/empty/fs/aufs/mvdown.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/mvdown.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/mvdown.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,704 @@
 +/*
 + * Copyright (C) 2011-2017 Junjiro R. Okajima
@@ -23275,7 +23459,7 @@ diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c
 +}
 diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 --- /usr/share/empty/fs/aufs/opts.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.c	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/opts.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,1848 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -25127,7 +25311,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +}
 diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
 --- /usr/share/empty/fs/aufs/opts.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.h	2017-03-02 14:24:13.863589061 +0100
++++ linux/fs/aufs/opts.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,213 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -25344,7 +25528,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
 +#endif /* __AUFS_OPTS_H__ */
 diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 --- /usr/share/empty/fs/aufs/plink.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/plink.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/plink.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,514 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -25862,7 +26046,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +}
 diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 --- /usr/share/empty/fs/aufs/poll.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/poll.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/poll.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,52 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -25900,7 +26084,7 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +	sb = file->f_path.dentry->d_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
-+	h_file = au_read_pre(file, /*keep_fi*/0);
++	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
 +	err = PTR_ERR(h_file);
 +	if (IS_ERR(h_file))
 +		goto out;
@@ -25918,7 +26102,7 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +}
 diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c
 --- /usr/share/empty/fs/aufs/posix_acl.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/posix_acl.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/posix_acl.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,102 @@
 +/*
 + * Copyright (C) 2014-2017 Junjiro R. Okajima
@@ -26024,7 +26208,7 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c
 +}
 diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 --- /usr/share/empty/fs/aufs/procfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/procfs.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/procfs.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,169 @@
 +/*
 + * Copyright (C) 2010-2017 Junjiro R. Okajima
@@ -26197,7 +26381,7 @@ diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
 --- /usr/share/empty/fs/aufs/rdu.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rdu.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/rdu.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,381 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -26582,7 +26766,7 @@ diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
 +#endif
 diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h
 --- /usr/share/empty/fs/aufs/rwsem.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rwsem.h	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/rwsem.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,198 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -26784,7 +26968,7 @@ diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h
 +#endif /* __AUFS_RWSEM_H__ */
 diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 --- /usr/share/empty/fs/aufs/sbinfo.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sbinfo.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/sbinfo.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,304 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -27092,7 +27276,7 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/spl.h linux/fs/aufs/spl.h
 --- /usr/share/empty/fs/aufs/spl.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/spl.h	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/spl.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,113 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -27209,7 +27393,7 @@ diff -urN /usr/share/empty/fs/aufs/spl.h linux/fs/aufs/spl.h
 +#endif /* __AUFS_SPL_H__ */
 diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 --- /usr/share/empty/fs/aufs/super.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/super.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,1044 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -28257,7 +28441,7 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +};
 diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 --- /usr/share/empty/fs/aufs/super.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.h	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/super.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,617 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -28878,7 +29062,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +#endif /* __AUFS_SUPER_H__ */
 diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 --- /usr/share/empty/fs/aufs/sysaufs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysaufs.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/sysaufs.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,104 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -28986,7 +29170,7 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h
 --- /usr/share/empty/fs/aufs/sysaufs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysaufs.h	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/sysaufs.h	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,101 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -29091,7 +29275,7 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h
 +#endif /* __SYSAUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 --- /usr/share/empty/fs/aufs/sysfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysfs.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/sysfs.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,376 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -29471,7 +29655,7 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c
 --- /usr/share/empty/fs/aufs/sysrq.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysrq.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/sysrq.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,157 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -29632,7 +29816,7 @@ diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 --- /usr/share/empty/fs/aufs/vdir.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vdir.c	2017-03-02 14:24:13.866922487 +0100
++++ linux/fs/aufs/vdir.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,900 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -30536,7 +30720,7 @@ diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 --- /usr/share/empty/fs/aufs/vfsub.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.c	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/vfsub.c	2017-05-06 22:16:52.781553511 +0200
 @@ -0,0 +1,899 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -30612,7 +30796,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +	h_sb = h_path->dentry->d_sb;
 +	*did = (!au_test_fs_remote(h_sb) && au_test_fs_refresh_iattr(h_sb));
 +	if (*did)
-+		err = vfs_getattr(h_path, &st);
++		err = vfsub_getattr(h_path, &st);
 +
 +	return err;
 +}
@@ -31439,8 +31623,8 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 --- /usr/share/empty/fs/aufs/vfsub.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.h	2017-03-02 14:24:13.870255912 +0100
-@@ -0,0 +1,318 @@
++++ linux/fs/aufs/vfsub.h	2017-05-06 22:16:52.781553511 +0200
+@@ -0,0 +1,353 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -31709,6 +31893,36 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 +		struct file *h_file);
 +int vfsub_fsync(struct file *file, struct path *path, int datasync);
 +
++/*
++ * re-use branch fs's ioctl(FICLONE) while aufs itself doesn't support such
++ * ioctl.
++ */
++static inline int vfsub_clone_file_range(struct file *src, struct file *dst,
++					 u64 len)
++{
++	int err;
++
++	lockdep_off();
++	err = vfs_clone_file_range(src, 0, dst, 0, len);
++	lockdep_on();
++
++	return err;
++}
++
++/* copy_file_range(2) is a systemcall */
++static inline ssize_t vfsub_copy_file_range(struct file *src, loff_t src_pos,
++					    struct file *dst, loff_t dst_pos,
++					    size_t len, unsigned int flags)
++{
++	ssize_t ssz;
++
++	lockdep_off();
++	ssz = vfs_copy_file_range(src, src_pos, dst, dst_pos, len, flags);
++	lockdep_on();
++
++	return ssz;
++}
++
 +/* ---------------------------------------------------------------------- */
 +
 +static inline loff_t vfsub_llseek(struct file *file, loff_t offset, int origin)
@@ -31732,6 +31946,11 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 +int vfsub_unlink(struct inode *dir, struct path *path,
 +		 struct inode **delegated_inode, int force);
 +
++static inline int vfsub_getattr(const struct path *path, struct kstat *st)
++{
++	return vfs_getattr(path, st, STATX_BASIC_STATS, AT_STATX_SYNC_AS_STAT);
++}
++
 +/* ---------------------------------------------------------------------- */
 +
 +static inline int vfsub_setxattr(struct dentry *dentry, const char *name,
@@ -31761,7 +31980,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 +#endif /* __AUFS_VFSUB_H__ */
 diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 --- /usr/share/empty/fs/aufs/wbr_policy.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wbr_policy.c	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/wbr_policy.c	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,830 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -32595,7 +32814,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +};
 diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 --- /usr/share/empty/fs/aufs/whout.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.c	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/whout.c	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,1061 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -33660,7 +33879,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +}
 diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 --- /usr/share/empty/fs/aufs/whout.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.h	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/whout.h	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,85 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -33749,7 +33968,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 +#endif /* __AUFS_WHOUT_H__ */
 diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 --- /usr/share/empty/fs/aufs/wkq.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wkq.c	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/wkq.c	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,213 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -33966,7 +34185,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 +}
 diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 --- /usr/share/empty/fs/aufs/wkq.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wkq.h	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/wkq.h	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,93 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -34063,7 +34282,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 +#endif /* __AUFS_WKQ_H__ */
 diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c
 --- /usr/share/empty/fs/aufs/xattr.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xattr.c	2017-03-02 14:24:13.870255912 +0100
++++ linux/fs/aufs/xattr.c	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,357 @@
 +/*
 + * Copyright (C) 2014-2017 Junjiro R. Okajima
@@ -34424,8 +34643,8 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c
 +}
 diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 --- /usr/share/empty/fs/aufs/xino.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xino.c	2017-03-02 14:24:13.870255912 +0100
-@@ -0,0 +1,1318 @@
++++ linux/fs/aufs/xino.c	2017-05-06 22:16:52.784886929 +0200
+@@ -0,0 +1,1415 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
@@ -35744,9 +35963,106 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +out:
 +	return err;
 +}
++
++/* ---------------------------------------------------------------------- */
++
++void au_xinondir_leave(struct super_block *sb, aufs_bindex_t bindex,
++		       ino_t h_ino, int idx)
++{
++	struct au_xino_file *xino;
++
++	AuDebugOn(!au_opt_test(au_mntflags(sb), XINO));
++	xino = &au_sbr(sb, bindex)->br_xino;
++	AuDebugOn(idx < 0 || xino->xi_nondir.total <= idx);
++
++	spin_lock(&xino->xi_nondir.spin);
++	AuDebugOn(xino->xi_nondir.array[idx] != h_ino);
++	xino->xi_nondir.array[idx] = 0;
++	spin_unlock(&xino->xi_nondir.spin);
++	wake_up_all(&xino->xi_nondir.wqh);
++}
++
++static int au_xinondir_find(struct au_xino_file *xino, ino_t h_ino)
++{
++	int found, total, i;
++
++	found = -1;
++	total = xino->xi_nondir.total;
++	for (i = 0; i < total; i++) {
++		if (xino->xi_nondir.array[i] != h_ino)
++			continue;
++		found = i;
++		break;
++	}
++
++	return found;
++}
++
++static int au_xinondir_expand(struct au_xino_file *xino)
++{
++	int err, sz;
++	ino_t *p;
++
++	BUILD_BUG_ON(KMALLOC_MAX_SIZE > INT_MAX);
++
++	err = -ENOMEM;
++	sz = xino->xi_nondir.total * sizeof(ino_t);
++	if (unlikely(sz > KMALLOC_MAX_SIZE / 2))
++		goto out;
++	p = au_kzrealloc(xino->xi_nondir.array, sz, sz << 1, GFP_ATOMIC,
++			 /*may_shrink*/0);
++	if (p) {
++		xino->xi_nondir.array = p;
++		xino->xi_nondir.total <<= 1;
++		AuDbg("xi_nondir.total %d\n", xino->xi_nondir.total);
++		err = 0;
++	}
++
++out:
++	return err;
++}
++
++int au_xinondir_enter(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
++		      int *idx)
++{
++	int err, found, empty;
++	struct au_xino_file *xino;
++
++	err = 0;
++	*idx = -1;
++	if (!au_opt_test(au_mntflags(sb), XINO))
++		goto out; /* no xino */
++
++	xino = &au_sbr(sb, bindex)->br_xino;
++
++again:
++	spin_lock(&xino->xi_nondir.spin);
++	found = au_xinondir_find(xino, h_ino);
++	if (found == -1) {
++		empty = au_xinondir_find(xino, /*h_ino*/0);
++		if (empty == -1) {
++			empty = xino->xi_nondir.total;
++			err = au_xinondir_expand(xino);
++			if (unlikely(err))
++				goto out_unlock;
++		}
++		xino->xi_nondir.array[empty] = h_ino;
++		*idx = empty;
++	} else {
++		spin_unlock(&xino->xi_nondir.spin);
++		wait_event(xino->xi_nondir.wqh,
++			   xino->xi_nondir.array[found] != h_ino);
++		goto again;
++	}
++
++out_unlock:
++	spin_unlock(&xino->xi_nondir.spin);
++out:
++	return err;
++}
 diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/linux/aufs_type.h
 --- /usr/share/empty/include/uapi/linux/aufs_type.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/uapi/linux/aufs_type.h	2017-03-02 14:24:13.870255912 +0100
++++ linux/include/uapi/linux/aufs_type.h	2017-05-06 22:16:52.784886929 +0200
 @@ -0,0 +1,419 @@
 +/*
 + * Copyright (C) 2005-2017 Junjiro R. Okajima
@@ -35789,7 +36105,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +
 +#include <linux/limits.h>
 +
-+#define AUFS_VERSION	"4.x-rcN-20170220"
++#define AUFS_VERSION	"4.x-rcN-20170410"
 +
 +/* todo? move this to linux-2.6.19/include/magic.h */
 +#define AUFS_SUPER_MAGIC	('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
@@ -36170,7 +36486,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 aufs4.x-rcN loopback patch
 
 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index b63f68b..c0f4b8c 100644
+index cf39138..29b33b2 100644
 --- a/drivers/block/loop.c
 +++ b/drivers/block/loop.c
 @@ -551,7 +551,7 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)
@@ -36349,10 +36665,10 @@ index fb2237c..c3888c5 100644
  	unsigned	lo_blocksize;
  	void		*key_data; 
 diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c
-index 6da0f10..d211f9e 100644
+index 7e03507..f31af1d 100644
 --- a/fs/aufs/f_op.c
 +++ b/fs/aufs/f_op.c
-@@ -351,7 +351,7 @@ static ssize_t aufs_read_iter(struct kiocb *kio, struct iov_iter *iov_iter)
+@@ -360,7 +360,7 @@ static ssize_t aufs_read_iter(struct kiocb *kio, struct iov_iter *iov_iter)
  	if (IS_ERR(h_file))
  		goto out;
  
@@ -36427,10 +36743,10 @@ index 0e9bbc3..b90d52f 100644
  
  /* ---------------------------------------------------------------------- */
 diff --git a/include/linux/fs.h b/include/linux/fs.h
-index a808c7c..214b51f 100644
+index 3668627..2cbc8fe 100644
 --- a/include/linux/fs.h
 +++ b/include/linux/fs.h
-@@ -1791,6 +1791,10 @@ struct super_operations {
+@@ -1810,6 +1810,10 @@ struct super_operations {
  				  struct shrink_control *);
  	long (*free_cached_objects)(struct super_block *,
  				    struct shrink_control *);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel.git/commitdiff/521ced186fdfe27c112e57dac8af155cddf13974



More information about the pld-cvs-commit mailing list