[packages/kernel/LINUX_4_1] - rel 2; fix build with gcc 7; update aufs4

arekm arekm at pld-linux.org
Wed Sep 13 13:09:18 CEST 2017


commit 98a46a8c9ef0a8dd1e294bf7d5b96fb2f995b403
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Sep 13 13:09:06 2017 +0200

    - rel 2; fix build with gcc 7; update aufs4

 kernel-aufs4.patch       | 4251 ++++++++++++++++++++++++++--------------------
 kernel-small_fixes.patch |  121 ++
 kernel.spec              |    5 +-
 3 files changed, 2518 insertions(+), 1859 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index ede6cf2d..573076e6 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -71,7 +71,7 @@
 %define		have_pcmcia	0
 %endif
 
-%define		rel		2
+%define		rel		3
 %define		basever		4.1
 %define		postver		.43
 
@@ -204,8 +204,7 @@ Patch101:	kernel-vserver-fixes.patch
 # cat aufs4-kbuild.patch aufs4-base.patch aufs4-mmap.patch aufs4-standalone.patch > ~/rpm/packages/kernel/kernel-aufs4.patch
 # mkdir linux
 # cp -a Documentation fs include linux
-# diff -urN /usr/share/empty linux >> ~/rpm/packages/kernel/kernel-aufs4.patch
-# drop hunk at the end of patch (hunk is patching include/linux/Kbuild with single line change)
+# diff -urN /usr/share/empty linux | filterdiff -x linux/include/uapi/linux/Kbuild >> ~/rpm/packages/kernel/kernel-aufs4.patch
 # cat aufs4-loopback.patch >> ~/rpm/packages/kernel/kernel-aufs4.patch
 #
 Patch145:	kernel-aufs4.patch
diff --git a/kernel-aufs4.patch b/kernel-aufs4.patch
index 48b25432..3005c823 100644
--- a/kernel-aufs4.patch
+++ b/kernel-aufs4.patch
@@ -1,4 +1,4 @@
-aufs4.1 kbuild patch
+aufs4.1.13+ kbuild patch
 
 diff --git a/fs/Kconfig b/fs/Kconfig
 index 011f433..b1083f6 100644
@@ -33,7 +33,7 @@ index 1a0006a..ddad01a 100644
  header-y += auto_fs4.h
  header-y += auto_fs.h
  header-y += auxvec.h
-aufs4.1 base patch
+aufs4.1.13+ base patch
 
 diff --git a/MAINTAINERS b/MAINTAINERS
 index d8afd29..feac5ea 100644
@@ -60,10 +60,10 @@ index d8afd29..feac5ea 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 d7173cb..0160952 100644
+index cef6fa8..20fc2be 100644
 --- a/drivers/block/loop.c
 +++ b/drivers/block/loop.c
-@@ -540,6 +540,24 @@ static inline int is_loop_device(struct file *file)
+@@ -538,6 +538,24 @@ static inline int is_loop_device(struct file *file)
  	return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
  }
  
@@ -83,16 +83,16 @@ index d7173cb..0160952 100644
 +	}
 +	return ret;
 +}
-+EXPORT_SYMBOL(loop_backing_file);
++EXPORT_SYMBOL_GPL(loop_backing_file);
 +
  /* loop sysfs attributes */
  
  static ssize_t loop_attr_show(struct device *dev, char *page,
 diff --git a/fs/dcache.c b/fs/dcache.c
-index 37b5afd..bc261e2 100644
+index 0046ab7..23bdfa1 100644
 --- a/fs/dcache.c
 +++ b/fs/dcache.c
-@@ -1164,7 +1164,7 @@ enum d_walk_ret {
+@@ -1167,7 +1167,7 @@ enum d_walk_ret {
   *
   * The @enter() and @finish() callbacks are called with d_lock held.
   */
@@ -101,6 +101,41 @@ index 37b5afd..bc261e2 100644
  		   enum d_walk_ret (*enter)(void *, struct dentry *),
  		   void (*finish)(void *))
  {
+diff --git a/fs/fcntl.c b/fs/fcntl.c
+index ee85cd4..dacbf71 100644
+--- a/fs/fcntl.c
++++ b/fs/fcntl.c
+@@ -29,7 +29,7 @@
+ 
+ #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
+ 
+-static int setfl(int fd, struct file * filp, unsigned long arg)
++int setfl(int fd, struct file * filp, unsigned long arg)
+ {
+ 	struct inode * inode = file_inode(filp);
+ 	int error = 0;
+@@ -59,6 +59,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);
++	if (!error && filp->f_op->setfl)
++		error = filp->f_op->setfl(filp, arg);
+ 	if (error)
+ 		return error;
+ 
+diff --git a/fs/inode.c b/fs/inode.c
+index 6e342ca..a3b268c 100644
+--- a/fs/inode.c
++++ b/fs/inode.c
+@@ -1566,7 +1566,7 @@ EXPORT_SYMBOL(generic_update_time);
+  * This does the actual work of updating an inodes time or version.  Must have
+  * had called mnt_want_write() before calling this.
+  */
+-static int update_time(struct inode *inode, struct timespec *time, int flags)
++int update_time(struct inode *inode, struct timespec *time, int flags)
+ {
+ 	int (*update_time)(struct inode *, struct timespec *, int);
+ 
 diff --git a/fs/read_write.c b/fs/read_write.c
 index 819ef3f..fd0414e 100644
 --- a/fs/read_write.c
@@ -162,6 +197,19 @@ index bfe62ae..fa5eee5 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 fbc98ee..b8a9541a 100644
+--- a/fs/sync.c
++++ b/fs/sync.c
+@@ -27,7 +27,7 @@
+  * wait == 1 case since in that case write_inode() functions do
+  * sync_dirty_buffer() and thus effectively write one block at a time.
+  */
+-static int __sync_filesystem(struct super_block *sb, int wait)
++int __sync_filesystem(struct super_block *sb, int wait)
+ {
+ 	if (wait)
+ 		sync_inodes_sb(sb);
 diff --git a/include/linux/file.h b/include/linux/file.h
 index f87d308..9a290b3 100644
 --- a/include/linux/file.h
@@ -175,10 +223,26 @@ index f87d308..9a290b3 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 35ec87e..3229f97 100644
+index fdc369f..3185e76 100644
 --- a/include/linux/fs.h
 +++ b/include/linux/fs.h
-@@ -1649,6 +1649,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
+@@ -1229,6 +1229,7 @@ extern void fasync_free(struct fasync_struct *);
+ /* can be called from interrupts */
+ extern void kill_fasync(struct fasync_struct **, int, int);
+ 
++extern int setfl(int fd, struct file * filp, unsigned long arg);
+ 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);
+@@ -1608,6 +1609,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);
++	int (*setfl)(struct file *, unsigned long);
+ 	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);
+@@ -1663,6 +1665,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
  			      struct iovec *fast_pointer,
  			      struct iovec **ret_pointer);
  
@@ -191,6 +255,22 @@ index 35ec87e..3229f97 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 *);
+@@ -2005,6 +2013,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);
++extern int update_time(struct inode *, struct timespec *, int);
+ 
+ /* /sys/fs */
+ extern struct kobject *fs_kobj;
+@@ -2274,6 +2283,7 @@ static inline int sb_is_blkdev_sb(struct super_block *sb)
+ 	return 0;
+ }
+ #endif
++extern int __sync_filesystem(struct super_block *, int);
+ extern int sync_filesystem(struct super_block *);
+ extern const struct file_operations def_blk_fops;
+ extern const struct file_operations def_chr_fops;
 diff --git a/include/linux/splice.h b/include/linux/splice.h
 index da2751d..2e0fca6 100644
 --- a/include/linux/splice.h
@@ -206,7 +286,7 @@ index da2751d..2e0fca6 100644
 +			 struct pipe_inode_info *pipe, size_t len,
 +			 unsigned int flags);
  #endif
-aufs4.1 mmap patch
+aufs4.1.13+ mmap patch
 
 diff --git a/fs/buffer.c b/fs/buffer.c
 index c7a5602..8c50a22 100644
@@ -292,10 +372,10 @@ index 599ec2e..1740207 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 0755b9f..2ee5500 100644
+index b208558..bda1930 100644
 --- a/include/linux/mm.h
 +++ b/include/linux/mm.h
-@@ -1172,6 +1172,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
+@@ -1200,6 +1200,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
  }
  #endif
  
@@ -325,10 +405,10 @@ index 0755b9f..2ee5500 100644
  extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
  		void *buf, int len, int write);
 diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
-index 8d37e26..ce89d4c 100644
+index c0c6b33..e65090c 100644
 --- a/include/linux/mm_types.h
 +++ b/include/linux/mm_types.h
-@@ -241,6 +241,7 @@ struct vm_region {
+@@ -232,6 +232,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 */
@@ -336,7 +416,7 @@ index 8d37e26..ce89d4c 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
-@@ -305,6 +306,7 @@ struct vm_area_struct {
+@@ -296,6 +297,7 @@ struct vm_area_struct {
  	unsigned long vm_pgoff;		/* Offset (within vm_file) in PAGE_SIZE
  					   units, *not* PAGE_CACHE_SIZE */
  	struct file * vm_file;		/* File we map to (can be NULL). */
@@ -345,7 +425,7 @@ index 8d37e26..ce89d4c 100644
  
  #ifndef CONFIG_MMU
 diff --git a/kernel/fork.c b/kernel/fork.c
-index 03c1eaa..7e215ba 100644
+index 8209fa2..7c655e8 100644
 --- a/kernel/fork.c
 +++ b/kernel/fork.c
 @@ -456,7 +456,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
@@ -371,7 +451,7 @@ index 98c4eae..3f0c9b9 100644
  obj-y += init-mm.o
  
 diff --git a/mm/filemap.c b/mm/filemap.c
-index 6bf5e42..a863d0f 100644
+index 1ffef05..13a1981 100644
 --- a/mm/filemap.c
 +++ b/mm/filemap.c
 @@ -2062,7 +2062,7 @@ int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
@@ -384,7 +464,7 @@ index 6bf5e42..a863d0f 100644
  	if (page->mapping != inode->i_mapping) {
  		unlock_page(page);
 diff --git a/mm/memory.c b/mm/memory.c
-index 22e037e..62096a2 100644
+index 2a9e098..2a8d5ec 100644
 --- a/mm/memory.c
 +++ b/mm/memory.c
 @@ -2034,7 +2034,7 @@ static inline int wp_page_reuse(struct mm_struct *mm,
@@ -397,7 +477,7 @@ index 22e037e..62096a2 100644
  
  	return VM_FAULT_WRITE;
 diff --git a/mm/mmap.c b/mm/mmap.c
-index bb50cac..1ab5e596 100644
+index bb50cac..9019a83 100644
 --- a/mm/mmap.c
 +++ b/mm/mmap.c
 @@ -274,7 +274,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
@@ -446,28 +526,45 @@ index bb50cac..1ab5e596 100644
  	unlink_anon_vmas(new);
   out_free_mpol:
  	mpol_put(vma_policy(new));
-@@ -2635,7 +2635,6 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2635,7 +2635,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;
 -	struct file *file;
++	struct file *file, *prfile;
  
  	pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. "
  			"See Documentation/vm/remap_file_pages.txt.\n",
-@@ -2679,10 +2678,10 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2679,10 +2679,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
  		munlock_vma_pages_range(vma, start, start + size);
  	}
  
 -	file = get_file(vma->vm_file);
 +	vma_get_file(vma);
++	file = vma->vm_file;
++	prfile = vma->vm_prfile;
  	ret = do_mmap_pgoff(vma->vm_file, start, size,
  			prot, flags, pgoff, &populate);
--	fput(file);
-+	vma_fput(vma);
++	if (!IS_ERR_VALUE(ret) && file && prfile) {
++		struct vm_area_struct *new_vma;
++
++		new_vma = find_vma(mm, ret);
++		if (!new_vma->vm_prfile)
++			new_vma->vm_prfile = prfile;
++		if (new_vma != vma)
++			get_file(prfile);
++	}
++	/*
++	 * two fput()s instead of vma_fput(vma),
++	 * coz vma may not be available anymore.
++	 */
+ 	fput(file);
++	if (prfile)
++		fput(prfile);
  out:
  	up_write(&mm->mmap_sem);
  	if (populate)
-@@ -2949,7 +2948,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+@@ -2949,7 +2966,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)
@@ -612,29 +709,41 @@ index 0000000..b323b8a
 +		fput(pr);
 +}
 +#endif /* !CONFIG_MMU */
-aufs4.1 standalone patch
+aufs4.1.13+ standalone patch
 
 diff --git a/fs/dcache.c b/fs/dcache.c
-index bc261e2..8d7951d 100644
+index 23bdfa1..00fbc3d 100644
 --- a/fs/dcache.c
 +++ b/fs/dcache.c
-@@ -1269,6 +1269,7 @@ rename_retry:
+@@ -1272,6 +1272,7 @@ rename_retry:
  	seq = 1;
  	goto again;
  }
-+EXPORT_SYMBOL(d_walk);
++EXPORT_SYMBOL_GPL(d_walk);
  
  /*
   * Search for at least 1 mount point in the dentry's subdirs.
+diff --git a/fs/fcntl.c b/fs/fcntl.c
+index dacbf71..8abb9f81 100644
+--- a/fs/fcntl.c
++++ b/fs/fcntl.c
+@@ -81,6 +81,7 @@ int setfl(int fd, struct file * filp, unsigned long arg)
+  out:
+ 	return error;
+ }
++EXPORT_SYMBOL_GPL(setfl);
+ 
+ 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 294174d..a3c818d 100644
+index 294174d..ccf2b15 100644
 --- a/fs/file_table.c
 +++ b/fs/file_table.c
 @@ -147,6 +147,7 @@ over:
  	}
  	return ERR_PTR(-ENFILE);
  }
-+EXPORT_SYMBOL(get_empty_filp);
++EXPORT_SYMBOL_GPL(get_empty_filp);
  
  /**
   * alloc_file - allocate and initialize a 'struct file'
@@ -642,7 +751,7 @@ index 294174d..a3c818d 100644
  {
  	delayed_fput(NULL);
  }
-+EXPORT_SYMBOL(flush_delayed_fput);
++EXPORT_SYMBOL_GPL(flush_delayed_fput);
  
  static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);
  
@@ -650,7 +759,7 @@ index 294174d..a3c818d 100644
  }
  
  EXPORT_SYMBOL(fput);
-+EXPORT_SYMBOL(__fput_sync);
++EXPORT_SYMBOL_GPL(__fput_sync);
  
  void put_filp(struct file *file)
  {
@@ -658,24 +767,32 @@ index 294174d..a3c818d 100644
  		file_free(file);
  	}
  }
-+EXPORT_SYMBOL(put_filp);
++EXPORT_SYMBOL_GPL(put_filp);
  
  void __init files_init(unsigned long mempages)
  { 
 diff --git a/fs/inode.c b/fs/inode.c
-index ea37cd1..58f5f58 100644
+index a3b268c..0f1cd14 100644
 --- a/fs/inode.c
 +++ b/fs/inode.c
 @@ -58,6 +58,7 @@ static struct hlist_head *inode_hashtable __read_mostly;
  static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock);
  
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_sb_list_lock);
-+EXPORT_SYMBOL(inode_sb_list_lock);
++EXPORT_SYMBOL_GPL(inode_sb_list_lock);
  
  /*
   * Empty aops. Can be used for the cases where the user does not
+@@ -1575,6 +1576,7 @@ int update_time(struct inode *inode, struct timespec *time, int flags)
+ 
+ 	return update_time(inode, time, flags);
+ }
++EXPORT_SYMBOL_GPL(update_time);
+ 
+ /**
+  *	touch_atime	-	update the access time
 diff --git a/fs/namespace.c b/fs/namespace.c
-index 1b9e111..d45b81b 100644
+index fce3cc1..c138902 100644
 --- a/fs/namespace.c
 +++ b/fs/namespace.c
 @@ -463,6 +463,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
@@ -686,16 +803,16 @@ index 1b9e111..d45b81b 100644
  
  /**
   * mnt_drop_write - give up write access to a mount
-@@ -1768,6 +1769,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+@@ -1792,6 +1793,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
  	}
  	return 0;
  }
-+EXPORT_SYMBOL(iterate_mounts);
++EXPORT_SYMBOL_GPL(iterate_mounts);
  
  static void cleanup_group_ids(struct mount *mnt, struct mount *end)
  {
 diff --git a/fs/notify/group.c b/fs/notify/group.c
-index d16b62c..06ca6bc 100644
+index d16b62c..53e45b6 100644
 --- a/fs/notify/group.c
 +++ b/fs/notify/group.c
 @@ -22,6 +22,7 @@
@@ -710,7 +827,7 @@ index d16b62c..06ca6bc 100644
  {
  	atomic_inc(&group->refcnt);
  }
-+EXPORT_SYMBOL(fsnotify_get_group);
++EXPORT_SYMBOL_GPL(fsnotify_get_group);
  
  /*
   * Drop a reference to a group.  Free it if it's through.
@@ -718,7 +835,7 @@ index d16b62c..06ca6bc 100644
  	if (atomic_dec_and_test(&group->refcnt))
  		fsnotify_final_destroy_group(group);
  }
-+EXPORT_SYMBOL(fsnotify_put_group);
++EXPORT_SYMBOL_GPL(fsnotify_put_group);
  
  /*
   * Create a new fsnotify_group and hold a reference for the group returned.
@@ -726,19 +843,19 @@ index d16b62c..06ca6bc 100644
  
  	return group;
  }
-+EXPORT_SYMBOL(fsnotify_alloc_group);
++EXPORT_SYMBOL_GPL(fsnotify_alloc_group);
  
  int fsnotify_fasync(int fd, struct file *file, int on)
  {
 diff --git a/fs/notify/mark.c b/fs/notify/mark.c
-index 92e48c7..d2c4b68 100644
+index 39ddcaf..11523fa 100644
 --- a/fs/notify/mark.c
 +++ b/fs/notify/mark.c
 @@ -109,6 +109,7 @@ void fsnotify_put_mark(struct fsnotify_mark *mark)
  		mark->free_mark(mark);
  	}
  }
-+EXPORT_SYMBOL(fsnotify_put_mark);
++EXPORT_SYMBOL_GPL(fsnotify_put_mark);
  
  /* Calculate mask of events for a list of marks */
  u32 fsnotify_recalc_mask(struct hlist_head *head)
@@ -746,7 +863,7 @@ index 92e48c7..d2c4b68 100644
  	fsnotify_destroy_mark_locked(mark, group);
  	mutex_unlock(&group->mark_mutex);
  }
-+EXPORT_SYMBOL(fsnotify_destroy_mark);
++EXPORT_SYMBOL_GPL(fsnotify_destroy_mark);
  
  /*
   * Destroy all marks in the given list. The marks must be already detached from
@@ -754,27 +871,27 @@ index 92e48c7..d2c4b68 100644
  
  	return ret;
  }
-+EXPORT_SYMBOL(fsnotify_add_mark);
++EXPORT_SYMBOL_GPL(fsnotify_add_mark);
  
  int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
  		      struct inode *inode, struct vfsmount *mnt, int allow_dups)
-@@ -455,6 +458,7 @@ void fsnotify_init_mark(struct fsnotify_mark *mark,
+@@ -475,6 +478,7 @@ void fsnotify_init_mark(struct fsnotify_mark *mark,
  	atomic_set(&mark->refcnt, 1);
  	mark->free_mark = free_mark;
  }
-+EXPORT_SYMBOL(fsnotify_init_mark);
++EXPORT_SYMBOL_GPL(fsnotify_init_mark);
  
  static int fsnotify_mark_destroy(void *ignored)
  {
 diff --git a/fs/open.c b/fs/open.c
-index 98e5a52..a94e2e7 100644
+index f9d2bf9..6c74bd2 100644
 --- a/fs/open.c
 +++ b/fs/open.c
 @@ -62,6 +62,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
  	mutex_unlock(&dentry->d_inode->i_mutex);
  	return ret;
  }
-+EXPORT_SYMBOL(do_truncate);
++EXPORT_SYMBOL_GPL(do_truncate);
  
  long vfs_truncate(struct path *path, loff_t length)
  {
@@ -782,19 +899,19 @@ index 98e5a52..a94e2e7 100644
  	}
  	return 0;
  }
-+EXPORT_SYMBOL(open_check_o_direct);
++EXPORT_SYMBOL_GPL(open_check_o_direct);
  
  static int do_dentry_open(struct file *f,
- 			  int (*open)(struct inode *, struct file *),
+ 			  struct inode *inode,
 diff --git a/fs/read_write.c b/fs/read_write.c
-index fd0414e..8ace6ec 100644
+index fd0414e..0a28933 100644
 --- a/fs/read_write.c
 +++ b/fs/read_write.c
 @@ -504,6 +504,7 @@ vfs_readf_t vfs_readf(struct file *file)
  		return new_sync_read;
  	return ERR_PTR(-ENOSYS);
  }
-+EXPORT_SYMBOL(vfs_readf);
++EXPORT_SYMBOL_GPL(vfs_readf);
  
  vfs_writef_t vfs_writef(struct file *file)
  {
@@ -802,19 +919,19 @@ index fd0414e..8ace6ec 100644
  		return new_sync_write;
  	return ERR_PTR(-ENOSYS);
  }
-+EXPORT_SYMBOL(vfs_writef);
++EXPORT_SYMBOL_GPL(vfs_writef);
  
  ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
  {
 diff --git a/fs/splice.c b/fs/splice.c
-index fa5eee5..bfb3324 100644
+index fa5eee5..8cf380e 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
 @@ -1114,6 +1114,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  
  	return splice_write(pipe, out, ppos, len, flags);
  }
-+EXPORT_SYMBOL(do_splice_from);
++EXPORT_SYMBOL_GPL(do_splice_from);
  
  /*
   * Attempt to initiate a splice from a file to a pipe.
@@ -822,49 +939,61 @@ index fa5eee5..bfb3324 100644
  
  	return splice_read(in, ppos, pipe, len, flags);
  }
-+EXPORT_SYMBOL(do_splice_to);
++EXPORT_SYMBOL_GPL(do_splice_to);
  
  /**
   * splice_direct_to_actor - splices data directly between two non-pipes
+diff --git a/fs/sync.c b/fs/sync.c
+index b8a9541a..cdf1eca 100644
+--- a/fs/sync.c
++++ b/fs/sync.c
+@@ -38,6 +38,7 @@ int __sync_filesystem(struct super_block *sb, int wait)
+ 		sb->s_op->sync_fs(sb, wait);
+ 	return __sync_blockdev(sb->s_bdev, wait);
+ }
++EXPORT_SYMBOL_GPL(__sync_filesystem);
+ 
+ /*
+  * Write out and wait upon all dirty data associated with this
 diff --git a/fs/xattr.c b/fs/xattr.c
-index 4ef6985..6bb6303 100644
+index 4ef6985..ed801c7 100644
 --- a/fs/xattr.c
 +++ b/fs/xattr.c
 @@ -207,6 +207,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
  	*xattr_value = value;
  	return error;
  }
-+EXPORT_SYMBOL(vfs_getxattr_alloc);
++EXPORT_SYMBOL_GPL(vfs_getxattr_alloc);
  
  /* Compare an extended attribute value with the given value */
  int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
 diff --git a/kernel/task_work.c b/kernel/task_work.c
-index 8727032..7003e5a 100644
+index 8727032..e7279d1 100644
 --- a/kernel/task_work.c
 +++ b/kernel/task_work.c
 @@ -126,3 +126,4 @@ void task_work_run(void)
  		} while (work);
  	}
  }
-+EXPORT_SYMBOL(task_work_run);
++EXPORT_SYMBOL_GPL(task_work_run);
 diff --git a/security/commoncap.c b/security/commoncap.c
-index f2875cd..ebf06ec 100644
+index f2875cd..becd5fd 100644
 --- a/security/commoncap.c
 +++ b/security/commoncap.c
 @@ -975,9 +975,11 @@ int cap_mmap_addr(unsigned long addr)
  	}
  	return ret;
  }
-+EXPORT_SYMBOL(cap_mmap_addr);
++EXPORT_SYMBOL_GPL(cap_mmap_addr);
  
  int cap_mmap_file(struct file *file, unsigned long reqprot,
  		  unsigned long prot, unsigned long flags)
  {
  	return 0;
  }
-+EXPORT_SYMBOL(cap_mmap_file);
++EXPORT_SYMBOL_GPL(cap_mmap_file);
 diff --git a/security/device_cgroup.c b/security/device_cgroup.c
-index 188c1d2..426d9af 100644
+index 188c1d2..6bc2fa5 100644
 --- a/security/device_cgroup.c
 +++ b/security/device_cgroup.c
 @@ -7,6 +7,7 @@
@@ -879,19 +1008,19 @@ index 188c1d2..426d9af 100644
  	return __devcgroup_check_permission(type, imajor(inode), iminor(inode),
  			access);
  }
-+EXPORT_SYMBOL(__devcgroup_inode_permission);
++EXPORT_SYMBOL_GPL(__devcgroup_inode_permission);
  
  int devcgroup_inode_mknod(int mode, dev_t dev)
  {
 diff --git a/security/security.c b/security/security.c
-index 8e9b1f4..c1c7cd1 100644
+index 8e9b1f4..6ad423d 100644
 --- a/security/security.c
 +++ b/security/security.c
 @@ -430,6 +430,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
  		return 0;
  	return security_ops->path_rmdir(dir, dentry);
  }
-+EXPORT_SYMBOL(security_path_rmdir);
++EXPORT_SYMBOL_GPL(security_path_rmdir);
  
  int security_path_unlink(struct path *dir, struct dentry *dentry)
  {
@@ -899,7 +1028,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->path_symlink(dir, dentry, old_name);
  }
-+EXPORT_SYMBOL(security_path_symlink);
++EXPORT_SYMBOL_GPL(security_path_symlink);
  
  int security_path_link(struct dentry *old_dentry, struct path *new_dir,
  		       struct dentry *new_dentry)
@@ -907,7 +1036,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->path_link(old_dentry, new_dir, new_dentry);
  }
-+EXPORT_SYMBOL(security_path_link);
++EXPORT_SYMBOL_GPL(security_path_link);
  
  int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
  			 struct path *new_dir, struct dentry *new_dentry,
@@ -915,7 +1044,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->path_truncate(path);
  }
-+EXPORT_SYMBOL(security_path_truncate);
++EXPORT_SYMBOL_GPL(security_path_truncate);
  
  int security_path_chmod(struct path *path, umode_t mode)
  {
@@ -923,7 +1052,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->path_chmod(path, mode);
  }
-+EXPORT_SYMBOL(security_path_chmod);
++EXPORT_SYMBOL_GPL(security_path_chmod);
  
  int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
  {
@@ -931,7 +1060,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->path_chown(path, uid, gid);
  }
-+EXPORT_SYMBOL(security_path_chown);
++EXPORT_SYMBOL_GPL(security_path_chown);
  
  int security_path_chroot(struct path *path)
  {
@@ -939,7 +1068,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->inode_readlink(dentry);
  }
-+EXPORT_SYMBOL(security_inode_readlink);
++EXPORT_SYMBOL_GPL(security_inode_readlink);
  
  int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd)
  {
@@ -947,7 +1076,7 @@ index 8e9b1f4..c1c7cd1 100644
  		return 0;
  	return security_ops->inode_permission(inode, mask);
  }
-+EXPORT_SYMBOL(security_inode_permission);
++EXPORT_SYMBOL_GPL(security_inode_permission);
  
  int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
  {
@@ -955,7 +1084,7 @@ index 8e9b1f4..c1c7cd1 100644
  
  	return fsnotify_perm(file, mask);
  }
-+EXPORT_SYMBOL(security_file_permission);
++EXPORT_SYMBOL_GPL(security_file_permission);
  
  int security_file_alloc(struct file *file)
  {
@@ -963,13 +1092,13 @@ index 8e9b1f4..c1c7cd1 100644
  		return ret;
  	return ima_file_mmap(file, prot);
  }
-+EXPORT_SYMBOL(security_mmap_file);
++EXPORT_SYMBOL_GPL(security_mmap_file);
  
  int security_mmap_addr(unsigned long addr)
  {
 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-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/ABI/testing/debugfs-aufs	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,50 @@
 +What:		/debug/aufs/si_<id>/
 +Date:		March 2009
@@ -1023,7 +1152,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-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/ABI/testing/sysfs-aufs	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,31 @@
 +What:		/sys/fs/aufs/si_<id>/
 +Date:		March 2009
@@ -1058,10 +1187,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/01intro.txt	2017-09-13 12:15:05.696012425 +0200
 @@ -0,0 +1,170 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1232,10 +1361,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/02struct.txt	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,258 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1494,10 +1623,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/03atomic_open.txt	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,85 @@
 +
-+# Copyright (C) 2015-2016 Junjiro R. Okajima
++# Copyright (C) 2015-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1583,10 +1712,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/03lookup.txt	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,113 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1700,10 +1829,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/04branch.txt	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,74 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1778,10 +1907,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt	2017-07-29 12:14:25.893041746 +0200
 @@ -0,0 +1,64 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1846,10 +1975,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/06fhsm.txt	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,120 @@
 +
-+# Copyright (C) 2011-2016 Junjiro R. Okajima
++# Copyright (C) 2011-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -1970,10 +2099,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/06mmap.txt	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,72 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -2046,10 +2175,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/06xattr.txt	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,96 @@
 +
-+# Copyright (C) 2014-2016 Junjiro R. Okajima
++# Copyright (C) 2014-2017 Junjiro R. Okajima
 +#
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -2146,10 +2275,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/07export.txt	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,58 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -2208,10 +2337,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/08shwh.txt	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,52 @@
 +
-+# Copyright (C) 2005-2016 Junjiro R. Okajima
++# Copyright (C) 2005-2017 Junjiro R. Okajima
 +# 
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -2264,10 +2393,10 @@ 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	2016-02-28 11:26:44.736895402 +0100
++++ linux/Documentation/filesystems/aufs/design/10dynop.txt	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,47 @@
 +
-+# Copyright (C) 2010-2016 Junjiro R. Okajima
++# Copyright (C) 2010-2017 Junjiro R. Okajima
 +#
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -2315,8 +2444,8 @@ 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-02-28 11:26:44.736895402 +0100
-@@ -0,0 +1,391 @@
++++ linux/Documentation/filesystems/aufs/README	2017-07-29 12:14:25.893041746 +0200
+@@ -0,0 +1,393 @@
 +
 +Aufs4 -- advanced multi layered unification filesystem version 4.x
 +http://aufs.sf.net
@@ -2691,6 +2820,8 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +Stefano Di Biase made a donation (2014/8).
 +Daniel Epellei made a donation (2015/1).
 +OmegaPhil made a donation (2016/1).
++Tomasz Szewczyk made a donation (2016/4).
++James Burry made a donation (2016/12).
 +
 +Thank you very much.
 +Donations are always, including future donations, very important and
@@ -2710,10 +2841,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/aufs.h	2017-07-29 12:14:25.896375188 +0200
 @@ -0,0 +1,59 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -2773,10 +2904,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,1408 @@
++++ linux/fs/aufs/branch.c	2017-09-13 12:15:05.716013038 +0200
+@@ -0,0 +1,1412 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -2815,7 +2946,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		fput(br->br_xino.xi_file);
 +	mutex_destroy(&br->br_xino.xi_nondir_mtx);
 +
-+	AuDebugOn(atomic_read(&br->br_count));
++	AuDebugOn(au_br_count(br));
++	au_br_count_fin(br);
 +
 +	wbr = br->br_wbr;
 +	if (wbr) {
@@ -2827,7 +2959,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +	if (br->br_fhsm) {
 +		au_br_fhsm_fin(br->br_fhsm);
-+		kfree(br->br_fhsm);
++		au_delayed_kfree(br->br_fhsm);
 +	}
 +
 +	key = br->br_dykey;
@@ -2841,8 +2973,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	lockdep_off();
 +	path_put(&br->br_path);
 +	lockdep_on();
-+	kfree(wbr);
-+	kfree(br);
++	if (wbr)
++		au_delayed_kfree(wbr);
++	au_delayed_kfree(br);
 +}
 +
 +/*
@@ -2855,7 +2988,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +	AuRwMustWriteLock(&sbinfo->si_rwsem);
 +
-+	bmax = sbinfo->si_bend + 1;
++	bmax = sbinfo->si_bbot + 1;
 +	br = sbinfo->si_branch;
 +	while (bmax--)
 +		au_br_do_free(*br++);
@@ -2866,10 +2999,10 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 + */
 +int au_br_index(struct super_block *sb, aufs_bindex_t br_id)
 +{
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +
-+	bend = au_sbend(sb);
-+	for (bindex = 0; bindex <= bend; bindex++)
++	bbot = au_sbbot(sb);
++	for (bindex = 0; bindex <= bbot; bindex++)
 +		if (au_sbr_id(sb, bindex) == br_id)
 +			return bindex;
 +	return -1;
@@ -2929,22 +3062,23 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +			goto out_wbr;
 +	}
 +
-+	err = au_sbr_realloc(au_sbi(sb), new_nbranch);
++	err = au_sbr_realloc(au_sbi(sb), new_nbranch, /*may_shrink*/0);
 +	if (!err)
-+		err = au_di_realloc(au_di(root), new_nbranch);
++		err = au_di_realloc(au_di(root), new_nbranch, /*may_shrink*/0);
 +	if (!err) {
 +		inode = d_inode(root);
-+		err = au_ii_realloc(au_ii(inode), new_nbranch);
++		err = au_hinode_realloc(au_ii(inode), new_nbranch, /*may_shrink*/0);
 +	}
 +	if (!err)
 +		return add_branch; /* success */
 +
 +out_wbr:
-+	kfree(add_branch->br_wbr);
++	if (add_branch->br_wbr)
++		au_delayed_kfree(add_branch->br_wbr);
 +out_hnotify:
 +	au_hnotify_fin_br(add_branch);
 +out_br:
-+	kfree(add_branch);
++	au_delayed_kfree(add_branch);
 +out:
 +	return ERR_PTR(err);
 +}
@@ -2976,13 +3110,13 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +static int test_add(struct super_block *sb, struct au_opt_add *add, int remount)
 +{
 +	int err;
-+	aufs_bindex_t bend, bindex;
++	aufs_bindex_t bbot, bindex;
 +	struct dentry *root, *h_dentry;
 +	struct inode *inode, *h_inode;
 +
 +	root = sb->s_root;
-+	bend = au_sbend(sb);
-+	if (unlikely(bend >= 0
++	bbot = au_sbbot(sb);
++	if (unlikely(bbot >= 0
 +		     && au_find_dbindex(root, add->path.dentry) >= 0)) {
 +		err = 1;
 +		if (!remount) {
@@ -2994,13 +3128,13 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +	err = -ENOSPC; /* -E2BIG; */
 +	if (unlikely(AUFS_BRANCH_MAX <= add->bindex
-+		     || AUFS_BRANCH_MAX - 1 <= bend)) {
++		     || AUFS_BRANCH_MAX - 1 <= bbot)) {
 +		pr_err("number of branches exceeded %s\n", add->pathname);
 +		goto out;
 +	}
 +
 +	err = -EDOM;
-+	if (unlikely(add->bindex < 0 || bend + 1 < add->bindex)) {
++	if (unlikely(add->bindex < 0 || bbot + 1 < add->bindex)) {
 +		pr_err("bad index %d\n", add->bindex);
 +		goto out;
 +	}
@@ -3034,11 +3168,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	if (unlikely(err))
 +		goto out;
 +
-+	if (bend < 0)
++	if (bbot < 0)
 +		return 0; /* success */
 +
 +	err = -EINVAL;
-+	for (bindex = 0; bindex <= bend; bindex++)
++	for (bindex = 0; bindex <= bbot; bindex++)
 +		if (unlikely(test_overlap(sb, add->path.dentry,
 +					  au_h_dptr(root, bindex)))) {
 +			pr_err("%s is overlapped\n", add->pathname);
@@ -3110,7 +3244,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	br->br_perm = old_perm;
 +
 +	if (!err && wbr && !au_br_writable(new_perm)) {
-+		kfree(wbr);
++		au_delayed_kfree(wbr);
 +		br->br_wbr = NULL;
 +	}
 +
@@ -3160,7 +3294,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	br->br_perm = add->perm;
 +	br->br_path = add->path; /* set first, path_get() later */
 +	spin_lock_init(&br->br_dykey_lock);
-+	atomic_set(&br->br_count, 0);
++	au_br_count_init(br);
 +	atomic_set(&br->br_xino_running, 0);
 +	br->br_id = au_new_br_id(sb);
 +	AuDebugOn(br->br_id < 0);
@@ -3192,7 +3326,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +}
 +
 +static void au_br_do_add_brp(struct au_sbinfo *sbinfo, aufs_bindex_t bindex,
-+			     struct au_branch *br, aufs_bindex_t bend,
++			     struct au_branch *br, aufs_bindex_t bbot,
 +			     aufs_bindex_t amount)
 +{
 +	struct au_branch **brp;
@@ -3202,40 +3336,39 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	brp = sbinfo->si_branch + bindex;
 +	memmove(brp + 1, brp, sizeof(*brp) * amount);
 +	*brp = br;
-+	sbinfo->si_bend++;
-+	if (unlikely(bend < 0))
-+		sbinfo->si_bend = 0;
++	sbinfo->si_bbot++;
++	if (unlikely(bbot < 0))
++		sbinfo->si_bbot = 0;
 +}
 +
 +static void au_br_do_add_hdp(struct au_dinfo *dinfo, aufs_bindex_t bindex,
-+			     aufs_bindex_t bend, aufs_bindex_t amount)
++			     aufs_bindex_t bbot, aufs_bindex_t amount)
 +{
 +	struct au_hdentry *hdp;
 +
 +	AuRwMustWriteLock(&dinfo->di_rwsem);
 +
-+	hdp = dinfo->di_hdentry + bindex;
++	hdp = au_hdentry(dinfo, bindex);
 +	memmove(hdp + 1, hdp, sizeof(*hdp) * amount);
 +	au_h_dentry_init(hdp);
-+	dinfo->di_bend++;
-+	if (unlikely(bend < 0))
-+		dinfo->di_bstart = 0;
++	dinfo->di_bbot++;
++	if (unlikely(bbot < 0))
++		dinfo->di_btop = 0;
 +}
 +
 +static void au_br_do_add_hip(struct au_iinfo *iinfo, aufs_bindex_t bindex,
-+			     aufs_bindex_t bend, aufs_bindex_t amount)
++			     aufs_bindex_t bbot, aufs_bindex_t amount)
 +{
 +	struct au_hinode *hip;
 +
 +	AuRwMustWriteLock(&iinfo->ii_rwsem);
 +
-+	hip = iinfo->ii_hinode + bindex;
++	hip = au_hinode(iinfo, bindex);
 +	memmove(hip + 1, hip, sizeof(*hip) * amount);
-+	hip->hi_inode = NULL;
-+	au_hn_init(hip);
-+	iinfo->ii_bend++;
-+	if (unlikely(bend < 0))
-+		iinfo->ii_bstart = 0;
++	au_hinode_init(hip);
++	iinfo->ii_bbot++;
++	if (unlikely(bbot < 0))
++		iinfo->ii_btop = 0;
 +}
 +
 +static void au_br_do_add(struct super_block *sb, struct au_branch *br,
@@ -3243,17 +3376,17 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +{
 +	struct dentry *root, *h_dentry;
 +	struct inode *root_inode, *h_inode;
-+	aufs_bindex_t bend, amount;
++	aufs_bindex_t bbot, amount;
 +
 +	root = sb->s_root;
 +	root_inode = d_inode(root);
-+	bend = au_sbend(sb);
-+	amount = bend + 1 - bindex;
++	bbot = au_sbbot(sb);
++	amount = bbot + 1 - bindex;
 +	h_dentry = au_br_dentry(br);
 +	au_sbilist_lock();
-+	au_br_do_add_brp(au_sbi(sb), bindex, br, bend, amount);
-+	au_br_do_add_hdp(au_di(root), bindex, bend, amount);
-+	au_br_do_add_hip(au_ii(root_inode), bindex, bend, amount);
++	au_br_do_add_brp(au_sbi(sb), bindex, br, bbot, amount);
++	au_br_do_add_hdp(au_di(root), bindex, bbot, amount);
++	au_br_do_add_hip(au_ii(root_inode), bindex, bbot, amount);
 +	au_set_h_dptr(root, bindex, dget(h_dentry));
 +	h_inode = d_inode(h_dentry);
 +	au_set_h_iptr(root_inode, bindex, au_igrab(h_inode), /*flags*/0);
@@ -3263,7 +3396,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +int au_br_add(struct super_block *sb, struct au_opt_add *add, int remount)
 +{
 +	int err;
-+	aufs_bindex_t bend, add_bindex;
++	aufs_bindex_t bbot, add_bindex;
 +	struct dentry *root, *h_dentry;
 +	struct inode *root_inode;
 +	struct au_branch *add_branch;
@@ -3279,8 +3412,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		goto out; /* success */
 +	}
 +
-+	bend = au_sbend(sb);
-+	add_branch = au_br_alloc(sb, bend + 2, add->perm);
++	bbot = au_sbbot(sb);
++	add_branch = au_br_alloc(sb, bbot + 2, add->perm);
 +	err = PTR_ERR(add_branch);
 +	if (IS_ERR(add_branch))
 +		goto out;
@@ -3357,7 +3490,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +static struct file **au_farray_alloc(struct super_block *sb,
 +				     unsigned long long *max)
 +{
-+	*max = atomic_long_read(&au_sbi(sb)->si_nfiles);
++	*max = au_nfiles(sb);
 +	return au_array_alloc(max, au_farray_cb, sb);
 +}
 +
@@ -3383,16 +3516,16 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		pr_info(fmt, ##__VA_ARGS__); \
 +} while (0)
 +
-+static int au_test_ibusy(struct inode *inode, aufs_bindex_t bstart,
-+			 aufs_bindex_t bend)
++static int au_test_ibusy(struct inode *inode, aufs_bindex_t btop,
++			 aufs_bindex_t bbot)
 +{
-+	return (inode && !S_ISDIR(inode->i_mode)) || bstart == bend;
++	return (inode && !S_ISDIR(inode->i_mode)) || btop == bbot;
 +}
 +
-+static int au_test_dbusy(struct dentry *dentry, aufs_bindex_t bstart,
-+			 aufs_bindex_t bend)
++static int au_test_dbusy(struct dentry *dentry, aufs_bindex_t btop,
++			 aufs_bindex_t bbot)
 +{
-+	return au_test_ibusy(d_inode(dentry), bstart, bend);
++	return au_test_ibusy(d_inode(dentry), btop, bbot);
 +}
 +
 +/*
@@ -3402,7 +3535,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +			    unsigned int sigen, const unsigned int verbose)
 +{
 +	int err, i, j, ndentry;
-+	aufs_bindex_t bstart, bend;
++	aufs_bindex_t btop, bbot;
 +	struct au_dcsub_pages dpages;
 +	struct au_dpage *dpage;
 +	struct dentry *d;
@@ -3442,12 +3575,12 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +			}
 +
 +			/* AuDbgDentry(d); */
-+			bstart = au_dbstart(d);
-+			bend = au_dbend(d);
-+			if (bstart <= bindex
-+			    && bindex <= bend
++			btop = au_dbtop(d);
++			bbot = au_dbbot(d);
++			if (btop <= bindex
++			    && bindex <= bbot
 +			    && au_h_dptr(d, bindex)
-+			    && au_test_dbusy(d, bstart, bend)) {
++			    && au_test_dbusy(d, btop, bbot)) {
 +				err = -EBUSY;
 +				AuVerbose(verbose, "busy %pd\n", d);
 +				AuDbgDentry(d);
@@ -3468,7 +3601,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	int err;
 +	unsigned long long max, ull;
 +	struct inode *i, **array;
-+	aufs_bindex_t bstart, bend;
++	aufs_bindex_t btop, bbot;
 +
 +	array = au_iarray_alloc(sb, &max);
 +	err = PTR_ERR(array);
@@ -3499,12 +3632,12 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +			}
 +		}
 +
-+		bstart = au_ibstart(i);
-+		bend = au_ibend(i);
-+		if (bstart <= bindex
-+		    && bindex <= bend
++		btop = au_ibtop(i);
++		bbot = au_ibbot(i);
++		if (btop <= bindex
++		    && bindex <= bbot
 +		    && au_h_iptr(i, bindex)
-+		    && au_test_ibusy(i, bstart, bend)) {
++		    && au_test_ibusy(i, btop, bbot)) {
 +			err = -EBUSY;
 +			AuVerbose(verbose, "busy i%lu\n", i->i_ino);
 +			AuDbgInode(i);
@@ -3540,7 +3673,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +{
 +	int err;
 +	unsigned char matched, root;
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +	struct au_fidir *fidir;
 +	struct au_hfile *hfile;
 +
@@ -3556,8 +3689,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	matched = 0;
 +	fidir = au_fi(file)->fi_hdir;
 +	AuDebugOn(!fidir);
-+	bend = au_fbend_dir(file);
-+	for (bindex = au_fbstart(file); bindex <= bend; bindex++) {
++	bbot = au_fbbot_dir(file);
++	for (bindex = au_fbtop(file); bindex <= bbot; bindex++) {
 +		hfile = fidir->fd_hfile + bindex;
 +		if (!hfile->hf_file)
 +			continue;
@@ -3579,7 +3712,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +{
 +	int err, idx;
 +	unsigned long long ull, max;
-+	aufs_bindex_t bstart;
++	aufs_bindex_t btop;
 +	struct file *file, **array;
 +	struct dentry *root;
 +	struct au_hfile *hfile;
@@ -3600,7 +3733,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +		/* AuDbg("%pD\n", file); */
 +		fi_read_lock(file);
-+		bstart = au_fbstart(file);
++		btop = au_fbtop(file);
 +		if (!d_is_dir(file->f_path.dentry)) {
 +			hfile = &au_fi(file)->fi_htop;
 +			if (hfile->hf_br->br_id == br_id)
@@ -3623,7 +3756,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +			  aufs_bindex_t br_id)
 +{
 +	unsigned long long ull;
-+	aufs_bindex_t bindex, bstart, bend, bfound;
++	aufs_bindex_t bindex, btop, bbot, bfound;
 +	struct file *file;
 +	struct au_fidir *fidir;
 +	struct au_hfile *hfile;
@@ -3639,9 +3772,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		fidir = au_fi(file)->fi_hdir;
 +		AuDebugOn(!fidir);
 +		fi_write_lock(file);
-+		bstart = au_fbstart(file);
-+		bend = au_fbend_dir(file);
-+		for (bindex = bstart; bindex <= bend; bindex++) {
++		btop = au_fbtop(file);
++		bbot = au_fbbot_dir(file);
++		for (bindex = btop; bindex <= bbot; bindex++) {
 +			hfile = fidir->fd_hfile + bindex;
 +			if (!hfile->hf_file)
 +				continue;
@@ -3653,10 +3786,10 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		}
 +		AuDebugOn(bfound < 0);
 +		au_set_h_fptr(file, bfound, NULL);
-+		if (bfound == bstart) {
-+			for (bstart++; bstart <= bend; bstart++)
-+				if (au_hf_dir(file, bstart)) {
-+					au_set_fbstart(file, bstart);
++		if (bfound == btop) {
++			for (btop++; btop <= bbot; btop++)
++				if (au_hf_dir(file, btop)) {
++					au_set_fbtop(file, btop);
 +					break;
 +				}
 +		}
@@ -3666,59 +3799,60 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +static void au_br_do_del_brp(struct au_sbinfo *sbinfo,
 +			     const aufs_bindex_t bindex,
-+			     const aufs_bindex_t bend)
++			     const aufs_bindex_t bbot)
 +{
 +	struct au_branch **brp, **p;
 +
 +	AuRwMustWriteLock(&sbinfo->si_rwsem);
 +
 +	brp = sbinfo->si_branch + bindex;
-+	if (bindex < bend)
-+		memmove(brp, brp + 1, sizeof(*brp) * (bend - bindex));
-+	sbinfo->si_branch[0 + bend] = NULL;
-+	sbinfo->si_bend--;
++	if (bindex < bbot)
++		memmove(brp, brp + 1, sizeof(*brp) * (bbot - bindex));
++	sbinfo->si_branch[0 + bbot] = NULL;
++	sbinfo->si_bbot--;
 +
-+	p = krealloc(sbinfo->si_branch, sizeof(*p) * bend, AuGFP_SBILIST);
++	p = au_krealloc(sbinfo->si_branch, sizeof(*p) * bbot, AuGFP_SBILIST,
++			/*may_shrink*/1);
 +	if (p)
 +		sbinfo->si_branch = p;
 +	/* harmless error */
 +}
 +
 +static void au_br_do_del_hdp(struct au_dinfo *dinfo, const aufs_bindex_t bindex,
-+			     const aufs_bindex_t bend)
++			     const aufs_bindex_t bbot)
 +{
 +	struct au_hdentry *hdp, *p;
 +
 +	AuRwMustWriteLock(&dinfo->di_rwsem);
 +
-+	hdp = dinfo->di_hdentry;
-+	if (bindex < bend)
-+		memmove(hdp + bindex, hdp + bindex + 1,
-+			sizeof(*hdp) * (bend - bindex));
-+	hdp[0 + bend].hd_dentry = NULL;
-+	dinfo->di_bend--;
++	hdp = au_hdentry(dinfo, bindex);
++	if (bindex < bbot)
++		memmove(hdp, hdp + 1, sizeof(*hdp) * (bbot - bindex));
++	/* au_h_dentry_init(au_hdentry(dinfo, bbot); */
++	dinfo->di_bbot--;
 +
-+	p = krealloc(hdp, sizeof(*p) * bend, AuGFP_SBILIST);
++	p = au_krealloc(dinfo->di_hdentry, sizeof(*p) * bbot, AuGFP_SBILIST,
++			/*may_shrink*/1);
 +	if (p)
 +		dinfo->di_hdentry = p;
 +	/* harmless error */
 +}
 +
 +static void au_br_do_del_hip(struct au_iinfo *iinfo, const aufs_bindex_t bindex,
-+			     const aufs_bindex_t bend)
++			     const aufs_bindex_t bbot)
 +{
 +	struct au_hinode *hip, *p;
 +
 +	AuRwMustWriteLock(&iinfo->ii_rwsem);
 +
-+	hip = iinfo->ii_hinode + bindex;
-+	if (bindex < bend)
-+		memmove(hip, hip + 1, sizeof(*hip) * (bend - bindex));
-+	iinfo->ii_hinode[0 + bend].hi_inode = NULL;
-+	au_hn_init(iinfo->ii_hinode + bend);
-+	iinfo->ii_bend--;
++	hip = au_hinode(iinfo, bindex);
++	if (bindex < bbot)
++		memmove(hip, hip + 1, sizeof(*hip) * (bbot - bindex));
++	/* au_hinode_init(au_hinode(iinfo, bbot)); */
++	iinfo->ii_bbot--;
 +
-+	p = krealloc(iinfo->ii_hinode, sizeof(*p) * bend, AuGFP_SBILIST);
++	p = au_krealloc(iinfo->ii_hinode, sizeof(*p) * bbot, AuGFP_SBILIST,
++			/*may_shrink*/1);
 +	if (p)
 +		iinfo->ii_hinode = p;
 +	/* harmless error */
@@ -3727,7 +3861,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +static void au_br_do_del(struct super_block *sb, aufs_bindex_t bindex,
 +			 struct au_branch *br)
 +{
-+	aufs_bindex_t bend;
++	aufs_bindex_t bbot;
 +	struct au_sbinfo *sbinfo;
 +	struct dentry *root, *h_root;
 +	struct inode *inode, *h_inode;
@@ -3738,7 +3872,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	root = sb->s_root;
 +	inode = d_inode(root);
 +	sbinfo = au_sbi(sb);
-+	bend = sbinfo->si_bend;
++	bbot = sbinfo->si_bbot;
 +
 +	h_root = au_h_dptr(root, bindex);
 +	hinode = au_hi(inode, bindex);
@@ -3746,9 +3880,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	au_hiput(hinode);
 +
 +	au_sbilist_lock();
-+	au_br_do_del_brp(sbinfo, bindex, bend);
-+	au_br_do_del_hdp(au_di(root), bindex, bend);
-+	au_br_do_del_hip(au_ii(inode), bindex, bend);
++	au_br_do_del_brp(sbinfo, bindex, bbot);
++	au_br_do_del_hdp(au_di(root), bindex, bbot);
++	au_br_do_del_hip(au_ii(inode), bindex, bbot);
 +	au_sbilist_unlock();
 +
 +	dput(h_root);
@@ -3767,7 +3901,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	int err, rerr, i;
 +	unsigned long long opened;
 +	unsigned int mnt_flags;
-+	aufs_bindex_t bindex, bend, br_id;
++	aufs_bindex_t bindex, bbot, br_id;
 +	unsigned char do_wh, verbose;
 +	struct au_branch *br;
 +	struct au_wbr *wbr;
@@ -3791,8 +3925,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	err = -EBUSY;
 +	mnt_flags = au_mntflags(sb);
 +	verbose = !!au_opt_test(mnt_flags, VERBOSE);
-+	bend = au_sbend(sb);
-+	if (unlikely(!bend)) {
++	bbot = au_sbbot(sb);
++	if (unlikely(!bbot)) {
 +		AuVerbose(verbose, "no more branches left\n");
 +		goto out;
 +	}
@@ -3800,7 +3934,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	AuDebugOn(!path_equal(&br->br_path, &del->h_path));
 +
 +	br_id = br->br_id;
-+	opened = atomic_read(&br->br_count);
++	opened = au_br_count(br);
 +	if (unlikely(opened)) {
 +		to_free = au_array_alloc(&opened, empty_cb, NULL);
 +		err = PTR_ERR(to_free);
@@ -3880,7 +4014,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +static int au_ibusy(struct super_block *sb, struct aufs_ibusy __user *arg)
 +{
 +	int err;
-+	aufs_bindex_t bstart, bend;
++	aufs_bindex_t btop, bbot;
 +	struct aufs_ibusy ibusy;
 +	struct inode *inode, *h_inode;
 +
@@ -3899,7 +4033,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +	err = -EINVAL;
 +	si_read_lock(sb, AuLock_FLUSH);
-+	if (unlikely(ibusy.bindex < 0 || ibusy.bindex > au_sbend(sb)))
++	if (unlikely(ibusy.bindex < 0 || ibusy.bindex > au_sbbot(sb)))
 +		goto out_unlock;
 +
 +	err = 0;
@@ -3907,15 +4041,15 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	inode = ilookup(sb, ibusy.ino);
 +	if (!inode
 +	    || inode->i_ino == AUFS_ROOT_INO
-+	    || is_bad_inode(inode))
++	    || au_is_bad_inode(inode))
 +		goto out_unlock;
 +
 +	ii_read_lock_child(inode);
-+	bstart = au_ibstart(inode);
-+	bend = au_ibend(inode);
-+	if (bstart <= ibusy.bindex && ibusy.bindex <= bend) {
++	btop = au_ibtop(inode);
++	bbot = au_ibbot(inode);
++	if (btop <= ibusy.bindex && ibusy.bindex <= bbot) {
 +		h_inode = au_h_iptr(inode, ibusy.bindex);
-+		if (h_inode && au_test_ibusy(inode, bstart, bend))
++		if (h_inode && au_test_ibusy(inode, btop, bbot))
 +			ibusy.h_ino = h_inode->i_ino;
 +	}
 +	ii_read_unlock(inode);
@@ -4136,7 +4270,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		if (br->br_wbr) {
 +			err = au_wbr_init(br, sb, mod->perm);
 +			if (unlikely(err)) {
-+				kfree(br->br_wbr);
++				au_delayed_kfree(br->br_wbr);
 +				br->br_wbr = NULL;
 +			}
 +		}
@@ -4148,7 +4282,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		if (!au_br_fhsm(mod->perm)) {
 +			/* fhsm --> non-fhsm */
 +			au_br_fhsm_fin(br->br_fhsm);
-+			kfree(br->br_fhsm);
++			au_delayed_kfree(br->br_fhsm);
 +			br->br_fhsm = NULL;
 +		}
 +	} else if (au_br_fhsm(mod->perm))
@@ -4160,7 +4294,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	goto out; /* success */
 +
 +out_bf:
-+	kfree(bf);
++	if (bf)
++		au_delayed_kfree(bf);
 +out:
 +	AuTraceErr(err);
 +	return err;
@@ -4185,10 +4320,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,279 @@
++++ linux/fs/aufs/branch.h	2017-09-13 12:15:05.716013038 +0200
+@@ -0,0 +1,309 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -4288,7 +4423,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +	struct path		br_path;
 +	spinlock_t		br_dykey_lock;
 +	struct au_dykey		*br_dykey[AuBrDynOp];
-+	atomic_t		br_count;
++	struct percpu_counter	br_count;
 +
 +	struct au_wbr		*br_wbr;
 +	struct au_br_fhsm	*br_fhsm;
@@ -4323,6 +4458,31 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +	return au_br_mnt(br)->mnt_sb;
 +}
 +
++static inline void au_br_get(struct au_branch *br)
++{
++	percpu_counter_inc(&br->br_count);
++}
++
++static inline void au_br_put(struct au_branch *br)
++{
++	percpu_counter_dec(&br->br_count);
++}
++
++static inline s64 au_br_count(struct au_branch *br)
++{
++	return percpu_counter_sum(&br->br_count);
++}
++
++static inline void au_br_count_init(struct au_branch *br)
++{
++	percpu_counter_init(&br->br_count, 0, GFP_NOFS);
++}
++
++static inline void au_br_count_fin(struct au_branch *br)
++{
++	percpu_counter_destroy(&br->br_count);
++}
++
 +static inline int au_br_rdonly(struct au_branch *br)
 +{
 +	return ((au_br_sb(br)->s_flags & MS_RDONLY)
@@ -4418,9 +4578,14 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +	return au_br_sb(au_sbr(sb, bindex));
 +}
 +
++static inline void au_sbr_get(struct super_block *sb, aufs_bindex_t bindex)
++{
++	au_br_get(au_sbr(sb, bindex));
++}
++
 +static inline void au_sbr_put(struct super_block *sb, aufs_bindex_t bindex)
 +{
-+	atomic_dec(&au_sbr(sb, bindex)->br_count);
++	au_br_put(au_sbr(sb, bindex));
 +}
 +
 +static inline int au_sbr_perm(struct super_block *sb, aufs_bindex_t bindex)
@@ -4468,7 +4633,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-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/conf.mk	2017-07-29 12:14:25.899708630 +0200
 @@ -0,0 +1,38 @@
 +
 +AuConfStr = CONFIG_AUFS_FS=${CONFIG_AUFS_FS}
@@ -4510,10 +4675,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,1379 @@
++++ linux/fs/aufs/cpup.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,1383 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -4554,7 +4719,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +{
 +	struct inode *h_inode;
 +
-+	h_inode = au_h_iptr(inode, au_ibstart(inode));
++	h_inode = au_h_iptr(inode, au_ibtop(inode));
 +	fsstack_copy_attr_times(inode, h_inode);
 +	fsstack_copy_inode_size(inode, h_inode);
 +}
@@ -4563,10 +4728,10 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +{
 +	struct inode *h_inode;
 +	struct super_block *sb;
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +
 +	sb = inode->i_sb;
-+	bindex = au_ibstart(inode);
++	bindex = au_ibtop(inode);
 +	h_inode = au_h_iptr(inode, bindex);
 +	if (!force
 +	    && !S_ISDIR(h_inode->i_mode)
@@ -4589,8 +4754,8 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	 * it may includes whplink directory.
 +	 */
 +	if (S_ISDIR(h_inode->i_mode)) {
-+		bend = au_ibend(inode);
-+		for (bindex++; bindex <= bend; bindex++) {
++		bbot = au_ibbot(inode);
++		for (bindex++; bindex <= bbot; bindex++) {
 +			h_inode = au_h_iptr(inode, bindex);
 +			if (h_inode)
 +				au_add_nlink(inode, h_inode);
@@ -4602,7 +4767,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +{
 +	struct inode *h_inode;
 +
-+	h_inode = au_h_iptr(inode, au_ibstart(inode));
++	h_inode = au_h_iptr(inode, au_ibtop(inode));
 +	inode->i_mode = h_inode->i_mode;
 +	inode->i_uid = h_inode->i_uid;
 +	inode->i_gid = h_inode->i_gid;
@@ -4624,7 +4789,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +{
 +	struct inode *h_inode;
 +
-+	h_inode = au_h_iptr(inode, au_ibstart(inode));
++	h_inode = au_h_iptr(inode, au_ibtop(inode));
 +	au_cpup_attr_changeable(inode);
 +	if (inode->i_nlink > 0)
 +		au_cpup_attr_nlink(inode, force);
@@ -4871,9 +5036,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	dst->f_pos = 0;
 +	err = au_do_copy_file(dst, src, len, buf, blksize);
 +	if (do_kfree)
-+		kfree(buf);
++		au_delayed_kfree(buf);
 +	else
-+		free_page((unsigned long)buf);
++		au_delayed_free_page((unsigned long)buf);
 +
 +out:
 +	return err;
@@ -5033,7 +5198,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +		sym.k[symlen] = 0;
 +		err = vfsub_symlink(h_dir, h_path, sym.k);
 +	}
-+	free_page((unsigned long)sym.k);
++	au_delayed_free_page((unsigned long)sym.k);
 +
 +out:
 +	return err;
@@ -5081,7 +5246,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	 * particularry setattr case
 +	 */
 +	dir = d_inode(dst_parent);
-+	if (au_ibstart(dir) == cpg->bdst)
++	if (au_ibtop(dir) == cpg->bdst)
 +		au_cpup_attr_nlink(dir, /*force*/1);
 +	inode = d_inode(cpg->dentry);
 +	au_cpup_attr_nlink(inode, /*force*/1);
@@ -5242,7 +5407,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +static int au_cpup_single(struct au_cp_generic *cpg, struct dentry *dst_parent)
 +{
 +	int err, rerr;
-+	aufs_bindex_t old_ibstart;
++	aufs_bindex_t old_ibtop;
 +	unsigned char isdir, plink;
 +	struct dentry *h_src, *h_dst, *h_parent;
 +	struct inode *dst_inode, *h_dir, *inode, *delegated, *src_inode;
@@ -5330,7 +5495,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	}
 +
 +	isdir = S_ISDIR(inode->i_mode);
-+	old_ibstart = au_ibstart(inode);
++	old_ibtop = au_ibtop(inode);
 +	err = cpup_entry(cpg, dst_parent, &a->h_src_attr);
 +	if (unlikely(err))
 +		goto out_rev;
@@ -5347,7 +5512,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +		goto out_rev;
 +	}
 +
-+	if (cpg->bdst < old_ibstart) {
++	if (cpg->bdst < old_ibtop) {
 +		if (S_ISREG(inode->i_mode)) {
 +			err = au_dy_iaop(inode, cpg->bdst, dst_inode);
 +			if (unlikely(err)) {
@@ -5357,9 +5522,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +				goto out_rev;
 +			}
 +		}
-+		au_set_ibstart(inode, cpg->bdst);
++		au_set_ibtop(inode, cpg->bdst);
 +	} else
-+		au_set_ibend(inode, cpg->bdst);
++		au_set_ibbot(inode, cpg->bdst);
 +	au_set_h_iptr(inode, cpg->bdst, au_igrab(dst_inode),
 +		      au_hi_flags(inode, isdir));
 +
@@ -5404,7 +5569,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	}
 +out_parent:
 +	dput(dst_parent);
-+	kfree(a);
++	au_delayed_kfree(a);
 +out:
 +	return err;
 +}
@@ -5515,7 +5680,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +		/* revert */
 +		au_set_h_dptr(dentry, cpg->bdst, NULL);
-+		au_set_dbstart(dentry, cpg->bsrc);
++		au_set_dbtop(dentry, cpg->bsrc);
 +	}
 +
 +	return err;
@@ -5577,20 +5742,20 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +int au_sio_cpup_simple(struct au_cp_generic *cpg)
 +{
-+	aufs_bindex_t bsrc, bend;
++	aufs_bindex_t bsrc, bbot;
 +	struct dentry *dentry, *h_dentry;
 +
 +	if (cpg->bsrc < 0) {
 +		dentry = cpg->dentry;
-+		bend = au_dbend(dentry);
-+		for (bsrc = cpg->bdst + 1; bsrc <= bend; bsrc++) {
++		bbot = au_dbbot(dentry);
++		for (bsrc = cpg->bdst + 1; bsrc <= bbot; bsrc++) {
 +			h_dentry = au_h_dptr(dentry, bsrc);
 +			if (h_dentry) {
 +				AuDebugOn(d_is_negative(h_dentry));
 +				break;
 +			}
 +		}
-+		AuDebugOn(bsrc > bend);
++		AuDebugOn(bsrc > bbot);
 +		cpg->bsrc = bsrc;
 +	}
 +	AuDebugOn(cpg->bsrc <= cpg->bdst);
@@ -5614,23 +5779,27 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	int err;
 +	unsigned int flags_orig;
 +	aufs_bindex_t bsrc_orig;
-+	struct dentry *h_d_dst, *h_d_start;
 +	struct au_dinfo *dinfo;
-+	struct au_hdentry *hdp;
++	struct {
++		struct au_hdentry *hd;
++		struct dentry *h_dentry;
++	} hdst, hsrc;
 +
 +	dinfo = au_di(cpg->dentry);
 +	AuRwMustWriteLock(&dinfo->di_rwsem);
 +
 +	bsrc_orig = cpg->bsrc;
-+	cpg->bsrc = dinfo->di_bstart;
-+	hdp = dinfo->di_hdentry;
-+	h_d_dst = hdp[0 + cpg->bdst].hd_dentry;
-+	dinfo->di_bstart = cpg->bdst;
-+	hdp[0 + cpg->bdst].hd_dentry = wh_dentry;
-+	h_d_start = NULL;
++	cpg->bsrc = dinfo->di_btop;
++	hdst.hd = au_hdentry(dinfo, cpg->bdst);
++	hdst.h_dentry = hdst.hd->hd_dentry;
++	hdst.hd->hd_dentry = wh_dentry;
++	dinfo->di_btop = cpg->bdst;
++
++	hsrc.h_dentry = NULL;
 +	if (file) {
-+		h_d_start = hdp[0 + cpg->bsrc].hd_dentry;
-+		hdp[0 + cpg->bsrc].hd_dentry = au_hf_top(file)->f_path.dentry;
++		hsrc.hd = au_hdentry(dinfo, cpg->bsrc);
++		hsrc.h_dentry = hsrc.hd->hd_dentry;
++		hsrc.hd->hd_dentry = au_hf_top(file)->f_path.dentry;
 +	}
 +	flags_orig = cpg->flags;
 +	cpg->flags = !AuCpup_DTIME;
@@ -5639,10 +5808,10 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	if (file) {
 +		if (!err)
 +			err = au_reopen_nondir(file);
-+		hdp[0 + cpg->bsrc].hd_dentry = h_d_start;
++		hsrc.hd->hd_dentry = hsrc.h_dentry;
 +	}
-+	hdp[0 + cpg->bdst].hd_dentry = h_d_dst;
-+	dinfo->di_bstart = cpg->bsrc;
++	hdst.hd->hd_dentry = hdst.h_dentry;
++	dinfo->di_btop = cpg->bsrc;
 +	cpg->bsrc = bsrc_orig;
 +
 +	return err;
@@ -5826,7 +5995,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +		h_dentry = au_h_dptr(d, bdst);
 +		if (!h_dentry || d_is_negative(h_dentry)) {
 +			if (h_dentry)
-+				au_update_dbstart(d);
++				au_update_dbtop(d);
 +
 +			au_pin_set_dentry(&pin, d);
 +			err = au_do_pin(&pin);
@@ -5893,10 +6062,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/cpup.h	2017-07-29 12:14:25.899708630 +0200
 @@ -0,0 +1,94 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -5991,10 +6160,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,432 @@
++++ linux/fs/aufs/dbgaufs.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,438 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -6036,7 +6205,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +static int dbgaufs_xi_release(struct inode *inode __maybe_unused,
 +			      struct file *file)
 +{
-+	kfree(file->private_data);
++	au_delayed_kfree(file->private_data);
 +	return 0;
 +}
 +
@@ -6098,7 +6267,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +static int dbgaufs_plink_release(struct inode *inode __maybe_unused,
 +				 struct file *file)
 +{
-+	free_page((unsigned long)file->private_data);
++	au_delayed_free_page((unsigned long)file->private_data);
 +	return 0;
 +}
 +
@@ -6162,7 +6331,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	goto out; /* success */
 +
 +out_free:
-+	free_page((unsigned long)p);
++	au_delayed_free_page((unsigned long)p);
 +out:
 +	return err;
 +}
@@ -6233,7 +6402,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	sbinfo = inode->i_private;
 +	sb = sbinfo->si_sb;
 +	si_noflush_read_lock(sb);
-+	if (l <= au_sbend(sb)) {
++	if (l <= au_sbbot(sb)) {
 +		xf = au_sbr(sb, (aufs_bindex_t)l)->br_xino.xi_file;
 +		err = dbgaufs_xi_open(xf, file, /*do_fcnt*/1);
 +	} else
@@ -6253,18 +6422,21 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +
 +void dbgaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex)
 +{
-+	aufs_bindex_t bend;
++	aufs_bindex_t bbot;
 +	struct au_branch *br;
 +	struct au_xino_file *xi;
 +
 +	if (!au_sbi(sb)->si_dbgaufs)
 +		return;
 +
-+	bend = au_sbend(sb);
-+	for (; bindex <= bend; bindex++) {
++	bbot = au_sbbot(sb);
++	for (; bindex <= bbot; bindex++) {
 +		br = au_sbr(sb, bindex);
 +		xi = &br->br_xino;
++		/* debugfs acquires the parent i_mutex */
++		lockdep_off();
 +		debugfs_remove(xi->xi_dbgaufs);
++		lockdep_on();
 +		xi->xi_dbgaufs = NULL;
 +	}
 +}
@@ -6275,7 +6447,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	struct dentry *parent;
 +	struct au_branch *br;
 +	struct au_xino_file *xi;
-+	aufs_bindex_t bend;
++	aufs_bindex_t bbot;
 +	char name[sizeof(DbgaufsXi_PREFIX) + 5]; /* "xi" bindex NULL */
 +
 +	sbinfo = au_sbi(sb);
@@ -6283,14 +6455,17 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	if (!parent)
 +		return;
 +
-+	bend = au_sbend(sb);
-+	for (; bindex <= bend; bindex++) {
++	bbot = au_sbbot(sb);
++	for (; bindex <= bbot; bindex++) {
 +		snprintf(name, sizeof(name), DbgaufsXi_PREFIX "%d", bindex);
 +		br = au_sbr(sb, bindex);
 +		xi = &br->br_xino;
 +		AuDebugOn(xi->xi_dbgaufs);
++		/* debugfs acquires the parent i_mutex */
++		lockdep_off();
 +		xi->xi_dbgaufs = debugfs_create_file(name, dbgaufs_mode, parent,
 +						     sbinfo, &dbgaufs_xino_fop);
++		lockdep_on();
 +		/* ignore an error */
 +		if (unlikely(!xi->xi_dbgaufs))
 +			AuWarn1("failed %s under debugfs\n", name);
@@ -6427,10 +6602,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/dbgaufs.h	2017-07-29 12:14:25.899708630 +0200
 @@ -0,0 +1,48 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -6479,10 +6654,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,224 @@
++++ linux/fs/aufs/dcsub.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,225 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -6512,7 +6687,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +	p = dpage->dentries;
 +	for (i = 0; i < dpage->ndentry; i++)
 +		dput(*p++);
-+	free_page((unsigned long)dpage->dentries);
++	au_delayed_free_page((unsigned long)dpage->dentries);
 +}
 +
 +int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp)
@@ -6535,7 +6710,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +	return 0; /* success */
 +
 +out_dpages:
-+	kfree(dpages->dpages);
++	au_delayed_kfree(dpages->dpages);
 +out:
 +	return err;
 +}
@@ -6548,7 +6723,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +	p = dpages->dpages;
 +	for (i = 0; i < dpages->ndpage; i++)
 +		au_dpage_free(p++);
-+	kfree(dpages->dpages);
++	au_delayed_kfree(dpages->dpages);
 +}
 +
 +static int au_dpages_append(struct au_dcsub_pages *dpages,
@@ -6565,7 +6740,8 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +		err = -ENOMEM;
 +		sz = dpages->ndpage * sizeof(*dpages->dpages);
 +		p = au_kzrealloc(dpages->dpages, sz,
-+				 sz + sizeof(*dpages->dpages), gfp);
++				 sz + sizeof(*dpages->dpages), gfp,
++				 /*may_shrink*/0);
 +		if (unlikely(!p))
 +			goto out;
 +
@@ -6707,10 +6883,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/dcsub.h	2017-07-29 12:14:25.899708630 +0200
 @@ -0,0 +1,136 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -6847,10 +7023,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,438 @@
++++ linux/fs/aufs/debug.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,440 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -6992,25 +7168,24 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +void au_dpri_inode(struct inode *inode)
 +{
 +	struct au_iinfo *iinfo;
++	struct au_hinode *hi;
 +	aufs_bindex_t bindex;
 +	int err, hn;
 +
 +	err = do_pri_inode(-1, inode, -1, NULL);
-+	if (err || !au_test_aufs(inode->i_sb))
++	if (err || !au_test_aufs(inode->i_sb) || au_is_bad_inode(inode))
 +		return;
 +
 +	iinfo = au_ii(inode);
-+	if (!iinfo)
-+		return;
-+	dpri("i-1: bstart %d, bend %d, gen %d\n",
-+	     iinfo->ii_bstart, iinfo->ii_bend, au_iigen(inode, NULL));
-+	if (iinfo->ii_bstart < 0)
++	dpri("i-1: btop %d, bbot %d, gen %d\n",
++	     iinfo->ii_btop, iinfo->ii_bbot, au_iigen(inode, NULL));
++	if (iinfo->ii_btop < 0)
 +		return;
 +	hn = 0;
-+	for (bindex = iinfo->ii_bstart; bindex <= iinfo->ii_bend; bindex++) {
-+		hn = !!au_hn(iinfo->ii_hinode + bindex);
-+		do_pri_inode(bindex, iinfo->ii_hinode[0 + bindex].hi_inode, hn,
-+			     iinfo->ii_hinode[0 + bindex].hi_whdentry);
++	for (bindex = iinfo->ii_btop; bindex <= iinfo->ii_bbot; bindex++) {
++		hi = au_hinode(iinfo, bindex);
++		hn = !!au_hn(hi);
++		do_pri_inode(bindex, hi->hi_inode, hn, hi->hi_whdentry);
 +	}
 +}
 +
@@ -7028,7 +7203,9 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +{
 +	struct dentry *wh = NULL;
 +	int hn;
++	struct inode *inode;
 +	struct au_iinfo *iinfo;
++	struct au_hinode *hi;
 +
 +	if (!dentry || IS_ERR(dentry)) {
 +		dpri("d%d: err %ld\n", bindex, PTR_ERR(dentry));
@@ -7042,16 +7219,19 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +	     au_dcount(dentry), dentry->d_flags,
 +	     d_unhashed(dentry) ? "un" : "");
 +	hn = -1;
-+	if (bindex >= 0
-+	    && d_is_positive(dentry)
-+	    && au_test_aufs(dentry->d_sb)) {
-+		iinfo = au_ii(d_inode(dentry));
-+		if (iinfo) {
-+			hn = !!au_hn(iinfo->ii_hinode + bindex);
-+			wh = iinfo->ii_hinode[0 + bindex].hi_whdentry;
-+		}
-+	}
-+	do_pri_inode(bindex, d_inode(dentry), hn, wh);
++	inode = NULL;
++	if (d_is_positive(dentry))
++		inode = d_inode(dentry);
++	if (inode
++	    && au_test_aufs(dentry->d_sb)
++	    && bindex >= 0
++	    && !au_is_bad_inode(inode)) {
++		iinfo = au_ii(inode);
++		hi = au_hinode(iinfo, bindex);
++		hn = !!au_hn(hi);
++		wh = hi->hi_whdentry;
++	}
++	do_pri_inode(bindex, inode, hn, wh);
 +	return 0;
 +}
 +
@@ -7060,7 +7240,6 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +	struct au_dinfo *dinfo;
 +	aufs_bindex_t bindex;
 +	int err;
-+	struct au_hdentry *hdp;
 +
 +	err = do_pri_dentry(-1, dentry);
 +	if (err || !au_test_aufs(dentry->d_sb))
@@ -7069,15 +7248,14 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +	dinfo = au_di(dentry);
 +	if (!dinfo)
 +		return;
-+	dpri("d-1: bstart %d, bend %d, bwh %d, bdiropq %d, gen %d, tmp %d\n",
-+	     dinfo->di_bstart, dinfo->di_bend,
++	dpri("d-1: btop %d, bbot %d, bwh %d, bdiropq %d, gen %d, tmp %d\n",
++	     dinfo->di_btop, dinfo->di_bbot,
 +	     dinfo->di_bwh, dinfo->di_bdiropq, au_digen(dentry),
 +	     dinfo->di_tmpfile);
-+	if (dinfo->di_bstart < 0)
++	if (dinfo->di_btop < 0)
 +		return;
-+	hdp = dinfo->di_hdentry;
-+	for (bindex = dinfo->di_bstart; bindex <= dinfo->di_bend; bindex++)
-+		do_pri_dentry(bindex, hdp[0 + bindex].hd_dentry);
++	for (bindex = dinfo->di_btop; bindex <= dinfo->di_bbot; bindex++)
++		do_pri_dentry(bindex, au_hdentry(dinfo, bindex)->hd_dentry);
 +}
 +
 +static int do_pri_file(aufs_bindex_t bindex, struct file *file)
@@ -7148,10 +7326,10 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +	if (!sb || IS_ERR(sb))
 +		goto out;
 +
-+	dpri("s%d: {perm 0x%x, id %d, cnt %d, wbr %p}, "
++	dpri("s%d: {perm 0x%x, id %d, cnt %lld, wbr %p}, "
 +	     "%s, dev 0x%02x%02x, flags 0x%lx, cnt %d, active %d, "
 +	     "xino %d\n",
-+	     bindex, br->br_perm, br->br_id, atomic_read(&br->br_count),
++	     bindex, br->br_perm, br->br_id, au_br_count(br),
 +	     br->br_wbr, au_sbtype(sb), MAJOR(sb->s_dev), MINOR(sb->s_dev),
 +	     sb->s_flags, sb->s_count,
 +	     atomic_read(&sb->s_active), !!br->br_xino.xi_file);
@@ -7182,10 +7360,10 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +
 +	a->mnt.mnt_sb = sb;
 +	a->fake.br_path.mnt = &a->mnt;
-+	atomic_set(&a->fake.br_count, 0);
-+	smp_mb(); /* atomic_set */
++	au_br_count_init(&a->fake);
 +	err = do_pri_br(-1, &a->fake);
-+	kfree(a);
++	au_br_count_fin(&a->fake);
++	au_delayed_kfree(a);
 +	dpri("dev 0x%x\n", sb->s_dev);
 +	if (err || !au_test_aufs(sb))
 +		return;
@@ -7196,7 +7374,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +	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));
-+	for (bindex = 0; bindex <= sbinfo->si_bend; bindex++)
++	for (bindex = 0; bindex <= sbinfo->si_bbot; bindex++)
 +		do_pri_br(bindex, sbinfo->si_branch[0 + bindex]);
 +}
 +
@@ -7206,21 +7384,21 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +{
 +	struct inode *h_inode, *inode = d_inode(dentry);
 +	struct dentry *h_dentry;
-+	aufs_bindex_t bindex, bend, bi;
++	aufs_bindex_t bindex, bbot, bi;
 +
 +	if (!inode /* || au_di(dentry)->di_lsc == AuLsc_DI_TMP */)
 +		return;
 +
-+	bend = au_dbend(dentry);
-+	bi = au_ibend(inode);
-+	if (bi < bend)
-+		bend = bi;
-+	bindex = au_dbstart(dentry);
-+	bi = au_ibstart(inode);
++	bbot = au_dbbot(dentry);
++	bi = au_ibbot(inode);
++	if (bi < bbot)
++		bbot = bi;
++	bindex = au_dbtop(dentry);
++	bi = au_ibtop(inode);
 +	if (bi > bindex)
 +		bindex = bi;
 +
-+	for (; bindex <= bend; bindex++) {
++	for (; bindex <= bbot; bindex++) {
 +		h_dentry = au_h_dptr(dentry, bindex);
 +		if (!h_dentry)
 +			continue;
@@ -7289,10 +7467,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/debug.h	2017-07-29 12:14:25.899708630 +0200
 @@ -0,0 +1,225 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -7518,10 +7696,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,1136 @@
++++ linux/fs/aufs/dentry.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,1130 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -7544,14 +7722,6 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +#include <linux/namei.h>
 +#include "aufs.h"
 +
-+#define AuLkup_ALLOW_NEG	1
-+#define AuLkup_IGNORE_PERM	(1 << 1)
-+#define au_ftest_lkup(flags, name)	((flags) & AuLkup_##name)
-+#define au_fset_lkup(flags, name) \
-+	do { (flags) |= AuLkup_##name; } while (0)
-+#define au_fclr_lkup(flags, name) \
-+	do { (flags) &= ~AuLkup_##name; } while (0)
-+
 +struct au_do_lookup_args {
 +	unsigned int		flags;
 +	mode_t			type;
@@ -7579,7 +7749,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	br = au_sbr(dentry->d_sb, bindex);
 +	wh_able = !!au_br_whable(br->br_perm);
 +	if (wh_able)
-+		wh_found = au_wh_test(h_parent, wh_name, /*try_sio*/0);
++		wh_found = au_wh_test(h_parent, wh_name, ignore_perm);
 +	h_dentry = ERR_PTR(wh_found);
 +	if (!wh_found)
 +		goto real_lookup;
@@ -7587,7 +7757,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		goto out;
 +
 +	/* We found a whiteout */
-+	/* au_set_dbend(dentry, bindex); */
++	/* au_set_dbbot(dentry, bindex); */
 +	au_set_dbwh(dentry, bindex);
 +	if (!allow_neg)
 +		return NULL; /* success */
@@ -7612,10 +7782,10 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		   || (args->type && args->type != (h_inode->i_mode & S_IFMT)))
 +		goto out_neg;
 +
-+	if (au_dbend(dentry) <= bindex)
-+		au_set_dbend(dentry, bindex);
-+	if (au_dbstart(dentry) < 0 || bindex < au_dbstart(dentry))
-+		au_set_dbstart(dentry, bindex);
++	if (au_dbbot(dentry) <= bindex)
++		au_set_dbbot(dentry, bindex);
++	if (au_dbtop(dentry) < 0 || bindex < au_dbtop(dentry))
++		au_set_dbtop(dentry, bindex);
 +	au_set_h_dptr(dentry, bindex, h_dentry);
 +
 +	if (!d_is_dir(h_dentry)
@@ -7654,15 +7824,15 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 + * otherwise an error.
 + * can be called at unlinking with @type is zero.
 + */
-+int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type)
++int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t btop,
++		   unsigned int flags)
 +{
 +	int npositive, err;
 +	aufs_bindex_t bindex, btail, bdiropq;
 +	unsigned char isdir, dirperm1;
 +	struct qstr whname;
 +	struct au_do_lookup_args args = {
-+		.flags		= 0,
-+		.type		= type
++		.flags		= flags
 +	};
 +	const struct qstr *name = &dentry->d_name;
 +	struct dentry *parent;
@@ -7678,14 +7848,12 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		goto out;
 +
 +	isdir = !!d_is_dir(dentry);
-+	if (!type)
-+		au_fset_lkup(args.flags, ALLOW_NEG);
 +	dirperm1 = !!au_opt_test(au_mntflags(sb), DIRPERM1);
 +
 +	npositive = 0;
 +	parent = dget_parent(dentry);
 +	btail = au_dbtaildir(parent);
-+	for (bindex = bstart; bindex <= btail; bindex++) {
++	for (bindex = btop; bindex <= btail; bindex++) {
 +		struct dentry *h_parent, *h_dentry;
 +		struct inode *h_inode, *h_dir;
 +
@@ -7693,9 +7861,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		if (h_dentry) {
 +			if (d_is_positive(h_dentry))
 +				npositive++;
-+			if (type != S_IFDIR)
-+				break;
-+			continue;
++			break;
 +		}
 +		h_parent = au_h_dptr(parent, bindex);
 +		if (!h_parent || !d_is_dir(h_parent))
@@ -7736,11 +7902,11 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +
 +	if (npositive) {
 +		AuLabel(positive);
-+		au_update_dbstart(dentry);
++		au_update_dbtop(dentry);
 +	}
 +	err = npositive;
 +	if (unlikely(!au_opt_test(au_mntflags(sb), UDBA_NONE)
-+		     && au_dbstart(dentry) < 0)) {
++		     && au_dbtop(dentry) < 0)) {
 +		err = -EIO;
 +		AuIOErr("both of real entry and whiteout found, %pd, err %d\n",
 +			dentry, err);
@@ -7748,7 +7914,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +
 +out_parent:
 +	dput(parent);
-+	kfree(whname.name);
++	au_delayed_kfree(whname.name);
 +out:
 +	return err;
 +}
@@ -7802,10 +7968,10 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	}
 +
 +	err = 0;
-+	if (bindex < au_dbstart(dentry))
-+		au_set_dbstart(dentry, bindex);
-+	if (au_dbend(dentry) < bindex)
-+		au_set_dbend(dentry, bindex);
++	if (bindex < au_dbtop(dentry))
++		au_set_dbtop(dentry, bindex);
++	if (au_dbbot(dentry) < bindex)
++		au_set_dbbot(dentry, bindex);
 +	au_set_h_dptr(dentry, bindex, h_dentry);
 +
 +out:
@@ -7917,7 +8083,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +static int au_do_refresh_hdentry(struct dentry *dentry, struct dentry *parent)
 +{
 +	int err;
-+	aufs_bindex_t new_bindex, bindex, bend, bwh, bdiropq;
++	aufs_bindex_t new_bindex, bindex, bbot, bwh, bdiropq;
 +	struct au_hdentry tmp, *p, *q;
 +	struct au_dinfo *dinfo;
 +	struct super_block *sb;
@@ -7926,11 +8092,12 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +
 +	sb = dentry->d_sb;
 +	dinfo = au_di(dentry);
-+	bend = dinfo->di_bend;
++	bbot = dinfo->di_bbot;
 +	bwh = dinfo->di_bwh;
 +	bdiropq = dinfo->di_bdiropq;
-+	p = dinfo->di_hdentry + dinfo->di_bstart;
-+	for (bindex = dinfo->di_bstart; bindex <= bend; bindex++, p++) {
++	bindex = dinfo->di_btop;
++	p = au_hdentry(dinfo, bindex);
++	for (; bindex <= bbot; bindex++, p++) {
 +		if (!p->hd_dentry)
 +			continue;
 +
@@ -7949,7 +8116,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		}
 +
 +		/* swap two lower dentries, and loop again */
-+		q = dinfo->di_hdentry + new_bindex;
++		q = au_hdentry(dinfo, new_bindex);
 +		tmp = *q;
 +		*q = *p;
 +		*p = tmp;
@@ -7960,31 +8127,33 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	}
 +
 +	dinfo->di_bwh = -1;
-+	if (bwh >= 0 && bwh <= au_sbend(sb) && au_sbr_whable(sb, bwh))
++	if (bwh >= 0 && bwh <= au_sbbot(sb) && au_sbr_whable(sb, bwh))
 +		dinfo->di_bwh = bwh;
 +
 +	dinfo->di_bdiropq = -1;
 +	if (bdiropq >= 0
-+	    && bdiropq <= au_sbend(sb)
++	    && bdiropq <= au_sbbot(sb)
 +	    && au_sbr_whable(sb, bdiropq))
 +		dinfo->di_bdiropq = bdiropq;
 +
 +	err = -EIO;
-+	dinfo->di_bstart = -1;
-+	dinfo->di_bend = -1;
-+	bend = au_dbend(parent);
-+	p = dinfo->di_hdentry;
-+	for (bindex = 0; bindex <= bend; bindex++, p++)
++	dinfo->di_btop = -1;
++	dinfo->di_bbot = -1;
++	bbot = au_dbbot(parent);
++	bindex = 0;
++	p = au_hdentry(dinfo, bindex);
++	for (; bindex <= bbot; bindex++, p++)
 +		if (p->hd_dentry) {
-+			dinfo->di_bstart = bindex;
++			dinfo->di_btop = bindex;
 +			break;
 +		}
 +
-+	if (dinfo->di_bstart >= 0) {
-+		p = dinfo->di_hdentry + bend;
-+		for (bindex = bend; bindex >= 0; bindex--, p--)
++	if (dinfo->di_btop >= 0) {
++		bindex = bbot;
++		p = au_hdentry(dinfo, bindex);
++		for (; bindex >= 0; bindex--, p--)
 +			if (p->hd_dentry) {
-+				dinfo->di_bend = bindex;
++				dinfo->di_bbot = bindex;
 +				err = 0;
 +				break;
 +			}
@@ -8084,7 +8253,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +			       struct au_dinfo *tmp)
 +{
 +	int err;
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +	struct {
 +		struct dentry *dentry;
 +		struct inode *inode;
@@ -8097,16 +8266,16 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	struct dentry *h_dentry;
 +
 +	err = 0;
-+	AuDebugOn(dinfo->di_bstart < 0);
++	AuDebugOn(dinfo->di_btop < 0);
 +	orig_h.mode = 0;
-+	orig_h.dentry = dinfo->di_hdentry[dinfo->di_bstart].hd_dentry;
++	orig_h.dentry = au_hdentry(dinfo, dinfo->di_btop)->hd_dentry;
 +	orig_h.inode = NULL;
 +	if (d_is_positive(orig_h.dentry)) {
 +		orig_h.inode = d_inode(orig_h.dentry);
 +		orig_h.mode = orig_h.inode->i_mode & S_IFMT;
 +	}
-+	if (tmp->di_bstart >= 0) {
-+		tmp_h.dentry = tmp->di_hdentry[tmp->di_bstart].hd_dentry;
++	if (tmp->di_btop >= 0) {
++		tmp_h.dentry = au_hdentry(tmp, tmp->di_btop)->hd_dentry;
 +		if (d_is_positive(tmp_h.dentry)) {
 +			tmp_h.inode = d_inode(tmp_h.dentry);
 +			tmp_h.mode = tmp_h.inode->i_mode & S_IFMT;
@@ -8123,20 +8292,20 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +			goto out;
 +		}
 +		AuDebugOn(inode);
-+		AuDebugOn(dinfo->di_bstart != dinfo->di_bend);
++		AuDebugOn(dinfo->di_btop != dinfo->di_bbot);
 +		AuDebugOn(dinfo->di_bdiropq != -1);
 +
 +		if (!tmp_h.inode) {
 +			AuDbg("negative --> negative\n");
 +			/* should have only one negative lower */
-+			if (tmp->di_bstart >= 0
-+			    && tmp->di_bstart < dinfo->di_bstart) {
-+				AuDebugOn(tmp->di_bstart != tmp->di_bend);
-+				AuDebugOn(dinfo->di_bstart != dinfo->di_bend);
-+				au_set_h_dptr(dentry, dinfo->di_bstart, NULL);
++			if (tmp->di_btop >= 0
++			    && tmp->di_btop < dinfo->di_btop) {
++				AuDebugOn(tmp->di_btop != tmp->di_bbot);
++				AuDebugOn(dinfo->di_btop != dinfo->di_bbot);
++				au_set_h_dptr(dentry, dinfo->di_btop, NULL);
 +				au_di_cp(dinfo, tmp);
-+				hd = tmp->di_hdentry + tmp->di_bstart;
-+				au_set_h_dptr(dentry, tmp->di_bstart,
++				hd = au_hdentry(tmp, tmp->di_btop);
++				au_set_h_dptr(dentry, tmp->di_btop,
 +					      dget(hd->hd_dentry));
 +			}
 +			au_dbg_verify_dinode(dentry);
@@ -8161,7 +8330,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +			AuDbg("positive --> negative\n");
 +			/* or bypassing aufs */
 +			au_hide(dentry);
-+			if (tmp->di_bwh >= 0 && tmp->di_bwh <= dinfo->di_bstart)
++			if (tmp->di_bwh >= 0 && tmp->di_bwh <= dinfo->di_btop)
 +				dinfo->di_bwh = tmp->di_bwh;
 +			if (inode)
 +				err = au_refresh_hinode_self(inode);
@@ -8169,7 +8338,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		} else if (orig_h.mode == tmp_h.mode) {
 +			AuDbg("positive --> positive, same type\n");
 +			if (!S_ISDIR(orig_h.mode)
-+			    && dinfo->di_bstart > tmp->di_bstart) {
++			    && dinfo->di_btop > tmp->di_btop) {
 +				/*
 +				 * similar to the behaviour of removing and
 +				 * creating.
@@ -8180,19 +8349,19 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +				au_dbg_verify_dinode(dentry);
 +			} else {
 +				/* fill empty slots */
-+				if (dinfo->di_bstart > tmp->di_bstart)
-+					dinfo->di_bstart = tmp->di_bstart;
-+				if (dinfo->di_bend < tmp->di_bend)
-+					dinfo->di_bend = tmp->di_bend;
++				if (dinfo->di_btop > tmp->di_btop)
++					dinfo->di_btop = tmp->di_btop;
++				if (dinfo->di_bbot < tmp->di_bbot)
++					dinfo->di_bbot = tmp->di_bbot;
 +				dinfo->di_bwh = tmp->di_bwh;
 +				dinfo->di_bdiropq = tmp->di_bdiropq;
-+				hd = tmp->di_hdentry;
-+				bend = dinfo->di_bend;
-+				for (bindex = tmp->di_bstart; bindex <= bend;
-+				     bindex++) {
++				bbot = dinfo->di_bbot;
++				bindex = tmp->di_btop;
++				hd = au_hdentry(tmp, bindex);
++				for (; bindex <= bbot; bindex++, hd++) {
 +					if (au_h_dptr(dentry, bindex))
 +						continue;
-+					h_dentry = hd[bindex].hd_dentry;
++					h_dentry = hd->hd_dentry;
 +					if (!h_dentry)
 +						continue;
 +					AuDebugOn(d_is_negative(h_dentry));
@@ -8203,7 +8372,8 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +					au_set_h_dptr(dentry, bindex,
 +						      dget(h_dentry));
 +				}
-+				err = au_refresh_hinode(inode, dentry);
++				if (inode)
++					err = au_refresh_hinode(inode, dentry);
 +				au_dbg_verify_dinode(dentry);
 +			}
 +		} else {
@@ -8244,7 +8414,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +
 +int au_refresh_dentry(struct dentry *dentry, struct dentry *parent)
 +{
-+	int err, ebrange;
++	int err, ebrange, nbr;
 +	unsigned int sigen;
 +	struct au_dinfo *dinfo, *tmp;
 +	struct super_block *sb;
@@ -8260,8 +8430,9 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	if (unlikely(err))
 +		goto out;
 +
++	nbr = au_sbbot(sb) + 1;
 +	dinfo = au_di(dentry);
-+	err = au_di_realloc(dinfo, au_sbend(sb) + 1);
++	err = au_di_realloc(dinfo, nbr, /*may_shrink*/0);
 +	if (unlikely(err))
 +		goto out;
 +	ebrange = au_dbrange_test(dentry);
@@ -8269,7 +8440,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		ebrange = au_do_refresh_hdentry(dentry, parent);
 +
 +	if (d_unhashed(dentry) || ebrange /* || dinfo->di_tmpfile */) {
-+		AuDebugOn(au_dbstart(dentry) < 0 && au_dbend(dentry) >= 0);
++		AuDebugOn(au_dbtop(dentry) < 0 && au_dbbot(dentry) >= 0);
 +		if (d_really_is_positive(dentry)) {
 +			inode = d_inode(dentry);
 +			err = au_refresh_hinode_self(inode);
@@ -8292,7 +8463,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	 * if current working dir is removed, it returns an error.
 +	 * but the dentry is legal.
 +	 */
-+	err = au_lkup_dentry(dentry, /*bstart*/0, /*type*/0);
++	err = au_lkup_dentry(dentry, /*btop*/0, AuLkup_ALLOW_NEG);
 +	AuDbgDentry(dentry);
 +	au_di_swap(tmp, dinfo);
 +	if (err == -ENOENT)
@@ -8304,6 +8475,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +		au_dbg_verify_dinode(dentry);
 +		AuTraceErr(err);
 +	}
++	au_di_realloc(dinfo, nbr, /*may_shrink*/1); /* harmless if err */
 +	au_rw_write_unlock(&tmp->di_rwsem);
 +	au_di_free(tmp);
 +	if (unlikely(err))
@@ -8355,7 +8527,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +{
 +	int err;
 +	umode_t mode, h_mode;
-+	aufs_bindex_t bindex, btail, bstart, ibs, ibe;
++	aufs_bindex_t bindex, btail, btop, ibs, ibe;
 +	unsigned char plus, unhashed, is_root, h_plus, h_nfs, tmpfile;
 +	struct inode *h_inode, *h_cached_inode;
 +	struct dentry *h_dentry;
@@ -8381,15 +8553,15 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	if (do_udba && inode) {
 +		mode = (inode->i_mode & S_IFMT);
 +		plus = (inode->i_nlink > 0);
-+		ibs = au_ibstart(inode);
-+		ibe = au_ibend(inode);
++		ibs = au_ibtop(inode);
++		ibe = au_ibbot(inode);
 +	}
 +
-+	bstart = au_dbstart(dentry);
-+	btail = bstart;
++	btop = au_dbtop(dentry);
++	btail = btop;
 +	if (inode && S_ISDIR(inode->i_mode))
 +		btail = au_dbtaildir(dentry);
-+	for (bindex = bstart; bindex <= btail; bindex++) {
++	for (bindex = btop; bindex <= btail; bindex++) {
 +		h_dentry = au_h_dptr(dentry, bindex);
 +		if (!h_dentry)
 +			continue;
@@ -8571,7 +8743,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	inode = NULL;
 +	if (d_really_is_positive(dentry))
 +		inode = d_inode(dentry);
-+	if (unlikely(inode && is_bad_inode(inode))) {
++	if (unlikely(inode && au_is_bad_inode(inode))) {
 +		err = -EINVAL;
 +		AuTraceErr(err);
 +		goto out_dgrade;
@@ -8604,11 +8776,11 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +
 +	do_udba = !au_opt_test(au_mntflags(sb), UDBA_NONE);
 +	if (do_udba && inode) {
-+		aufs_bindex_t bstart = au_ibstart(inode);
++		aufs_bindex_t btop = au_ibtop(inode);
 +		struct inode *h_inode;
 +
-+		if (bstart >= 0) {
-+			h_inode = au_h_iptr(inode, bstart);
++		if (btop >= 0) {
++			h_inode = au_h_iptr(inode, btop);
 +			if (h_inode && au_test_higen(inode, h_inode)) {
 +				AuTraceErr(err);
 +				goto out_inval;
@@ -8617,7 +8789,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +	}
 +
 +	err = h_d_revalidate(dentry, inode, flags, do_udba);
-+	if (unlikely(!err && do_udba && au_dbstart(dentry) < 0)) {
++	if (unlikely(!err && do_udba && au_dbtop(dentry) < 0)) {
 +		err = -EIO;
 +		AuDbg("both of real entry and whiteout found, %p, err %d\n",
 +		      dentry, err);
@@ -8658,10 +8830,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,234 @@
++++ linux/fs/aufs/dentry.h	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,255 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -8698,13 +8870,27 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +	atomic_t		di_generation;
 +
 +	struct au_rwsem		di_rwsem;
-+	aufs_bindex_t		di_bstart, di_bend, di_bwh, di_bdiropq;
++	aufs_bindex_t		di_btop, di_bbot, di_bwh, di_bdiropq;
 +	unsigned char		di_tmpfile; /* to allow the different name */
-+	struct au_hdentry	*di_hdentry;
++	union {
++		struct au_hdentry	*di_hdentry;
++		struct llist_node	di_lnode;	/* delayed free */
++	};
 +} ____cacheline_aligned_in_smp;
 +
 +/* ---------------------------------------------------------------------- */
 +
++/* flags for au_lkup_dentry() */
++#define AuLkup_ALLOW_NEG	1
++#define AuLkup_IGNORE_PERM	(1 << 1)
++#define au_ftest_lkup(flags, name)	((flags) & AuLkup_##name)
++#define au_fset_lkup(flags, name) \
++	do { (flags) |= AuLkup_##name; } while (0)
++#define au_fclr_lkup(flags, name) \
++	do { (flags) &= ~AuLkup_##name; } while (0)
++
++/* ---------------------------------------------------------------------- */
++
 +/* dentry.c */
 +extern const struct dentry_operations aufs_dop, aufs_dop_noreval;
 +struct au_branch;
@@ -8712,7 +8898,8 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +int au_h_verify(struct dentry *h_dentry, unsigned int udba, struct inode *h_dir,
 +		struct dentry *h_parent, struct au_branch *br);
 +
-+int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type);
++int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t btop,
++		   unsigned int flags);
 +int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex, int wh);
 +int au_refresh_dentry(struct dentry *dentry, struct dentry *parent);
 +int au_reval_dpath(struct dentry *dentry, unsigned int sigen);
@@ -8726,7 +8913,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +void au_di_cp(struct au_dinfo *dst, struct au_dinfo *src);
 +int au_di_init(struct dentry *dentry);
 +void au_di_fin(struct dentry *dentry);
-+int au_di_realloc(struct au_dinfo *dinfo, int nbr);
++int au_di_realloc(struct au_dinfo *dinfo, int nbr, int may_shrink);
 +
 +void di_read_lock(struct dentry *d, int flags, unsigned int lsc);
 +void di_read_unlock(struct dentry *d, int flags);
@@ -8748,8 +8935,8 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +int au_dbrange_test(struct dentry *dentry);
 +void au_update_digen(struct dentry *dentry);
 +void au_update_dbrange(struct dentry *dentry, int do_put_zero);
-+void au_update_dbstart(struct dentry *dentry);
-+void au_update_dbend(struct dentry *dentry);
++void au_update_dbtop(struct dentry *dentry);
++void au_update_dbbot(struct dentry *dentry);
 +int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry);
 +
 +/* ---------------------------------------------------------------------- */
@@ -8820,22 +9007,28 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +	hdentry->hd_dentry = NULL;
 +}
 +
++static inline struct au_hdentry *au_hdentry(struct au_dinfo *di,
++					    aufs_bindex_t bindex)
++{
++	return di->di_hdentry + bindex;
++}
++
 +static inline void au_hdput(struct au_hdentry *hd)
 +{
 +	if (hd)
 +		dput(hd->hd_dentry);
 +}
 +
-+static inline aufs_bindex_t au_dbstart(struct dentry *dentry)
++static inline aufs_bindex_t au_dbtop(struct dentry *dentry)
 +{
 +	DiMustAnyLock(dentry);
-+	return au_di(dentry)->di_bstart;
++	return au_di(dentry)->di_btop;
 +}
 +
-+static inline aufs_bindex_t au_dbend(struct dentry *dentry)
++static inline aufs_bindex_t au_dbbot(struct dentry *dentry)
 +{
 +	DiMustAnyLock(dentry);
-+	return au_di(dentry)->di_bend;
++	return au_di(dentry)->di_bbot;
 +}
 +
 +static inline aufs_bindex_t au_dbwh(struct dentry *dentry)
@@ -8851,22 +9044,22 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +}
 +
 +/* todo: hard/soft set? */
-+static inline void au_set_dbstart(struct dentry *dentry, aufs_bindex_t bindex)
++static inline void au_set_dbtop(struct dentry *dentry, aufs_bindex_t bindex)
 +{
 +	DiMustWriteLock(dentry);
-+	au_di(dentry)->di_bstart = bindex;
++	au_di(dentry)->di_btop = bindex;
 +}
 +
-+static inline void au_set_dbend(struct dentry *dentry, aufs_bindex_t bindex)
++static inline void au_set_dbbot(struct dentry *dentry, aufs_bindex_t bindex)
 +{
 +	DiMustWriteLock(dentry);
-+	au_di(dentry)->di_bend = bindex;
++	au_di(dentry)->di_bbot = bindex;
 +}
 +
 +static inline void au_set_dbwh(struct dentry *dentry, aufs_bindex_t bindex)
 +{
 +	DiMustWriteLock(dentry);
-+	/* dbwh can be outside of bstart - bend range */
++	/* dbwh can be outside of btop - bbot range */
 +	au_di(dentry)->di_bwh = bindex;
 +}
 +
@@ -8896,10 +9089,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,550 @@
++++ linux/fs/aufs/dinfo.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,553 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -8924,10 +9117,8 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +void au_di_init_once(void *_dinfo)
 +{
 +	struct au_dinfo *dinfo = _dinfo;
-+	static struct lock_class_key aufs_di;
 +
 +	au_rw_init(&dinfo->di_rwsem);
-+	au_rw_class(&dinfo->di_rwsem, &aufs_di);
 +}
 +
 +struct au_dinfo *au_di_alloc(struct super_block *sb, unsigned int lsc)
@@ -8939,14 +9130,14 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	if (unlikely(!dinfo))
 +		goto out;
 +
-+	nbr = au_sbend(sb) + 1;
++	nbr = au_sbbot(sb) + 1;
 +	if (nbr <= 0)
 +		nbr = 1;
 +	dinfo->di_hdentry = kcalloc(nbr, sizeof(*dinfo->di_hdentry), GFP_NOFS);
 +	if (dinfo->di_hdentry) {
 +		au_rw_write_lock_nested(&dinfo->di_rwsem, lsc);
-+		dinfo->di_bstart = -1;
-+		dinfo->di_bend = -1;
++		dinfo->di_btop = -1;
++		dinfo->di_bbot = -1;
 +		dinfo->di_bwh = -1;
 +		dinfo->di_bdiropq = -1;
 +		dinfo->di_tmpfile = 0;
@@ -8955,7 +9146,7 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +		goto out;
 +	}
 +
-+	au_cache_free_dinfo(dinfo);
++	au_cache_dfree_dinfo(dinfo);
 +	dinfo = NULL;
 +
 +out:
@@ -8965,18 +9156,18 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +void au_di_free(struct au_dinfo *dinfo)
 +{
 +	struct au_hdentry *p;
-+	aufs_bindex_t bend, bindex;
++	aufs_bindex_t bbot, bindex;
 +
 +	/* dentry may not be revalidated */
-+	bindex = dinfo->di_bstart;
++	bindex = dinfo->di_btop;
 +	if (bindex >= 0) {
-+		bend = dinfo->di_bend;
-+		p = dinfo->di_hdentry + bindex;
-+		while (bindex++ <= bend)
++		bbot = dinfo->di_bbot;
++		p = au_hdentry(dinfo, bindex);
++		while (bindex++ <= bbot)
 +			au_hdput(p++);
 +	}
-+	kfree(dinfo->di_hdentry);
-+	au_cache_free_dinfo(dinfo);
++	au_delayed_kfree(dinfo->di_hdentry);
++	au_cache_dfree_dinfo(dinfo);
 +}
 +
 +void au_di_swap(struct au_dinfo *a, struct au_dinfo *b)
@@ -8995,8 +9186,8 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	} while (0)
 +
 +	DiSwap(p, hdentry);
-+	DiSwap(bi, bstart);
-+	DiSwap(bi, bend);
++	DiSwap(bi, btop);
++	DiSwap(bi, bbot);
 +	DiSwap(bi, bwh);
 +	DiSwap(bi, bdiropq);
 +	/* smp_mb(); */
@@ -9009,8 +9200,8 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	AuRwMustWriteLock(&dst->di_rwsem);
 +	AuRwMustWriteLock(&src->di_rwsem);
 +
-+	dst->di_bstart = src->di_bstart;
-+	dst->di_bend = src->di_bend;
++	dst->di_btop = src->di_btop;
++	dst->di_bbot = src->di_bbot;
 +	dst->di_bwh = src->di_bwh;
 +	dst->di_bdiropq = src->di_bdiropq;
 +	/* smp_mb(); */
@@ -9044,7 +9235,7 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	au_di_free(dinfo);
 +}
 +
-+int au_di_realloc(struct au_dinfo *dinfo, int nbr)
++int au_di_realloc(struct au_dinfo *dinfo, int nbr, int may_shrink)
 +{
 +	int err, sz;
 +	struct au_hdentry *hdp;
@@ -9052,10 +9243,11 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	AuRwMustWriteLock(&dinfo->di_rwsem);
 +
 +	err = -ENOMEM;
-+	sz = sizeof(*hdp) * (dinfo->di_bend + 1);
++	sz = sizeof(*hdp) * (dinfo->di_bbot + 1);
 +	if (!sz)
 +		sz = sizeof(*hdp);
-+	hdp = au_kzrealloc(dinfo->di_hdentry, sz, sizeof(*hdp) * nbr, GFP_NOFS);
++	hdp = au_kzrealloc(dinfo->di_hdentry, sz, sizeof(*hdp) * nbr, GFP_NOFS,
++			   may_shrink);
 +	if (hdp) {
 +		dinfo->di_hdentry = hdp;
 +		err = 0;
@@ -9220,10 +9412,10 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +
 +	DiMustAnyLock(dentry);
 +
-+	if (au_dbstart(dentry) < 0 || bindex < au_dbstart(dentry))
++	if (au_dbtop(dentry) < 0 || bindex < au_dbtop(dentry))
 +		return NULL;
 +	AuDebugOn(bindex < 0);
-+	d = au_di(dentry)->di_hdentry[0 + bindex].hd_dentry;
++	d = au_hdentry(au_di(dentry), bindex)->hd_dentry;
 +	AuDebugOn(d && au_dcount(d) <= 0);
 +	return d;
 +}
@@ -9241,8 +9433,8 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	AuDebugOn(d_really_is_negative(dentry));
 +
 +	h_dentry = NULL;
-+	if (au_dbstart(dentry) <= bindex
-+	    && bindex <= au_dbend(dentry))
++	if (au_dbtop(dentry) <= bindex
++	    && bindex <= au_dbbot(dentry))
 +		h_dentry = au_h_dptr(dentry, bindex);
 +	if (h_dentry && !au_d_linkable(h_dentry)) {
 +		dget(h_dentry);
@@ -9250,8 +9442,8 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	}
 +
 +	inode = d_inode(dentry);
-+	AuDebugOn(bindex < au_ibstart(inode));
-+	AuDebugOn(au_ibend(inode) < bindex);
++	AuDebugOn(bindex < au_ibtop(inode));
++	AuDebugOn(au_ibbot(inode) < bindex);
 +	h_inode = au_h_iptr(inode, bindex);
 +	h_dentry = d_find_alias(h_inode);
 +	if (h_dentry) {
@@ -9281,30 +9473,30 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +
 +aufs_bindex_t au_dbtail(struct dentry *dentry)
 +{
-+	aufs_bindex_t bend, bwh;
++	aufs_bindex_t bbot, bwh;
 +
-+	bend = au_dbend(dentry);
-+	if (0 <= bend) {
++	bbot = au_dbbot(dentry);
++	if (0 <= bbot) {
 +		bwh = au_dbwh(dentry);
 +		if (!bwh)
 +			return bwh;
-+		if (0 < bwh && bwh < bend)
++		if (0 < bwh && bwh < bbot)
 +			return bwh - 1;
 +	}
-+	return bend;
++	return bbot;
 +}
 +
 +aufs_bindex_t au_dbtaildir(struct dentry *dentry)
 +{
-+	aufs_bindex_t bend, bopq;
++	aufs_bindex_t bbot, bopq;
 +
-+	bend = au_dbtail(dentry);
-+	if (0 <= bend) {
++	bbot = au_dbtail(dentry);
++	if (0 <= bbot) {
 +		bopq = au_dbdiropq(dentry);
-+		if (0 <= bopq && bopq < bend)
-+			bend = bopq;
++		if (0 <= bopq && bopq < bbot)
++			bbot = bopq;
 +	}
-+	return bend;
++	return bbot;
 +}
 +
 +/* ---------------------------------------------------------------------- */
@@ -9312,11 +9504,14 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +void au_set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
 +		   struct dentry *h_dentry)
 +{
-+	struct au_hdentry *hd = au_di(dentry)->di_hdentry + bindex;
++	struct au_dinfo *dinfo;
++	struct au_hdentry *hd;
 +	struct au_branch *br;
 +
 +	DiMustWriteLock(dentry);
 +
++	dinfo = au_di(dentry);
++	hd = au_hdentry(dinfo, bindex);
 +	au_hdput(hd);
 +	hd->hd_dentry = h_dentry;
 +	if (h_dentry) {
@@ -9328,16 +9523,16 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +int au_dbrange_test(struct dentry *dentry)
 +{
 +	int err;
-+	aufs_bindex_t bstart, bend;
++	aufs_bindex_t btop, bbot;
 +
 +	err = 0;
-+	bstart = au_dbstart(dentry);
-+	bend = au_dbend(dentry);
-+	if (bstart >= 0)
-+		AuDebugOn(bend < 0 && bstart > bend);
++	btop = au_dbtop(dentry);
++	bbot = au_dbbot(dentry);
++	if (btop >= 0)
++		AuDebugOn(bbot < 0 && btop > bbot);
 +	else {
 +		err = -EIO;
-+		AuDebugOn(bend >= 0);
++		AuDebugOn(bbot >= 0);
 +	}
 +
 +	return err;
@@ -9366,72 +9561,73 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +	struct au_dinfo *dinfo;
 +	struct dentry *h_d;
 +	struct au_hdentry *hdp;
++	aufs_bindex_t bindex, bbot;
 +
 +	DiMustWriteLock(dentry);
 +
 +	dinfo = au_di(dentry);
-+	if (!dinfo || dinfo->di_bstart < 0)
++	if (!dinfo || dinfo->di_btop < 0)
 +		return;
 +
-+	hdp = dinfo->di_hdentry;
 +	if (do_put_zero) {
-+		aufs_bindex_t bindex, bend;
-+
-+		bend = dinfo->di_bend;
-+		for (bindex = dinfo->di_bstart; bindex <= bend; bindex++) {
-+			h_d = hdp[0 + bindex].hd_dentry;
++		bbot = dinfo->di_bbot;
++		bindex = dinfo->di_btop;
++		hdp = au_hdentry(dinfo, bindex);
++		for (; bindex <= bbot; bindex++, hdp++) {
++			h_d = hdp->hd_dentry;
 +			if (h_d && d_is_negative(h_d))
 +				au_set_h_dptr(dentry, bindex, NULL);
 +		}
 +	}
 +
-+	dinfo->di_bstart = -1;
-+	while (++dinfo->di_bstart <= dinfo->di_bend)
-+		if (hdp[0 + dinfo->di_bstart].hd_dentry)
++	dinfo->di_btop = 0;
++	hdp = au_hdentry(dinfo, dinfo->di_btop);
++	for (; dinfo->di_btop <= dinfo->di_bbot; dinfo->di_btop++, hdp++)
++		if (hdp->hd_dentry)
 +			break;
-+	if (dinfo->di_bstart > dinfo->di_bend) {
-+		dinfo->di_bstart = -1;
-+		dinfo->di_bend = -1;
++	if (dinfo->di_btop > dinfo->di_bbot) {
++		dinfo->di_btop = -1;
++		dinfo->di_bbot = -1;
 +		return;
 +	}
 +
-+	dinfo->di_bend++;
-+	while (0 <= --dinfo->di_bend)
-+		if (hdp[0 + dinfo->di_bend].hd_dentry)
++	hdp = au_hdentry(dinfo, dinfo->di_bbot);
++	for (; dinfo->di_bbot >= 0; dinfo->di_bbot--, hdp--)
++		if (hdp->hd_dentry)
 +			break;
-+	AuDebugOn(dinfo->di_bstart > dinfo->di_bend || dinfo->di_bend < 0);
++	AuDebugOn(dinfo->di_btop > dinfo->di_bbot || dinfo->di_bbot < 0);
 +}
 +
-+void au_update_dbstart(struct dentry *dentry)
++void au_update_dbtop(struct dentry *dentry)
 +{
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +	struct dentry *h_dentry;
 +
-+	bend = au_dbend(dentry);
-+	for (bindex = au_dbstart(dentry); bindex <= bend; bindex++) {
++	bbot = au_dbbot(dentry);
++	for (bindex = au_dbtop(dentry); bindex <= bbot; bindex++) {
 +		h_dentry = au_h_dptr(dentry, bindex);
 +		if (!h_dentry)
 +			continue;
 +		if (d_is_positive(h_dentry)) {
-+			au_set_dbstart(dentry, bindex);
++			au_set_dbtop(dentry, bindex);
 +			return;
 +		}
 +		au_set_h_dptr(dentry, bindex, NULL);
 +	}
 +}
 +
-+void au_update_dbend(struct dentry *dentry)
++void au_update_dbbot(struct dentry *dentry)
 +{
-+	aufs_bindex_t bindex, bstart;
++	aufs_bindex_t bindex, btop;
 +	struct dentry *h_dentry;
 +
-+	bstart = au_dbstart(dentry);
-+	for (bindex = au_dbend(dentry); bindex >= bstart; bindex--) {
++	btop = au_dbtop(dentry);
++	for (bindex = au_dbbot(dentry); bindex >= btop; bindex--) {
 +		h_dentry = au_h_dptr(dentry, bindex);
 +		if (!h_dentry)
 +			continue;
 +		if (d_is_positive(h_dentry)) {
-+			au_set_dbend(dentry, bindex);
++			au_set_dbbot(dentry, bindex);
 +			return;
 +		}
 +		au_set_h_dptr(dentry, bindex, NULL);
@@ -9440,20 +9636,20 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +
 +int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry)
 +{
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +
-+	bend = au_dbend(dentry);
-+	for (bindex = au_dbstart(dentry); bindex <= bend; bindex++)
++	bbot = au_dbbot(dentry);
++	for (bindex = au_dbtop(dentry); bindex <= bbot; bindex++)
 +		if (au_h_dptr(dentry, bindex) == h_dentry)
 +			return bindex;
 +	return -1;
 +}
 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,758 @@
++++ linux/fs/aufs/dir.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,764 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -9509,7 +9705,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +loff_t au_dir_size(struct file *file, struct dentry *dentry)
 +{
 +	loff_t sz;
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +	struct file *h_file;
 +	struct dentry *h_dentry;
 +
@@ -9517,9 +9713,9 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	if (file) {
 +		AuDebugOn(!d_is_dir(file->f_path.dentry));
 +
-+		bend = au_fbend_dir(file);
-+		for (bindex = au_fbstart(file);
-+		     bindex <= bend && sz < KMALLOC_MAX_SIZE;
++		bbot = au_fbbot_dir(file);
++		for (bindex = au_fbtop(file);
++		     bindex <= bbot && sz < KMALLOC_MAX_SIZE;
 +		     bindex++) {
 +			h_file = au_hf_dir(file, bindex);
 +			if (h_file && file_inode(h_file))
@@ -9529,9 +9725,9 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +		AuDebugOn(!dentry);
 +		AuDebugOn(!d_is_dir(dentry));
 +
-+		bend = au_dbtaildir(dentry);
-+		for (bindex = au_dbstart(dentry);
-+		     bindex <= bend && sz < KMALLOC_MAX_SIZE;
++		bbot = au_dbtaildir(dentry);
++		for (bindex = au_dbtop(dentry);
++		     bindex <= bbot && sz < KMALLOC_MAX_SIZE;
 +		     bindex++) {
 +			h_dentry = au_h_dptr(dentry, bindex);
 +			if (h_dentry && d_is_positive(h_dentry))
@@ -9564,7 +9760,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	struct au_branch *br;
 +	struct au_hinode *hdir;
 +	int err;
-+	aufs_bindex_t bstart, bindex;
++	aufs_bindex_t btop, bindex;
 +
 +	sb = a->dentry->d_sb;
 +	if (d_really_is_negative(a->dentry))
@@ -9573,9 +9769,9 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	aufs_read_lock(a->dentry, AuLock_DW); /* noflush */
 +
 +	dir = d_inode(a->dentry);
-+	bstart = au_ibstart(dir);
++	btop = au_ibtop(dir);
 +	bindex = au_br_index(sb, a->brid);
-+	if (bindex < bstart)
++	if (bindex < btop)
 +		goto out_unlock;
 +
 +	br = au_sbr(sb, bindex);
@@ -9585,17 +9781,17 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	h_path.mnt = au_br_mnt(br);
 +	au_dtime_store(&dt, a->dentry, &h_path);
 +
-+	br = au_sbr(sb, bstart);
++	br = au_sbr(sb, btop);
 +	if (!au_br_writable(br->br_perm))
 +		goto out_unlock;
-+	h_path.dentry = au_h_dptr(a->dentry, bstart);
++	h_path.dentry = au_h_dptr(a->dentry, btop);
 +	h_path.mnt = au_br_mnt(br);
 +	err = vfsub_mnt_want_write(h_path.mnt);
 +	if (err)
 +		goto out_unlock;
-+	hdir = au_hi(dir, bstart);
++	hdir = au_hi(dir, btop);
 +	au_hn_imtx_lock_nested(hdir, AuLsc_I_PARENT);
-+	h_dir = au_h_iptr(dir, bstart);
++	h_dir = au_h_iptr(dir, btop);
 +	if (h_dir->i_nlink
 +	    && timespec_compare(&h_dir->i_mtime, &dt.dt_mtime) < 0) {
 +		dt.dt_h_path = h_path;
@@ -9610,13 +9806,13 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +out:
 +	dput(a->dentry);
 +	au_nwt_done(&au_sbi(sb)->si_nowait);
-+	kfree(arg);
++	au_delayed_kfree(arg);
 +}
 +
 +void au_dir_ts(struct inode *dir, aufs_bindex_t bindex)
 +{
 +	int perm, wkq_err;
-+	aufs_bindex_t bstart;
++	aufs_bindex_t btop;
 +	struct au_dir_ts_arg *arg;
 +	struct dentry *dentry;
 +	struct super_block *sb;
@@ -9626,13 +9822,13 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	dentry = d_find_any_alias(dir);
 +	AuDebugOn(!dentry);
 +	sb = dentry->d_sb;
-+	bstart = au_ibstart(dir);
-+	if (bstart == bindex) {
++	btop = au_ibtop(dir);
++	if (btop == bindex) {
 +		au_cpup_attr_timesizes(dir);
 +		goto out;
 +	}
 +
-+	perm = au_sbr_perm(sb, bstart);
++	perm = au_sbr_perm(sb, btop);
 +	if (!au_br_writable(perm))
 +		goto out;
 +
@@ -9646,7 +9842,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	if (unlikely(wkq_err)) {
 +		pr_err("wkq %d\n", wkq_err);
 +		dput(dentry);
-+		kfree(arg);
++		au_delayed_kfree(arg);
 +	}
 +
 +out:
@@ -9659,24 +9855,24 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +{
 +	int err;
 +	unsigned int flags;
-+	aufs_bindex_t bindex, btail, bstart;
++	aufs_bindex_t bindex, btail, btop;
 +	struct dentry *dentry, *h_dentry;
 +	struct file *h_file;
 +
 +	/* open all lower dirs */
 +	dentry = file->f_path.dentry;
-+	bstart = au_dbstart(dentry);
-+	for (bindex = au_fbstart(file); bindex < bstart; bindex++)
++	btop = au_dbtop(dentry);
++	for (bindex = au_fbtop(file); bindex < btop; bindex++)
 +		au_set_h_fptr(file, bindex, NULL);
-+	au_set_fbstart(file, bstart);
++	au_set_fbtop(file, btop);
 +
 +	btail = au_dbtaildir(dentry);
-+	for (bindex = au_fbend_dir(file); btail < bindex; bindex--)
++	for (bindex = au_fbbot_dir(file); btail < bindex; bindex--)
 +		au_set_h_fptr(file, bindex, NULL);
-+	au_set_fbend_dir(file, btail);
++	au_set_fbbot_dir(file, btail);
 +
 +	flags = vfsub_file_flags(file);
-+	for (bindex = bstart; bindex <= btail; bindex++) {
++	for (bindex = btop; bindex <= btail; bindex++) {
 +		h_dentry = au_h_dptr(dentry, bindex);
 +		if (!h_dentry)
 +			continue;
@@ -9713,10 +9909,10 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	mnt = file->f_path.mnt;
 +	dentry = file->f_path.dentry;
 +	file->f_version = d_inode(dentry)->i_version;
-+	bindex = au_dbstart(dentry);
-+	au_set_fbstart(file, bindex);
++	bindex = au_dbtop(dentry);
++	au_set_fbtop(file, bindex);
 +	btail = au_dbtaildir(dentry);
-+	au_set_fbend_dir(file, btail);
++	au_set_fbbot_dir(file, btail);
 +	for (; !err && bindex <= btail; bindex++) {
 +		h_dentry = au_h_dptr(dentry, bindex);
 +		if (!h_dentry)
@@ -9739,10 +9935,10 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +		return 0; /* success */
 +
 +	/* close all */
-+	for (bindex = au_fbstart(file); bindex <= btail; bindex++)
++	for (bindex = au_fbtop(file); bindex <= btail; bindex++)
 +		au_set_h_fptr(file, bindex, NULL);
-+	au_set_fbstart(file, -1);
-+	au_set_fbend_dir(file, -1);
++	au_set_fbtop(file, -1);
++	au_set_fbbot_dir(file, -1);
 +
 +	return err;
 +}
@@ -9765,7 +9961,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +		};
 +		err = au_do_open(file, &args);
 +		if (unlikely(err))
-+			kfree(fidir);
++			au_delayed_kfree(fidir);
 +	}
 +	si_read_unlock(sb);
 +	return err;
@@ -9777,8 +9973,11 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	struct au_vdir *vdir_cache;
 +	struct au_finfo *finfo;
 +	struct au_fidir *fidir;
-+	aufs_bindex_t bindex, bend;
++	struct au_hfile *hf;
++	aufs_bindex_t bindex, bbot;
++	int execed, delayed;
 +
++	delayed = (current->flags & PF_KTHREAD) || in_interrupt();
 +	finfo = au_fi(file);
 +	fidir = finfo->fi_hdir;
 +	if (fidir) {
@@ -9786,22 +9985,25 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +			    &au_sbi(file->f_path.dentry->d_sb)->si_files);
 +		vdir_cache = fidir->fd_vdir_cache; /* lock-free */
 +		if (vdir_cache)
-+			au_vdir_free(vdir_cache);
++			au_vdir_free(vdir_cache, delayed);
 +
 +		bindex = finfo->fi_btop;
 +		if (bindex >= 0) {
++			execed = vfsub_file_execed(file);
++			hf = fidir->fd_hfile + bindex;
 +			/*
 +			 * calls fput() instead of filp_close(),
 +			 * since no dnotify or lock for the lower file.
 +			 */
-+			bend = fidir->fd_bbot;
-+			for (; bindex <= bend; bindex++)
-+				au_set_h_fptr(file, bindex, NULL);
++			bbot = fidir->fd_bbot;
++			for (; bindex <= bbot; bindex++, hf++)
++				if (hf->hf_file)
++					au_hfput(hf, execed);
 +		}
-+		kfree(fidir);
++		au_delayed_kfree(fidir);
 +		finfo->fi_hdir = NULL;
 +	}
-+	au_finfo_fin(file);
++	au_finfo_fin(file, delayed);
 +	return 0;
 +}
 +
@@ -9810,12 +10012,12 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +static int au_do_flush_dir(struct file *file, fl_owner_t id)
 +{
 +	int err;
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +	struct file *h_file;
 +
 +	err = 0;
-+	bend = au_fbend_dir(file);
-+	for (bindex = au_fbstart(file); !err && bindex <= bend; bindex++) {
++	bbot = au_fbbot_dir(file);
++	for (bindex = au_fbtop(file); !err && bindex <= bbot; bindex++) {
 +		h_file = au_hf_dir(file, bindex);
 +		if (h_file)
 +			err = vfsub_flush(h_file, id);
@@ -9833,7 +10035,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +static int au_do_fsync_dir_no_file(struct dentry *dentry, int datasync)
 +{
 +	int err;
-+	aufs_bindex_t bend, bindex;
++	aufs_bindex_t bbot, bindex;
 +	struct inode *inode;
 +	struct super_block *sb;
 +
@@ -9841,8 +10043,8 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	sb = dentry->d_sb;
 +	inode = d_inode(dentry);
 +	IMustLock(inode);
-+	bend = au_dbend(dentry);
-+	for (bindex = au_dbstart(dentry); !err && bindex <= bend; bindex++) {
++	bbot = au_dbbot(dentry);
++	for (bindex = au_dbtop(dentry); !err && bindex <= bbot; bindex++) {
 +		struct path h_path;
 +
 +		if (au_test_ro(sb, bindex, inode))
@@ -9861,7 +10063,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +static int au_do_fsync_dir(struct file *file, int datasync)
 +{
 +	int err;
-+	aufs_bindex_t bend, bindex;
++	aufs_bindex_t bbot, bindex;
 +	struct file *h_file;
 +	struct super_block *sb;
 +	struct inode *inode;
@@ -9872,8 +10074,8 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +
 +	inode = file_inode(file);
 +	sb = inode->i_sb;
-+	bend = au_fbend_dir(file);
-+	for (bindex = au_fbstart(file); !err && bindex <= bend; bindex++) {
++	bbot = au_fbbot_dir(file);
++	for (bindex = au_fbtop(file); !err && bindex <= bbot; bindex++) {
 +		h_file = au_hf_dir(file, bindex);
 +		if (!h_file || au_test_ro(sb, bindex, inode))
 +			continue;
@@ -9947,7 +10149,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	if (unlikely(err))
 +		goto out_unlock;
 +
-+	h_inode = au_h_iptr(inode, au_ibstart(inode));
++	h_inode = au_h_iptr(inode, au_ibtop(inode));
 +	if (!au_test_nfsd()) {
 +		err = au_vdir_fill_de(file, ctx);
 +		fsstack_copy_attr_atime(inode, h_inode);
@@ -10116,7 +10318,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +{
 +	int err;
 +	unsigned int rdhash;
-+	aufs_bindex_t bindex, bstart, btail;
++	aufs_bindex_t bindex, btop, btail;
 +	struct au_nhash whlist;
 +	struct test_empty_arg arg = {
 +		.ctx = {
@@ -10136,20 +10338,20 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +
 +	arg.flags = 0;
 +	arg.whlist = &whlist;
-+	bstart = au_dbstart(dentry);
++	btop = au_dbtop(dentry);
 +	if (au_opt_test(au_mntflags(dentry->d_sb), SHWH))
 +		au_fset_testempty(arg.flags, SHWH);
 +	test_empty = do_test_empty;
 +	if (au_opt_test(au_mntflags(dentry->d_sb), DIRPERM1))
 +		test_empty = sio_test_empty;
-+	arg.bindex = bstart;
++	arg.bindex = btop;
 +	err = test_empty(dentry, &arg);
 +	if (unlikely(err))
 +		goto out_whlist;
 +
 +	au_fset_testempty(arg.flags, WHONLY);
 +	btail = au_dbtaildir(dentry);
-+	for (bindex = bstart + 1; !err && bindex <= btail; bindex++) {
++	for (bindex = btop + 1; !err && bindex <= btail; bindex++) {
 +		struct dentry *h_dentry;
 +
 +		h_dentry = au_h_dptr(dentry, bindex);
@@ -10181,7 +10383,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	if (au_opt_test(au_mntflags(dentry->d_sb), SHWH))
 +		au_fset_testempty(arg.flags, SHWH);
 +	btail = au_dbtaildir(dentry);
-+	for (bindex = au_dbstart(dentry); !err && bindex <= btail; bindex++) {
++	for (bindex = au_dbtop(dentry); !err && bindex <= btail; bindex++) {
 +		struct dentry *h_dentry;
 +
 +		h_dentry = au_h_dptr(dentry, bindex);
@@ -10212,10 +10414,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,131 @@
++++ linux/fs/aufs/dir.h	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,137 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -10258,7 +10460,10 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +
 +struct au_vdir_dehstr {
 +	struct hlist_node	hash;
-+	struct au_vdir_destr	*str;
++	union {
++		struct au_vdir_destr	*str;
++		struct llist_node	lnode;	/* delayed free */
++	};
 +} ____cacheline_aligned_in_smp;
 +
 +struct au_vdir_de {
@@ -10296,7 +10501,10 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +
 +	unsigned long	vd_version;
 +	unsigned int	vd_deblk_sz;
-+	unsigned long	vd_jiffy;
++	union {
++		unsigned long		vd_jiffy;
++		struct llist_node	vd_lnode;	/* delayed free */
++	};
 +} ____cacheline_aligned_in_smp;
 +
 +/* ---------------------------------------------------------------------- */
@@ -10320,7 +10528,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +int au_nhash_append_wh(struct au_nhash *whlist, char *name, int nlen, ino_t ino,
 +		       unsigned int d_type, aufs_bindex_t bindex,
 +		       unsigned char shwh);
-+void au_vdir_free(struct au_vdir *vdir);
++void au_vdir_free(struct au_vdir *vdir, int atonce);
 +int au_vdir_init(struct file *file);
 +int au_vdir_fill_de(struct file *file, struct dir_context *ctx);
 +
@@ -10347,10 +10555,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/dynop.c	2017-09-13 12:15:05.719346474 +0200
 @@ -0,0 +1,369 @@
 +/*
-+ * Copyright (C) 2010-2016 Junjiro R. Okajima
++ * Copyright (C) 2010-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -10378,17 +10586,17 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 + * How large will these lists be?
 + * Usually just a few elements, 20-30 at most for each, I guess.
 + */
-+static struct au_splhead dynop[AuDyLast];
++static struct au_sphlhead dynop[AuDyLast];
 +
-+static struct au_dykey *dy_gfind_get(struct au_splhead *spl, const void *h_op)
++static struct au_dykey *dy_gfind_get(struct au_sphlhead *sphl, const void *h_op)
 +{
 +	struct au_dykey *key, *tmp;
-+	struct list_head *head;
++	struct hlist_head *head;
 +
 +	key = NULL;
-+	head = &spl->head;
++	head = &sphl->head;
 +	rcu_read_lock();
-+	list_for_each_entry_rcu(tmp, head, dk_list)
++	hlist_for_each_entry_rcu(tmp, head, dk_hnode)
 +		if (tmp->dk_op.dy_hop == h_op) {
 +			key = tmp;
 +			kref_get(&key->dk_kref);
@@ -10435,24 +10643,24 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +}
 +
 +/* kref_get() if @key is already added */
-+static struct au_dykey *dy_gadd(struct au_splhead *spl, struct au_dykey *key)
++static struct au_dykey *dy_gadd(struct au_sphlhead *sphl, struct au_dykey *key)
 +{
 +	struct au_dykey *tmp, *found;
-+	struct list_head *head;
++	struct hlist_head *head;
 +	const void *h_op = key->dk_op.dy_hop;
 +
 +	found = NULL;
-+	head = &spl->head;
-+	spin_lock(&spl->spin);
-+	list_for_each_entry(tmp, head, dk_list)
++	head = &sphl->head;
++	spin_lock(&sphl->spin);
++	hlist_for_each_entry(tmp, head, dk_hnode)
 +		if (tmp->dk_op.dy_hop == h_op) {
 +			kref_get(&tmp->dk_kref);
 +			found = tmp;
 +			break;
 +		}
 +	if (!found)
-+		list_add_rcu(&key->dk_list, head);
-+	spin_unlock(&spl->spin);
++		hlist_add_head_rcu(&key->dk_hnode, head);
++	spin_unlock(&sphl->spin);
 +
 +	if (!found)
 +		DyPrSym(key);
@@ -10465,17 +10673,17 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +
 +	key = container_of(rcu, struct au_dykey, dk_rcu);
 +	DyPrSym(key);
-+	kfree(key);
++	kfree(key);	/* not delayed */
 +}
 +
 +static void dy_free(struct kref *kref)
 +{
 +	struct au_dykey *key;
-+	struct au_splhead *spl;
++	struct au_sphlhead *sphl;
 +
 +	key = container_of(kref, struct au_dykey, dk_kref);
-+	spl = dynop + key->dk_op.dy_type;
-+	au_spl_del_rcu(&key->dk_list, spl);
++	sphl = dynop + key->dk_op.dy_type;
++	au_sphl_del_rcu(&key->dk_hnode, sphl);
 +	call_rcu(&key->dk_rcu, dy_free_rcu);
 +}
 +
@@ -10560,7 +10768,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +static struct au_dykey *dy_get(struct au_dynop *op, struct au_branch *br)
 +{
 +	struct au_dykey *key, *old;
-+	struct au_splhead *spl;
++	struct au_sphlhead *sphl;
 +	struct op {
 +		unsigned int sz;
 +		void (*set)(struct au_dykey *key, const void *h_op,
@@ -10574,8 +10782,8 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +	};
 +	const struct op *p;
 +
-+	spl = dynop + op->dy_type;
-+	key = dy_gfind_get(spl, op->dy_hop);
++	sphl = dynop + op->dy_type;
++	key = dy_gfind_get(sphl, op->dy_hop);
 +	if (key)
 +		goto out_add; /* success */
 +
@@ -10589,9 +10797,9 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +	key->dk_op.dy_hop = op->dy_hop;
 +	kref_init(&key->dk_kref);
 +	p->set(key, op->dy_hop, au_br_sb(br));
-+	old = dy_gadd(spl, key);
++	old = dy_gadd(sphl, key);
 +	if (old) {
-+		kfree(key);
++		au_delayed_kfree(key);
 +		key = old;
 +	}
 +
@@ -10672,30 +10880,30 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +int au_dy_irefresh(struct inode *inode)
 +{
 +	int err;
-+	aufs_bindex_t bstart;
++	aufs_bindex_t btop;
 +	struct inode *h_inode;
 +
 +	err = 0;
 +	if (S_ISREG(inode->i_mode)) {
-+		bstart = au_ibstart(inode);
-+		h_inode = au_h_iptr(inode, bstart);
-+		err = au_dy_iaop(inode, bstart, h_inode);
++		btop = au_ibtop(inode);
++		h_inode = au_h_iptr(inode, btop);
++		err = au_dy_iaop(inode, btop, h_inode);
 +	}
 +	return err;
 +}
 +
 +void au_dy_arefresh(int do_dx)
 +{
-+	struct au_splhead *spl;
-+	struct list_head *head;
++	struct au_sphlhead *sphl;
++	struct hlist_head *head;
 +	struct au_dykey *key;
 +
-+	spl = dynop + AuDy_AOP;
-+	head = &spl->head;
-+	spin_lock(&spl->spin);
-+	list_for_each_entry(key, head, dk_list)
++	sphl = dynop + AuDy_AOP;
++	head = &sphl->head;
++	spin_lock(&sphl->spin);
++	hlist_for_each_entry(key, head, dk_hnode)
 +		dy_adx((void *)key, do_dx);
-+	spin_unlock(&spl->spin);
++	spin_unlock(&sphl->spin);
 +}
 +
 +/* ---------------------------------------------------------------------- */
@@ -10708,7 +10916,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +	BUILD_BUG_ON(offsetof(struct au_dyaop, da_key));
 +
 +	for (i = 0; i < AuDyLast; i++)
-+		au_spl_init(dynop + i);
++		au_sphl_init(dynop + i);
 +}
 +
 +void au_dy_fin(void)
@@ -10716,14 +10924,14 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +	int i;
 +
 +	for (i = 0; i < AuDyLast; i++)
-+		WARN_ON(!list_empty(&dynop[i].head));
++		WARN_ON(!hlist_empty(&dynop[i].head));
 +}
 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/dynop.h	2017-07-29 12:14:25.899708630 +0200
 @@ -0,0 +1,74 @@
 +/*
-+ * Copyright (C) 2010-2016 Junjiro R. Okajima
++ * Copyright (C) 2010-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -10763,7 +10971,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 +
 +struct au_dykey {
 +	union {
-+		struct list_head	dk_list;
++		struct hlist_node	dk_hnode;
 +		struct rcu_head		dk_rcu;
 +	};
 +	struct au_dynop		dk_op;
@@ -10798,10 +11006,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
-@@ -0,0 +1,832 @@
++++ linux/fs/aufs/export.c	2017-09-13 12:15:05.719346474 +0200
+@@ -0,0 +1,838 @@
 +/*
-+ * Copyright (C) 2005-2016 Junjiro R. Okajima
++ * Copyright (C) 2005-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -10827,7 +11035,6 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +#include <linux/nsproxy.h>
 +#include <linux/random.h>
 +#include <linux/writeback.h>
-+#include "../fs/mount.h"
 +#include "aufs.h"
 +
 +union conv {
@@ -11035,7 +11242,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +
 +	dentry = ERR_PTR(-ESTALE);
 +	sigen = au_sigen(sb);
-+	if (unlikely(is_bad_inode(inode)
++	if (unlikely(au_is_bad_inode(inode)
 +		     || IS_DEADDIR(inode)
 +		     || sigen != au_iigen(inode, NULL)))
 +		goto out_iput;
@@ -11221,7 +11428,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	}
 +
 +out_name:
-+	free_page((unsigned long)arg.name);
++	au_delayed_free_page((unsigned long)arg.name);
 +out_file:
 +	fput(file);
 +out:
@@ -11317,9 +11524,11 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	h_mnt = au_br_mnt(br);
 +	h_sb = h_mnt->mnt_sb;
 +	/* todo: call lower fh_to_dentry()? fh_to_parent()? */
++	lockdep_off();
 +	h_parent = exportfs_decode_fh(h_mnt, (void *)(fh + Fh_tail),
 +				      fh_len - Fh_tail, fh[Fh_h_type],
 +				      h_acceptable, /*context*/NULL);
++	lockdep_on();
 +	dentry = h_parent;
 +	if (unlikely(!h_parent || IS_ERR(h_parent))) {
 +		AuWarn1("%s decode_fh failed, %ld\n",
@@ -11373,7 +11582,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +			dentry = ERR_PTR(-ESTALE);
 +		}
 +out_pathname:
-+	free_page((unsigned long)pathname);
++	au_delayed_free_page((unsigned long)pathname);
 +out_h_parent:
 +	dput(h_parent);
 +out:
@@ -11423,7 +11632,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +
 +	/* is the parent dir cached? */
 +	br = au_sbr(sb, nsi_lock.bindex);
-+	atomic_inc(&br->br_count);
++	au_br_get(br);
 +	dentry = decode_by_dir_ino(sb, ino, dir_ino, &nsi_lock);
 +	if (IS_ERR(dentry))
 +		goto out_unlock;
@@ -11447,7 +11656,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	dentry = ERR_PTR(-ESTALE);
 +out_unlock:
 +	if (br)
-+		atomic_dec(&br->br_count);
++		au_br_put(br);
 +	si_read_unlock(sb);
 +out:
 +	AuTraceErrPtr(dentry);
@@ -11514,7 +11723,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	err = -EIO;
 +	parent = NULL;
 +	ii_read_lock_child(inode);
-+	bindex = au_ibstart(inode);
++	bindex = au_ibtop(inode);
 +	if (!dir) {
 +		dentry = d_find_any_alias(inode);
 +		if (unlikely(!dentry))
@@ -11589,7 +11798,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	sb = inode->i_sb;
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +	ii_write_lock_child(inode);
-+	bindex = au_ibstart(inode);
++	bindex = au_ibtop(inode);
 +	AuDebugOn(bindex < 0);
 +	h_inode = au_h_iptr(inode, bindex);
 +
@@ -11625,6 +11834,11 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	struct au_sbinfo *sbinfo;
 +	__u32 u;
 +
++	BUILD_BUG_ON_MSG(IS_BUILTIN(CONFIG_AUFS_FS)
++			 && IS_MODULE(CONFIG_EXPORTFS),
++			 AUFS_NAME ": unsupported configuration "
++			 "CONFIG_EXPORTFS=m and CONFIG_AUFS_FS=y");
++
 +	sb->s_export_op = &aufs_export_op;
 +	sbinfo = au_sbi(sb);
 +	sbinfo->si_xigen = NULL;
@@ -11634,10 +11848,10 @@ 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	2016-02-28 11:26:44.740228806 +0100
++++ linux/fs/aufs/fhsm.c	2017-07-29 12:14:25.903042072 +0200
 @@ -0,0 +1,426 @@
 +/*
-+ * Copyright (C) 2011-2016 Junjiro R. Okajima
++ * Copyright (C) 2011-2017 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -11793,12 +12007,12 @@ diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c
 +
 +void au_fhsm_wrote_all(struct super_block *sb, int force)
 +{
-+	aufs_bindex_t bindex, bend;
++	aufs_bindex_t bindex, bbot;
 +	struct au_branch *br;
<Skipped 7022 lines>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel.git/commitdiff/98a46a8c9ef0a8dd1e294bf7d5b96fb2f995b403




More information about the pld-cvs-commit mailing list