]> git.pld-linux.org Git - packages/kernel.git/blobdiff - kernel-aufs3.patch
- 3.10.20
[packages/kernel.git] / kernel-aufs3.patch
index c47b8f30e429ea3d0710e8f6497350ff7efa27c8..a93df4a68f7431228787a92cdb271f027eb31c2c 100644 (file)
@@ -1,10 +1,10 @@
-aufs3.x-rcN kbuild patch
+aufs3.10 kbuild patch
 
 diff --git a/fs/Kconfig b/fs/Kconfig
-index 780725a..d460c05 100644
+index c229f82..397b473 100644
 --- a/fs/Kconfig
 +++ b/fs/Kconfig
-@@ -213,6 +213,7 @@ source "fs/ufs/Kconfig"
+@@ -212,6 +212,7 @@ source "fs/ufs/Kconfig"
  source "fs/exofs/Kconfig"
  source "fs/f2fs/Kconfig"
  source "fs/efivarfs/Kconfig"
@@ -13,16 +13,16 @@ index 780725a..d460c05 100644
  endif # MISC_FILESYSTEMS
  
 diff --git a/fs/Makefile b/fs/Makefile
-index 9d53192..e70f08f 100644
+index 4fe6df3..4a57676 100644
 --- a/fs/Makefile
 +++ b/fs/Makefile
-@@ -127,3 +127,4 @@ obj-y                              += exofs/ # Multiple modules
+@@ -126,3 +126,4 @@ obj-y                              += exofs/ # Multiple modules
  obj-$(CONFIG_CEPH_FS)         += ceph/
  obj-$(CONFIG_PSTORE)          += pstore/
  obj-$(CONFIG_EFIVAR_FS)               += efivarfs/
-+obj-$(CONFIG_AUFS_FS)         += aufs/
++obj-$(CONFIG_AUFS_FS)           += aufs/
 diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
-index 5c8a1d2..fea7572 100644
+index bdc6e87..349600c 100644
 --- a/include/uapi/linux/Kbuild
 +++ b/include/uapi/linux/Kbuild
 @@ -56,6 +56,7 @@ header-y += atmppp.h
@@ -33,10 +33,10 @@ index 5c8a1d2..fea7572 100644
  header-y += auto_fs.h
  header-y += auto_fs4.h
  header-y += auxvec.h
-aufs3.x-rcN base patch
+aufs3.10 base patch
 
 diff --git a/fs/file_table.c b/fs/file_table.c
-index cd4d87a..ca5948f 100644
+index 485dc0e..8db8096 100644
 --- a/fs/file_table.c
 +++ b/fs/file_table.c
 @@ -36,7 +36,7 @@ struct files_stat_struct files_stat = {
@@ -49,7 +49,7 @@ index cd4d87a..ca5948f 100644
  /* SLAB cache for file structures */
  static struct kmem_cache *filp_cachep __read_mostly;
 diff --git a/fs/inode.c b/fs/inode.c
-index f5f7c06..0b99538 100644
+index 00d5fc3..f324521 100644
 --- a/fs/inode.c
 +++ b/fs/inode.c
 @@ -1498,7 +1498,7 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode,
@@ -62,7 +62,7 @@ index f5f7c06..0b99538 100644
        if (inode->i_op->update_time)
                return inode->i_op->update_time(inode, time, flags);
 diff --git a/fs/splice.c b/fs/splice.c
-index 718bd00..c717dbb 100644
+index d37431d..987346f 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
 @@ -1093,8 +1093,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
@@ -76,7 +76,7 @@ index 718bd00..c717dbb 100644
  {
        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
                                loff_t *, size_t, unsigned int);
-@@ -1121,9 +1121,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -1124,9 +1124,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  /*
   * Attempt to initiate a splice from a file to a pipe.
   */
@@ -90,10 +90,10 @@ index 718bd00..c717dbb 100644
        ssize_t (*splice_read)(struct file *, loff_t *,
                               struct pipe_inode_info *, size_t, unsigned int);
 diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 2c28271..5c49108 100644
+index 65c2be2..0148214 100644
 --- a/include/linux/fs.h
 +++ b/include/linux/fs.h
-@@ -2558,6 +2558,7 @@ extern int inode_change_ok(const struct inode *, struct iattr *);
+@@ -2574,6 +2574,7 @@ extern int inode_change_ok(const struct inode *, struct iattr *);
  extern int inode_newsize_ok(const struct inode *, loff_t offset);
  extern void setattr_copy(struct inode *inode, const struct iattr *attr);
  
@@ -102,10 +102,10 @@ index 2c28271..5c49108 100644
  
  extern int generic_show_options(struct seq_file *m, struct dentry *root);
 diff --git a/include/linux/splice.h b/include/linux/splice.h
-index 09a545a..1ac5727 100644
+index 74575cb..bfc6fb6 100644
 --- a/include/linux/splice.h
 +++ b/include/linux/splice.h
-@@ -91,4 +91,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *);
+@@ -92,4 +92,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *);
  extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
  
  extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
@@ -116,10 +116,10 @@ index 09a545a..1ac5727 100644
 +                       struct pipe_inode_info *pipe, size_t len,
 +                       unsigned int flags);
  #endif
-aufs3.x-rcN standalone patch
+aufs3.10 standalone patch
 
 diff --git a/fs/file_table.c b/fs/file_table.c
-index ca5948f..b553610 100644
+index 8db8096..e271e28 100644
 --- a/fs/file_table.c
 +++ b/fs/file_table.c
 @@ -37,6 +37,7 @@ struct files_stat_struct files_stat = {
@@ -130,7 +130,7 @@ index ca5948f..b553610 100644
  
  /* SLAB cache for file structures */
  static struct kmem_cache *filp_cachep __read_mostly;
-@@ -404,6 +405,8 @@ void file_sb_list_del(struct file *file)
+@@ -405,6 +406,8 @@ void file_sb_list_del(struct file *file)
        }
  }
  
@@ -140,7 +140,7 @@ index ca5948f..b553610 100644
  
  /*
 diff --git a/fs/inode.c b/fs/inode.c
-index 0b99538..46a6995 100644
+index f324521..bff7670 100644
 --- a/fs/inode.c
 +++ b/fs/inode.c
 @@ -56,6 +56,7 @@ static struct hlist_head *inode_hashtable __read_mostly;
@@ -160,10 +160,10 @@ index 0b99538..46a6995 100644
  /**
   *    touch_atime     -       update the access time
 diff --git a/fs/namespace.c b/fs/namespace.c
-index 50ca17d..1548ce4 100644
+index 7b1ca9b..51db6ad 100644
 --- a/fs/namespace.c
 +++ b/fs/namespace.c
-@@ -52,6 +52,7 @@ EXPORT_SYMBOL_GPL(fs_kobj);
+@@ -54,6 +54,7 @@ EXPORT_SYMBOL_GPL(fs_kobj);
   * tree or hash is modified or when a vfsmount structure is modified.
   */
  DEFINE_BRLOCK(vfsmount_lock);
@@ -171,7 +171,7 @@ index 50ca17d..1548ce4 100644
  
  static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
  {
-@@ -425,6 +426,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
+@@ -427,6 +428,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
        mnt_dec_writers(real_mount(mnt));
        preempt_enable();
  }
@@ -179,7 +179,7 @@ index 50ca17d..1548ce4 100644
  
  /**
   * mnt_drop_write - give up write access to a mount
-@@ -1413,6 +1415,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+@@ -1456,6 +1458,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
        }
        return 0;
  }
@@ -260,7 +260,7 @@ index fc6b49b..a6bb87d 100644
  static int fsnotify_mark_destroy(void *ignored)
  {
 diff --git a/fs/open.c b/fs/open.c
-index 6835446..df2262a 100644
+index 8c74100..be563cd 100644
 --- a/fs/open.c
 +++ b/fs/open.c
 @@ -61,6 +61,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
@@ -272,18 +272,18 @@ index 6835446..df2262a 100644
  long vfs_truncate(struct path *path, loff_t length)
  {
 diff --git a/fs/splice.c b/fs/splice.c
-index c717dbb..f9c3c18 100644
+index 987346f..8d6a045 100644
 --- a/fs/splice.c
 +++ b/fs/splice.c
-@@ -1117,6 +1117,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
-       return splice_write(pipe, out, ppos, len, flags);
+@@ -1120,6 +1120,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+       file_end_write(out);
+       return ret;
  }
 +EXPORT_SYMBOL(do_splice_from);
  
  /*
   * Attempt to initiate a splice from a file to a pipe.
-@@ -1143,6 +1144,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
+@@ -1146,6 +1147,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
  
        return splice_read(in, ppos, pipe, len, flags);
  }
@@ -308,7 +308,7 @@ index c44b6fe..d78b003 100644
  }
 +EXPORT_SYMBOL(cap_mmap_file);
 diff --git a/security/device_cgroup.c b/security/device_cgroup.c
-index 1c69e38..7392d19 100644
+index dd0dc57..9760ecb6 100644
 --- a/security/device_cgroup.c
 +++ b/security/device_cgroup.c
 @@ -7,6 +7,7 @@
@@ -319,7 +319,7 @@ index 1c69e38..7392d19 100644
  #include <linux/list.h>
  #include <linux/uaccess.h>
  #include <linux/seq_file.h>
-@@ -634,6 +635,7 @@ int __devcgroup_inode_permission(struct inode *inode, int mask)
+@@ -789,6 +790,7 @@ int __devcgroup_inode_permission(struct inode *inode, int mask)
        return __devcgroup_check_permission(type, imajor(inode), iminor(inode),
                        access);
  }
@@ -328,7 +328,7 @@ index 1c69e38..7392d19 100644
  int devcgroup_inode_mknod(int mode, dev_t dev)
  {
 diff --git a/security/security.c b/security/security.c
-index 7b88c6a..5d00a30 100644
+index a3dce87..06a6ea6 100644
 --- a/security/security.c
 +++ b/security/security.c
 @@ -396,6 +396,7 @@ int security_path_rmdir(struct path *dir, struct dentry *dentry)
@@ -413,8 +413,8 @@ index 7b88c6a..5d00a30 100644
  {
 diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Documentation/ABI/testing/debugfs-aufs
 --- /usr/share/empty/Documentation/ABI/testing/debugfs-aufs    1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/debugfs-aufs       2012-08-26 08:39:00.753841216 +0200
-@@ -0,0 +1,37 @@
++++ linux/Documentation/ABI/testing/debugfs-aufs       2013-07-06 13:20:47.716863966 +0200
+@@ -0,0 +1,50 @@
 +What:         /debug/aufs/si_<id>/
 +Date:         March 2009
 +Contact:      J. R. Okajima <hooanon05@yahoo.co.jp>
@@ -423,6 +423,19 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document
 +              per aufs mount, where <id> is a unique id generated
 +              internally.
 +
++What:         /debug/aufs/si_<id>/plink
++Date:         Apr 2013
++Contact:      J. R. Okajima <hooanon05@yahoo.co.jp>
++Description:
++              It has three lines and shows the information about the
++              pseudo-link. The first line is a single number
++              representing a number of buckets. The second line is a
++              number of pseudo-links per buckets (separated by a
++              blank). The last line is a single number representing a
++              total number of psedo-links.
++              When the aufs mount option 'noplink' is specified, it
++              will show "1\n0\n0\n".
++
 +What:         /debug/aufs/si_<id>/xib
 +Date:         March 2009
 +Contact:      J. R. Okajima <hooanon05@yahoo.co.jp>
@@ -454,7 +467,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 2012-08-26 08:39:00.753841216 +0200
++++ linux/Documentation/ABI/testing/sysfs-aufs 2013-07-06 13:20:47.730197761 +0200
 @@ -0,0 +1,24 @@
 +What:         /sys/fs/aufs/si_<id>/
 +Date:         March 2009
@@ -482,7 +495,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentat
 +              will be empty. About XINO files, see the aufs manual.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt linux/Documentation/filesystems/aufs/design/01intro.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt 1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/01intro.txt    2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/01intro.txt    2013-07-06 13:20:47.730197761 +0200
 @@ -0,0 +1,162 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -648,8 +661,8 @@ 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   2013-02-19 08:40:03.943559493 +0100
-@@ -0,0 +1,226 @@
++++ linux/Documentation/filesystems/aufs/design/02struct.txt   2013-08-23 23:59:39.631583456 +0200
+@@ -0,0 +1,243 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
 +# 
@@ -876,9 +889,26 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt li
 +internally and makes change to the new file on the upper writable branch.
 +When the trigger systemcall does not update the timestamps of the parent
 +dir, aufs reverts it after copy-up.
++
++
++Move-down (aufs3.9 and later)
++----------------------------------------------------------------------
++"Copy-up" is one of the essential feature in aufs. It copies a file from
++the lower readonly branch to the upper writable branch when a user
++changes something about the file.
++"Move-down" is an opposite action of copy-up. Basically this action is
++ran manually instead of automatically and internally.
++
++Sometimes users want to move-down a file from the upper writable branch
++to the lower readonly or writable branch. For instance,
++- the free space of the upper writable branch is going to run out.
++- create a new intermediate branch between the upper and lower branch.
++- etc.
++
++For this purpose, use "aumvdown" command in aufs-util.git.
 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   2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/03lookup.txt   2013-07-06 13:20:47.730197761 +0200
 @@ -0,0 +1,106 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -988,7 +1018,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt li
 +   by over-mounting something (or another method).
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt linux/Documentation/filesystems/aufs/design/04branch.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt        1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/04branch.txt   2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/04branch.txt   2013-07-06 13:20:47.730197761 +0200
 @@ -0,0 +1,76 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1068,7 +1098,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt li
 +    same named entry on the upper branch.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt linux/Documentation/filesystems/aufs/design/05wbr_policy.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt    1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt       2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt       2013-07-06 13:20:47.730197761 +0200
 @@ -0,0 +1,65 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1137,7 +1167,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.tx
 +  copyup policy.
 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     2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/06mmap.txt     2013-07-06 13:20:47.730197761 +0200
 @@ -0,0 +1,47 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1188,7 +1218,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linu
 +switching the approach.
 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   2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/07export.txt   2013-07-06 13:20:47.736864659 +0200
 @@ -0,0 +1,59 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1251,7 +1281,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt li
 +  lookup_one_len(), vfs_getattr(), encode_fh() and others.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linux/Documentation/filesystems/aufs/design/08shwh.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt  1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/08shwh.txt     2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/08shwh.txt     2013-07-06 13:20:47.736864659 +0200
 @@ -0,0 +1,53 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1308,7 +1338,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linu
 +initramfs will use it to replace the old one at the next boot.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt linux/Documentation/filesystems/aufs/design/10dynop.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt 1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/10dynop.txt    2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/10dynop.txt    2013-07-06 13:20:47.736864659 +0200
 @@ -0,0 +1,47 @@
 +
 +# Copyright (C) 2010-2013 Junjiro R. Okajima
@@ -1359,7 +1389,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt lin
 +vm_operations_struct for regular files only.
 diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/99plan.txt linux/Documentation/filesystems/aufs/design/99plan.txt
 --- /usr/share/empty/Documentation/filesystems/aufs/design/99plan.txt  1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/99plan.txt     2013-02-19 08:40:03.943559493 +0100
++++ linux/Documentation/filesystems/aufs/design/99plan.txt     2013-07-06 13:20:47.736864659 +0200
 @@ -0,0 +1,96 @@
 +
 +# Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1459,8 +1489,8 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/99plan.txt linu
 +Otherwise from /new.
 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        2013-07-01 12:54:21.039493094 +0200
-@@ -0,0 +1,339 @@
++++ linux/Documentation/filesystems/aufs/README        2013-07-30 22:42:46.229279157 +0200
+@@ -0,0 +1,346 @@
 +
 +Aufs3 -- advanced multi layered unification filesystem version 3.x
 +http://aufs.sf.net
@@ -1578,20 +1608,20 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +
 +o aufs3-linux tree
 +$ git clone --reference /your/linux/git/tree \
-+      git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-linux.git \
++      git://git.code.sf.net/p/aufs/aufs3-linux aufs-aufs3-linux \
 +      aufs3-linux.git
 +- if you don't have linux GIT tree, then remove "--reference ..."
 +$ cd aufs3-linux.git
 +$ git checkout origin/aufs3.0
 +
 +o aufs3-standalone tree
-+$ git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git \
++$ git clone git://git.code.sf.net/p/aufs/aufs3-standalone \
 +      aufs3-standalone.git
 +$ cd aufs3-standalone.git
 +$ git checkout origin/aufs3.0
 +
 +o aufs-util tree
-+$ git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs-util.git \
++$ git clone git://git.code.sf.net/p/aufs/aufs-util \
 +      aufs-util.git
 +$ cd aufs-util.git
 +$ git checkout origin/aufs3.0
@@ -1783,6 +1813,13 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +Max Lekomcev (DOM-TV project) made a donation (2011/7, 12, 2012/3, 6 and
 +11).
 +Sam Liddicott made a donation (2011/9).
++Era Scarecrow made a donation (2013/4).
++Bor Ratajc made a donation (2013/4).
++Alessandro Gorreta made a donation (2013/4).
++POIRETTE Marc made a donation (2013/4).
++Alessandro Gorreta made a donation (2013/4).
++lauri kasvandik made a donation (2013/5).
++pemasu from Finland made a donation (2013/7).
 +
 +Thank you very much.
 +Donations are always, including future donations, very important and
@@ -1802,7 +1839,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta
 +# End: ;
 diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 --- /usr/share/empty/fs/aufs/aufs.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/aufs.h       2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/aufs.h       2013-07-06 13:20:47.736864659 +0200
 @@ -0,0 +1,60 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -1866,8 +1903,8 @@ diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 +#endif /* __AUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 --- /usr/share/empty/fs/aufs/branch.c  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.c     2013-07-01 12:54:21.039493094 +0200
-@@ -0,0 +1,1172 @@
++++ linux/fs/aufs/branch.c     2013-07-30 22:42:55.839613269 +0200
+@@ -0,0 +1,1213 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -1897,6 +1934,34 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +/*
 + * free a single branch
 + */
++
++/* prohibit rmdir to the root of the branch */
++/* todo: another new flag? */
++static void au_br_dflags_force(struct au_branch *br)
++{
++      struct dentry *h_dentry;
++
++      h_dentry = au_br_dentry(br);
++      spin_lock(&h_dentry->d_lock);
++      br->br_dflags = h_dentry->d_flags & DCACHE_MOUNTED;
++      h_dentry->d_flags |= DCACHE_MOUNTED;
++      spin_unlock(&h_dentry->d_lock);
++}
++
++/* restore its d_flags */
++static void au_br_dflags_restore(struct au_branch *br)
++{
++      struct dentry *h_dentry;
++
++      if (br->br_dflags)
++              return;
++
++      h_dentry = au_br_dentry(br);
++      spin_lock(&h_dentry->d_lock);
++      h_dentry->d_flags &= ~DCACHE_MOUNTED;
++      spin_unlock(&h_dentry->d_lock);
++}
++
 +static void au_br_do_free(struct au_branch *br)
 +{
 +      int i;
@@ -1926,9 +1991,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              else
 +                      break;
 +
++      au_br_dflags_restore(br);
++
 +      /* recursive lock, s_umount of branch's */
 +      lockdep_off();
-+      mntput(br->br_mnt);
++      path_put(&br->br_path);
 +      lockdep_on();
 +      kfree(wbr);
 +      kfree(br);
@@ -2142,7 +2209,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 + * initialize or clean the whiteouts for an adding branch
 + */
 +static int au_br_init_wh(struct super_block *sb, struct au_branch *br,
-+                       int new_perm, struct dentry *h_root)
++                       int new_perm)
 +{
 +      int err, old_perm;
 +      aufs_bindex_t bindex;
@@ -2150,6 +2217,10 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +      struct au_wbr *wbr;
 +      struct au_hinode *hdir;
 +
++      err = vfsub_mnt_want_write(au_br_mnt(br));
++      if (unlikely(err))
++              goto out;
++
 +      wbr = br->br_wbr;
 +      old_perm = br->br_perm;
 +      br->br_perm = new_perm;
@@ -2160,20 +2231,21 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              hdir = au_hi(sb->s_root->d_inode, bindex);
 +              au_hn_imtx_lock_nested(hdir, AuLsc_I_PARENT);
 +      } else {
-+              h_mtx = &h_root->d_inode->i_mutex;
++              h_mtx = &au_br_dentry(br)->d_inode->i_mutex;
 +              mutex_lock_nested(h_mtx, AuLsc_I_PARENT);
 +      }
 +      if (!wbr)
-+              err = au_wh_init(h_root, br, sb);
++              err = au_wh_init(br, sb);
 +      else {
 +              wbr_wh_write_lock(wbr);
-+              err = au_wh_init(h_root, br, sb);
++              err = au_wh_init(br, sb);
 +              wbr_wh_write_unlock(wbr);
 +      }
 +      if (hdir)
 +              au_hn_imtx_unlock(hdir);
 +      else
 +              mutex_unlock(h_mtx);
++      vfsub_mnt_drop_write(au_br_mnt(br));
 +      br->br_perm = old_perm;
 +
 +      if (!err && wbr && !au_br_writable(new_perm)) {
@@ -2181,16 +2253,16 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              br->br_wbr = NULL;
 +      }
 +
++out:
 +      return err;
 +}
 +
 +static int au_wbr_init(struct au_branch *br, struct super_block *sb,
-+                     int perm, struct path *path)
++                     int perm)
 +{
 +      int err;
 +      struct kstatfs kst;
 +      struct au_wbr *wbr;
-+      struct dentry *h_dentry;
 +
 +      wbr = br->br_wbr;
 +      au_rw_init(&wbr->wbr_wh_rwsem);
@@ -2202,17 +2274,16 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +       * a limit for rmdir/rename a dir
 +       * cf. AUFS_MAX_NAMELEN in include/linux/aufs_type.h
 +       */
-+      err = vfs_statfs(path, &kst);
++      err = vfs_statfs(&br->br_path, &kst);
 +      if (unlikely(err))
 +              goto out;
 +      err = -EINVAL;
-+      h_dentry = path->dentry;
 +      if (kst.f_namelen >= NAME_MAX)
-+              err = au_br_init_wh(sb, br, perm, h_dentry);
++              err = au_br_init_wh(sb, br, perm);
 +      else
 +              pr_err("%.*s(%s), unsupported namelen %ld\n",
-+                     AuDLNPair(h_dentry), au_sbtype(h_dentry->d_sb),
-+                     kst.f_namelen);
++                     AuDLNPair(au_br_dentry(br)),
++                     au_sbtype(au_br_dentry(br)->d_sb), kst.f_namelen);
 +
 +out:
 +      return err;
@@ -2228,7 +2299,10 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +      memset(&br->br_xino, 0, sizeof(br->br_xino));
 +      mutex_init(&br->br_xino.xi_nondir_mtx);
 +      br->br_perm = add->perm;
-+      br->br_mnt = add->path.mnt; /* set first, mntget() later */
++      BUILD_BUG_ON(sizeof(br->br_dflags)
++                   != sizeof(br->br_path.dentry->d_flags));
++      br->br_dflags = DCACHE_MOUNTED;
++      br->br_path = add->path; /* set first, path_get() later */
 +      spin_lock_init(&br->br_dykey_lock);
 +      memset(br->br_dykey, 0, sizeof(br->br_dykey));
 +      atomic_set(&br->br_count, 0);
@@ -2238,7 +2312,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +      AuDebugOn(br->br_id < 0);
 +
 +      if (au_br_writable(add->perm)) {
-+              err = au_wbr_init(br, sb, add->perm, &add->path);
++              err = au_wbr_init(br, sb, add->perm);
 +              if (unlikely(err))
 +                      goto out_err;
 +      }
@@ -2253,11 +2327,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +      }
 +
 +      sysaufs_br_init(br);
-+      mntget(add->path.mnt);
++      path_get(&br->br_path);
 +      goto out; /* success */
 +
 +out_err:
-+      br->br_mnt = NULL;
++      memset(&br->br_path, 0, sizeof(br->br_path));
 +out:
 +      return err;
 +}
@@ -2309,17 +2383,20 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              iinfo->ii_bstart = 0;
 +}
 +
-+static void au_br_do_add(struct super_block *sb, struct dentry *h_dentry,
-+                       struct au_branch *br, aufs_bindex_t bindex)
++static void au_br_do_add(struct super_block *sb, struct au_branch *br,
++                       aufs_bindex_t bindex)
 +{
-+      struct dentry *root;
++      struct dentry *root, *h_dentry;
 +      struct inode *root_inode;
 +      aufs_bindex_t bend, amount;
 +
++      au_br_dflags_force(br);
++
 +      root = sb->s_root;
 +      root_inode = root->d_inode;
 +      bend = au_sbend(sb);
 +      amount = bend + 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);
@@ -2362,15 +2439,15 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +      }
 +
 +      add_bindex = add->bindex;
-+      h_dentry = add->path.dentry;
 +      if (!remount)
-+              au_br_do_add(sb, h_dentry, add_branch, add_bindex);
++              au_br_do_add(sb, add_branch, add_bindex);
 +      else {
 +              sysaufs_brs_del(sb, add_bindex);
-+              au_br_do_add(sb, h_dentry, add_branch, add_bindex);
++              au_br_do_add(sb, add_branch, add_bindex);
 +              sysaufs_brs_add(sb, add_bindex);
 +      }
 +
++      h_dentry = add->path.dentry;
 +      if (!add_bindex) {
 +              au_cpup_attr_all(root_inode, /*force*/1);
 +              sb->s_maxbytes = h_dentry->d_sb->s_maxbytes;
@@ -2676,6 +2753,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              goto out;
 +      }
 +      br = au_sbr(sb, bindex);
++      AuDebugOn(!path_equal(&br->br_path, &del->h_path));
 +      i = atomic_read(&br->br_count);
 +      if (unlikely(i)) {
 +              AuVerbose(verbose, "%d file(s) opened\n", i);
@@ -2724,7 +2802,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +out_wh:
 +      /* revert */
-+      rerr = au_br_init_wh(sb, br, br->br_perm, del->h_path.dentry);
++      rerr = au_br_init_wh(sb, br, br->br_perm);
 +      if (rerr)
 +              pr_warn("failed re-creating base whiteout, %s. (%d)\n",
 +                      del->pathname, rerr);
@@ -2961,7 +3039,6 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +{
 +      int err, rerr;
 +      aufs_bindex_t bindex;
-+      struct path path;
 +      struct dentry *root;
 +      struct au_branch *br;
 +
@@ -2981,12 +3058,13 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              goto out;
 +
 +      br = au_sbr(sb, bindex);
++      AuDebugOn(mod->h_root != au_br_dentry(br));
 +      if (br->br_perm == mod->perm)
 +              return 0; /* success */
 +
 +      if (au_br_writable(br->br_perm)) {
 +              /* remove whiteout base */
-+              err = au_br_init_wh(sb, br, mod->perm, mod->h_root);
++              err = au_br_init_wh(sb, br, mod->perm);
 +              if (unlikely(err))
 +                      goto out;
 +
@@ -3003,12 +3081,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +                              rerr = -ENOMEM;
 +                              br->br_wbr = kmalloc(sizeof(*br->br_wbr),
 +                                                   GFP_NOFS);
-+                              if (br->br_wbr) {
-+                                      path.mnt = br->br_mnt;
-+                                      path.dentry = mod->h_root;
-+                                      rerr = au_wbr_init(br, sb, br->br_perm,
-+                                                         &path);
-+                              }
++                              if (br->br_wbr)
++                                      rerr = au_wbr_init(br, sb, br->br_perm);
 +                              if (unlikely(rerr)) {
 +                                      AuIOErr("nested error %d (%d)\n",
 +                                              rerr, err);
@@ -3021,9 +3095,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +              err = -ENOMEM;
 +              br->br_wbr = kmalloc(sizeof(*br->br_wbr), GFP_NOFS);
 +              if (br->br_wbr) {
-+                      path.mnt = br->br_mnt;
-+                      path.dentry = mod->h_root;
-+                      err = au_wbr_init(br, sb, mod->perm, &path);
++                      err = au_wbr_init(br, sb, mod->perm);
 +                      if (unlikely(err)) {
 +                              kfree(br->br_wbr);
 +                              br->br_wbr = NULL;
@@ -3032,6 +3104,12 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +      }
 +
 +      if (!err) {
++              if ((br->br_perm & AuBrAttr_UNPIN)
++                  && !(mod->perm & AuBrAttr_UNPIN))
++                      au_br_dflags_force(br);
++              else if (!(br->br_perm & AuBrAttr_UNPIN)
++                       && (mod->perm & AuBrAttr_UNPIN))
++                      au_br_dflags_restore(br);
 +              *do_refresh |= need_sigen_inc(br->br_perm, mod->perm);
 +              br->br_perm = mod->perm;
 +      }
@@ -3042,8 +3120,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +}
 diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 --- /usr/share/empty/fs/aufs/branch.h  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/branch.h     2013-02-19 08:40:03.946892891 +0100
-@@ -0,0 +1,236 @@
++++ linux/fs/aufs/branch.h     2013-07-06 13:20:47.740198107 +0200
+@@ -0,0 +1,255 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -3121,7 +3199,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +      aufs_bindex_t           br_id;
 +
 +      int                     br_perm;
-+      struct vfsmount         *br_mnt;
++      unsigned int            br_dflags;
++      struct path             br_path;
 +      spinlock_t              br_dykey_lock;
 +      struct au_dykey         *br_dykey[AuBrDynOp];
 +      atomic_t                br_count;
@@ -3145,6 +3224,21 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +
 +/* ---------------------------------------------------------------------- */
 +
++static inline struct vfsmount *au_br_mnt(struct au_branch *br)
++{
++      return br->br_path.mnt;
++}
++
++static inline struct dentry *au_br_dentry(struct au_branch *br)
++{
++      return br->br_path.dentry;
++}
++
++static inline struct super_block *au_br_sb(struct au_branch *br)
++{
++      return au_br_mnt(br)->mnt_sb;
++}
++
 +/* branch permissions and attributes */
 +#define AuBrPerm_RW           1               /* writable, hardlinkable wh */
 +#define AuBrPerm_RO           (1 << 1)        /* readonly */
@@ -3155,6 +3249,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +
 +#define AuBrWAttr_NoLinkWH    (1 << 4)        /* un-hardlinkable whiteouts */
 +
++#define AuBrAttr_UNPIN                (1 << 5)        /* rename-able top dir of
++                                                 branch */
++
 +static inline int au_br_writable(int brperm)
 +{
 +      return brperm & AuBrPerm_RW;
@@ -3172,7 +3269,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +
 +static inline int au_br_rdonly(struct au_branch *br)
 +{
-+      return ((br->br_mnt->mnt_sb->s_flags & MS_RDONLY)
++      return ((au_br_sb(br)->s_flags & MS_RDONLY)
 +              || !au_br_writable(br->br_perm))
 +              ? -EROFS : 0;
 +}
@@ -3242,13 +3339,13 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +static inline
 +struct vfsmount *au_sbr_mnt(struct super_block *sb, aufs_bindex_t bindex)
 +{
-+      return au_sbr(sb, bindex)->br_mnt;
++      return au_br_mnt(au_sbr(sb, bindex));
 +}
 +
 +static inline
 +struct super_block *au_sbr_sb(struct super_block *sb, aufs_bindex_t bindex)
 +{
-+      return au_sbr_mnt(sb, bindex)->mnt_sb;
++      return au_br_sb(au_sbr(sb, bindex));
 +}
 +
 +static inline void au_sbr_put(struct super_block *sb, aufs_bindex_t bindex)
@@ -3282,7 +3379,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      2012-08-26 08:39:00.757174634 +0200
++++ linux/fs/aufs/conf.mk      2013-07-06 13:20:47.740198107 +0200
 @@ -0,0 +1,38 @@
 +
 +AuConfStr = CONFIG_AUFS_FS=${CONFIG_AUFS_FS}
@@ -3324,8 +3421,8 @@ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 +-include ${srctree}/${src}/conf_priv.mk
 diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 --- /usr/share/empty/fs/aufs/cpup.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.c       2013-07-01 12:54:18.772748151 +0200
-@@ -0,0 +1,1085 @@
++++ linux/fs/aufs/cpup.c       2013-08-23 23:59:39.631583456 +0200
+@@ -0,0 +1,1255 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -3352,12 +3449,14 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +#include <linux/mm.h>
 +#include "aufs.h"
 +
-+void au_cpup_attr_flags(struct inode *dst, struct inode *src)
++void au_cpup_attr_flags(struct inode *dst, unsigned int iflags)
 +{
 +      const unsigned int mask = S_DEAD | S_SWAPFILE | S_PRIVATE
-+              | S_NOATIME | S_NOCMTIME;
++              | S_NOATIME | S_NOCMTIME | S_AUTOMOUNT;
++
++      BUILD_BUG_ON(sizeof(iflags) != sizeof(dst->i_flags));
 +
-+      dst->i_flags |= src->i_flags & ~mask;
++      dst->i_flags |= iflags & ~mask;
 +      if (au_test_fs_notime(dst->i_sb))
 +              dst->i_flags |= S_NOATIME | S_NOCMTIME;
 +}
@@ -3416,7 +3515,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      inode->i_uid = h_inode->i_uid;
 +      inode->i_gid = h_inode->i_gid;
 +      au_cpup_attr_timesizes(inode);
-+      au_cpup_attr_flags(inode, h_inode);
++      au_cpup_attr_flags(inode, h_inode->i_flags);
 +}
 +
 +void au_cpup_igen(struct inode *inode, struct inode *h_inode)
@@ -3477,13 +3576,22 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +/* ---------------------------------------------------------------------- */
 +
++/* internal use only */
++struct au_cpup_reg_attr {
++      int             valid;
++      struct kstat    st;
++      unsigned int    iflags; /* inode->i_flags */
++};
++
 +static noinline_for_stack
-+int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src)
++int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src,
++             struct au_cpup_reg_attr *h_src_attr)
 +{
 +      int err, sbits;
 +      struct iattr ia;
 +      struct path h_path;
 +      struct inode *h_isrc, *h_idst;
++      struct kstat *h_st;
 +
 +      h_path.dentry = au_h_dptr(dst, bindex);
 +      h_idst = h_path.dentry->d_inode;
@@ -3492,17 +3600,32 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      ia.ia_valid = ATTR_FORCE | ATTR_UID | ATTR_GID
 +              | ATTR_ATIME | ATTR_MTIME
 +              | ATTR_ATIME_SET | ATTR_MTIME_SET;
-+      ia.ia_uid = h_isrc->i_uid;
-+      ia.ia_gid = h_isrc->i_gid;
-+      ia.ia_atime = h_isrc->i_atime;
-+      ia.ia_mtime = h_isrc->i_mtime;
-+      if (h_idst->i_mode != h_isrc->i_mode
-+          && !S_ISLNK(h_idst->i_mode)) {
-+              ia.ia_valid |= ATTR_MODE;
-+              ia.ia_mode = h_isrc->i_mode;
++      if (h_src_attr && h_src_attr->valid) {
++              h_st = &h_src_attr->st;
++              ia.ia_uid = h_st->uid;
++              ia.ia_gid = h_st->gid;
++              ia.ia_atime = h_st->atime;
++              ia.ia_mtime = h_st->mtime;
++              if (h_idst->i_mode != h_st->mode
++                  && !S_ISLNK(h_idst->i_mode)) {
++                      ia.ia_valid |= ATTR_MODE;
++                      ia.ia_mode = h_st->mode;
++              }
++              sbits = !!(h_st->mode & (S_ISUID | S_ISGID));
++              au_cpup_attr_flags(h_idst, h_src_attr->iflags);
++      } else {
++              ia.ia_uid = h_isrc->i_uid;
++              ia.ia_gid = h_isrc->i_gid;
++              ia.ia_atime = h_isrc->i_atime;
++              ia.ia_mtime = h_isrc->i_mtime;
++              if (h_idst->i_mode != h_isrc->i_mode
++                  && !S_ISLNK(h_idst->i_mode)) {
++                      ia.ia_valid |= ATTR_MODE;
++                      ia.ia_mode = h_isrc->i_mode;
++              }
++              sbits = !!(h_isrc->i_mode & (S_ISUID | S_ISGID));
++              au_cpup_attr_flags(h_idst, h_isrc->i_flags);
 +      }
-+      sbits = !!(h_isrc->i_mode & (S_ISUID | S_ISGID));
-+      au_cpup_attr_flags(h_idst, h_isrc);
 +      err = vfsub_notify_change(&h_path, &ia);
 +
 +      /* is this nfs only? */
@@ -3651,8 +3774,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 + * to support a sparse file which is opened with O_APPEND,
 + * we need to close the file.
 + */
-+static int au_cp_regular(struct dentry *dentry, aufs_bindex_t bdst,
-+                       aufs_bindex_t bsrc, loff_t len)
++static int au_cp_regular(struct au_cp_generic *cpg)
 +{
 +      int err, i;
 +      enum { SRC, DST };
@@ -3664,14 +3786,14 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +              void *label, *label_file;
 +      } *f, file[] = {
 +              {
-+                      .bindex = bsrc,
++                      .bindex = cpg->bsrc,
 +                      .flags = O_RDONLY | O_NOATIME | O_LARGEFILE,
 +                      .file = NULL,
 +                      .label = &&out,
 +                      .label_file = &&out_src
 +              },
 +              {
-+                      .bindex = bdst,
++                      .bindex = cpg->bdst,
 +                      .flags = O_WRONLY | O_NOATIME | O_LARGEFILE,
 +                      .file = NULL,
 +                      .label = &&out_src,
@@ -3681,11 +3803,12 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      struct super_block *sb;
 +
 +      /* bsrc branch can be ro/rw. */
-+      sb = dentry->d_sb;
++      sb = cpg->dentry->d_sb;
 +      f = file;
 +      for (i = 0; i < 2; i++, f++) {
-+              f->dentry = au_h_dptr(dentry, f->bindex);
-+              f->file = au_h_open(dentry, f->bindex, f->flags, /*file*/NULL);
++              f->dentry = au_h_dptr(cpg->dentry, f->bindex);
++              f->file = au_h_open(cpg->dentry, f->bindex, f->flags,
++                                  /*file*/NULL);
 +              err = PTR_ERR(f->file);
 +              if (IS_ERR(f->file))
 +                      goto *f->label;
@@ -3696,7 +3819,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +      /* try stopping to update while we copyup */
 +      IMustLock(file[SRC].dentry->d_inode);
-+      err = au_copy_file(file[DST].file, file[SRC].file, len);
++      err = au_copy_file(file[DST].file, file[SRC].file, cpg->len);
 +
 +out_dst:
 +      fput(file[DST].file);
@@ -3708,27 +3831,38 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      return err;
 +}
 +
-+static int au_do_cpup_regular(struct dentry *dentry, aufs_bindex_t bdst,
-+                            aufs_bindex_t bsrc, loff_t len,
-+                            struct inode *h_dir, struct path *h_path)
++static int au_do_cpup_regular(struct au_cp_generic *cpg,
++                            struct au_cpup_reg_attr *h_src_attr)
 +{
 +      int err, rerr;
 +      loff_t l;
++      struct path h_path;
++      struct inode *h_src_inode;
 +
 +      err = 0;
-+      l = i_size_read(au_h_iptr(dentry->d_inode, bsrc));
-+      if (len == -1 || l < len)
-+              len = l;
-+      if (len)
-+              err = au_cp_regular(dentry, bdst, bsrc, len);
-+      if (!err)
-+              goto out; /* success */
++      h_src_inode = au_h_iptr(cpg->dentry->d_inode, cpg->bsrc);
++      l = i_size_read(h_src_inode);
++      if (cpg->len == -1 || l < cpg->len)
++              cpg->len = l;
++      if (cpg->len) {
++              /* try stopping to update while we are referencing */
++              mutex_lock_nested(&h_src_inode->i_mutex, AuLsc_I_CHILD);
++              au_pin_hdir_unlock(cpg->pin);
 +
-+      rerr = vfsub_unlink(h_dir, h_path, /*force*/0);
-+      if (rerr) {
-+              AuIOErr("failed unlinking cpup-ed %.*s(%d, %d)\n",
-+                      AuDLNPair(h_path->dentry), err, rerr);
-+              err = -EIO;
++              h_path.dentry = au_h_dptr(cpg->dentry, cpg->bsrc);
++              h_path.mnt = au_sbr_mnt(cpg->dentry->d_sb, cpg->bsrc);
++              h_src_attr->iflags = h_src_inode->i_flags;
++              err = vfs_getattr(&h_path, &h_src_attr->st);
++              if (unlikely(err)) {
++                      mutex_unlock(&h_src_inode->i_mutex);
++                      goto out;
++              }
++              h_src_attr->valid = 1;
++              err = au_cp_regular(cpg);
++              mutex_unlock(&h_src_inode->i_mutex);
++              rerr = au_pin_hdir_relock(cpg->pin);
++              if (!err && rerr)
++                      err = rerr;
 +      }
 +
 +out:
@@ -3771,17 +3905,15 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      return err;
 +}
 +
-+/* return with the lower dst inode is locked */
 +static noinline_for_stack
-+int cpup_entry(struct dentry *dentry, aufs_bindex_t bdst,
-+             aufs_bindex_t bsrc, loff_t len, unsigned int flags,
-+             struct dentry *dst_parent)
++int cpup_entry(struct au_cp_generic *cpg, struct dentry *dst_parent,
++             struct au_cpup_reg_attr *h_src_attr)
 +{
 +      int err;
 +      umode_t mode;
 +      unsigned int mnt_flags;
 +      unsigned char isdir;
-+      const unsigned char do_dt = !!au_ftest_cpup(flags, DTIME);
++      const unsigned char do_dt = !!au_ftest_cpup(cpg->flags, DTIME);
 +      struct au_dtime dt;
 +      struct path h_path;
 +      struct dentry *h_src, *h_dst, *h_parent;
@@ -3789,19 +3921,22 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      struct super_block *sb;
 +
 +      /* bsrc branch can be ro/rw. */
-+      h_src = au_h_dptr(dentry, bsrc);
++      h_src = au_h_dptr(cpg->dentry, cpg->bsrc);
 +      h_inode = h_src->d_inode;
-+      AuDebugOn(h_inode != au_h_iptr(dentry->d_inode, bsrc));
++      AuDebugOn(h_inode != au_h_iptr(cpg->dentry->d_inode, cpg->bsrc));
 +
 +      /* try stopping to be referenced while we are creating */
-+      h_dst = au_h_dptr(dentry, bdst);
++      h_dst = au_h_dptr(cpg->dentry, cpg->bdst);
++      if (au_ftest_cpup(cpg->flags, RENAME))
++              AuDebugOn(strncmp(h_dst->d_name.name, AUFS_WH_PFX,
++                                AUFS_WH_PFX_LEN));
 +      h_parent = h_dst->d_parent; /* dir inode is locked */
 +      h_dir = h_parent->d_inode;
 +      IMustLock(h_dir);
 +      AuDebugOn(h_parent != h_dst->d_parent);
 +
-+      sb = dentry->d_sb;
-+      h_path.mnt = au_sbr_mnt(sb, bdst);
++      sb = cpg->dentry->d_sb;
++      h_path.mnt = au_sbr_mnt(sb, cpg->bdst);
 +      if (do_dt) {
 +              h_path.dentry = h_parent;
 +              au_dtime_store(&dt, dst_parent, &h_path);
@@ -3812,14 +3947,10 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      mode = h_inode->i_mode;
 +      switch (mode & S_IFMT) {
 +      case S_IFREG:
-+              /* try stopping to update while we are referencing */
-+              IMustLock(h_inode);
 +              err = vfsub_create(h_dir, &h_path, mode | S_IWUSR,
 +                                 /*want_excl*/true);
 +              if (!err)
-+                      err = au_do_cpup_regular
-+                              (dentry, bdst, bsrc, len,
-+                               au_h_iptr(dst_parent->d_inode, bdst), &h_path);
++                      err = au_do_cpup_regular(cpg, h_src_attr);
 +              break;
 +      case S_IFDIR:
 +              isdir = 1;
@@ -3829,10 +3960,10 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +                       * strange behaviour from the users view,
 +                       * particularry setattr case
 +                       */
-+                      if (au_ibstart(dst_parent->d_inode) == bdst)
++                      if (au_ibstart(dst_parent->d_inode) == cpg->bdst)
 +                              au_cpup_attr_nlink(dst_parent->d_inode,
 +                                                 /*force*/1);
-+                      au_cpup_attr_nlink(dentry->d_inode, /*force*/1);
++                      au_cpup_attr_nlink(cpg->dentry->d_inode, /*force*/1);
 +              }
 +              break;
 +      case S_IFLNK:
@@ -3857,10 +3988,10 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +          && au_opt_test(mnt_flags, XINO)
 +          && h_inode->i_nlink == 1
 +          /* todo: unnecessary? */
-+          /* && dentry->d_inode->i_nlink == 1 */
-+          && bdst < bsrc
-+          && !au_ftest_cpup(flags, KEEPLINO))
-+              au_xino_write(sb, bsrc, h_inode->i_ino, /*ino*/0);
++          /* && cpg->dentry->d_inode->i_nlink == 1 */
++          && cpg->bdst < cpg->bsrc
++          && !au_ftest_cpup(cpg->flags, KEEPLINO))
++              au_xino_write(sb, cpg->bsrc, h_inode->i_ino, /*ino*/0);
 +              /* ignore this error */
 +
 +      if (do_dt)
@@ -3868,160 +3999,232 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      return err;
 +}
 +
++static int au_do_ren_after_cpup(struct dentry *dentry, aufs_bindex_t bdst,
++                              struct path *h_path)
++{
++      int err;
++      struct dentry *h_dentry, *h_parent;
++      struct inode *h_dir;
++
++      h_dentry = dget(au_h_dptr(dentry, bdst));
++      au_set_h_dptr(dentry, bdst, NULL);
++      err = au_lkup_neg(dentry, bdst, /*wh*/0);
++      if (unlikely(err)) {
++              au_set_h_dptr(dentry, bdst, h_dentry);
++              goto out;
++      }
++
++      h_path->dentry = dget(au_h_dptr(dentry, bdst));
++      au_set_h_dptr(dentry, bdst, h_dentry);
++      h_parent = h_dentry->d_parent; /* dir inode is locked */
++      h_dir = h_parent->d_inode;
++      IMustLock(h_dir);
++      AuDbg("%.*s %.*s\n", AuDLNPair(h_dentry), AuDLNPair(h_path->dentry));
++      err = vfsub_rename(h_dir, h_dentry, h_dir, h_path);
++      dput(h_path->dentry);
++
++out:
++      return err;
++}
++
 +/*
 + * copyup the @dentry from @bsrc to @bdst.
 + * the caller must set the both of lower dentries.
 + * @len is for truncating when it is -1 copyup the entire file.
 + * in link/rename cases, @dst_parent may be different from the real one.
++ * basic->bsrc can be larger than basic->bdst.
 + */
-+static int au_cpup_single(struct dentry *dentry, aufs_bindex_t bdst,
-+                        aufs_bindex_t bsrc, loff_t len, unsigned int flags,
-+                        struct dentry *dst_parent)
++static int au_cpup_single(struct au_cp_generic *cpg, struct dentry *dst_parent)
 +{
 +      int err, rerr;
 +      aufs_bindex_t old_ibstart;
 +      unsigned char isdir, plink;
-+      struct au_dtime dt;
-+      struct path h_path;
 +      struct dentry *h_src, *h_dst, *h_parent;
 +      struct inode *dst_inode, *h_dir, *inode;
 +      struct super_block *sb;
++      struct au_branch *br;
++      /* to reuduce stack size */
++      struct {
++              struct au_dtime dt;
++              struct path h_path;
++              struct au_cpup_reg_attr h_src_attr;
++      } *a;
 +
-+      AuDebugOn(bsrc <= bdst);
++      err = -ENOMEM;
++      a = kmalloc(sizeof(*a), GFP_NOFS);
++      if (unlikely(!a))
++              goto out;
++      a->h_src_attr.valid = 0;
 +
-+      sb = dentry->d_sb;
-+      h_path.mnt = au_sbr_mnt(sb, bdst);
-+      h_dst = au_h_dptr(dentry, bdst);
++      sb = cpg->dentry->d_sb;
++      br = au_sbr(sb, cpg->bdst);
++      a->h_path.mnt = au_br_mnt(br);
++      h_dst = au_h_dptr(cpg->dentry, cpg->bdst);
 +      h_parent = h_dst->d_parent; /* dir inode is locked */
 +      h_dir = h_parent->d_inode;
 +      IMustLock(h_dir);
 +
-+      h_src = au_h_dptr(dentry, bsrc);
-+      inode = dentry->d_inode;
++      h_src = au_h_dptr(cpg->dentry, cpg->bsrc);
++      inode = cpg->dentry->d_inode;
 +
 +      if (!dst_parent)
-+              dst_parent = dget_parent(dentry);
++              dst_parent = dget_parent(cpg->dentry);
 +      else
 +              dget(dst_parent);
 +
 +      plink = !!au_opt_test(au_mntflags(sb), PLINK);
-+      dst_inode = au_h_iptr(inode, bdst);
++      dst_inode = au_h_iptr(inode, cpg->bdst);
 +      if (dst_inode) {
 +              if (unlikely(!plink)) {
 +                      err = -EIO;
 +                      AuIOErr("hi%lu(i%lu) exists on b%d "
 +                              "but plink is disabled\n",
-+                              dst_inode->i_ino, inode->i_ino, bdst);
-+                      goto out;
++                              dst_inode->i_ino, inode->i_ino, cpg->bdst);
++                      goto out_parent;
 +              }
 +
 +              if (dst_inode->i_nlink) {
-+                      const int do_dt = au_ftest_cpup(flags, DTIME);
++                      const int do_dt = au_ftest_cpup(cpg->flags, DTIME);
 +
-+                      h_src = au_plink_lkup(inode, bdst);
++                      h_src = au_plink_lkup(inode, cpg->bdst);
 +                      err = PTR_ERR(h_src);
 +                      if (IS_ERR(h_src))
-+                              goto out;
++                              goto out_parent;
 +                      if (unlikely(!h_src->d_inode)) {
 +                              err = -EIO;
 +                              AuIOErr("i%lu exists on a upper branch "
 +                                      "but not pseudo-linked\n",
 +                                      inode->i_ino);
 +                              dput(h_src);
-+                              goto out;
++                              goto out_parent;
 +                      }
 +
 +                      if (do_dt) {
-+                              h_path.dentry = h_parent;
-+                              au_dtime_store(&dt, dst_parent, &h_path);
++                              a->h_path.dentry = h_parent;
++                              au_dtime_store(&a->dt, dst_parent, &a->h_path);
 +                      }
-+                      h_path.dentry = h_dst;
-+                      err = vfsub_link(h_src, h_dir, &h_path);
++
++                      a->h_path.dentry = h_dst;
++                      err = vfsub_link(h_src, h_dir, &a->h_path);
++                      if (!err && au_ftest_cpup(cpg->flags, RENAME))
++                              err = au_do_ren_after_cpup
++                                      (cpg->dentry, cpg->bdst, &a->h_path);
 +                      if (do_dt)
-+                              au_dtime_revert(&dt);
++                              au_dtime_revert(&a->dt);
 +                      dput(h_src);
-+                      goto out;
++                      goto out_parent;
 +              } else
 +                      /* todo: cpup_wh_file? */
 +                      /* udba work */
 +                      au_update_ibrange(inode, /*do_put_zero*/1);
 +      }
 +
++      isdir = S_ISDIR(inode->i_mode);
 +      old_ibstart = au_ibstart(inode);
-+      err = cpup_entry(dentry, bdst, bsrc, len, flags, dst_parent);
++      err = cpup_entry(cpg, dst_parent, &a->h_src_attr);
 +      if (unlikely(err))
-+              goto out;
++              goto out_rev;
 +      dst_inode = h_dst->d_inode;
 +      mutex_lock_nested(&dst_inode->i_mutex, AuLsc_I_CHILD2);
++      /* todo: necessary? */
++      /* au_pin_hdir_unlock(cpg->pin); */
 +
-+      err = cpup_iattr(dentry, bdst, h_src);
-+      isdir = S_ISDIR(dst_inode->i_mode);
-+      if (!err) {
-+              if (bdst < old_ibstart) {
-+                      if (S_ISREG(inode->i_mode)) {
-+                              err = au_dy_iaop(inode, bdst, dst_inode);
-+                              if (unlikely(err))
-+                                      goto out_rev;
++      err = cpup_iattr(cpg->dentry, cpg->bdst, h_src, &a->h_src_attr);
++      if (unlikely(err)) {
++              /* todo: necessary? */
++              /* au_pin_hdir_relock(cpg->pin); */ /* ignore an error */
++              mutex_unlock(&dst_inode->i_mutex);
++              goto out_rev;
++      }
++
++      if (cpg->bdst < old_ibstart) {
++              if (S_ISREG(inode->i_mode)) {
++                      err = au_dy_iaop(inode, cpg->bdst, dst_inode);
++                      if (unlikely(err)) {
++                              /* ignore an error */
++                              /* au_pin_hdir_relock(cpg->pin); */
++                              mutex_unlock(&dst_inode->i_mutex);
++                              goto out_rev;
 +                      }
-+                      au_set_ibstart(inode, bdst);
 +              }
-+              au_set_h_iptr(inode, bdst, au_igrab(dst_inode),
-+                            au_hi_flags(inode, isdir));
-+              mutex_unlock(&dst_inode->i_mutex);
-+              if (!isdir
-+                  && h_src->d_inode->i_nlink > 1
-+                  && plink)
-+                      au_plink_append(inode, bdst, h_dst);
-+              goto out; /* success */
++              au_set_ibstart(inode, cpg->bdst);
++      } else
++              au_set_ibend(inode, cpg->bdst);
++      au_set_h_iptr(inode, cpg->bdst, au_igrab(dst_inode),
++                    au_hi_flags(inode, isdir));
++
++      /* todo: necessary? */
++      /* err = au_pin_hdir_relock(cpg->pin); */
++      mutex_unlock(&dst_inode->i_mutex);
++      if (unlikely(err))
++              goto out_rev;
++
++      if (!isdir
++          && h_src->d_inode->i_nlink > 1
++          && plink)
++              au_plink_append(inode, cpg->bdst, h_dst);
++
++      if (au_ftest_cpup(cpg->flags, RENAME)) {
++              a->h_path.dentry = h_dst;
++              err = au_do_ren_after_cpup(cpg->dentry, cpg->bdst, &a->h_path);
 +      }
++      if (!err)
++              goto out_parent; /* success */
 +
 +      /* revert */
 +out_rev:
-+      h_path.dentry = h_parent;
-+      mutex_unlock(&dst_inode->i_mutex);
-+      au_dtime_store(&dt, dst_parent, &h_path);
-+      h_path.dentry = h_dst;
-+      if (!isdir)
-+              rerr = vfsub_unlink(h_dir, &h_path, /*force*/0);
-+      else
-+              rerr = vfsub_rmdir(h_dir, &h_path);
-+      au_dtime_revert(&dt);
++      a->h_path.dentry = h_parent;
++      au_dtime_store(&a->dt, dst_parent, &a->h_path);
++      a->h_path.dentry = h_dst;
++      rerr = 0;
++      if (h_dst->d_inode) {
++              if (!isdir)
++                      rerr = vfsub_unlink(h_dir, &a->h_path, /*force*/0);
++              else
++                      rerr = vfsub_rmdir(h_dir, &a->h_path);
++      }
++      au_dtime_revert(&a->dt);
 +      if (rerr) {
 +              AuIOErr("failed removing broken entry(%d, %d)\n", err, rerr);
 +              err = -EIO;
 +      }
-+
-+out:
++out_parent:
 +      dput(dst_parent);
++      kfree(a);
++out:
 +      return err;
 +}
 +
++#if 0 /* unused */
 +struct au_cpup_single_args {
 +      int *errp;
-+      struct dentry *dentry;
-+      aufs_bindex_t bdst, bsrc;
-+      loff_t len;
-+      unsigned int flags;
++      struct au_cp_generic *cpg;
 +      struct dentry *dst_parent;
 +};
 +
 +static void au_call_cpup_single(void *args)
 +{
 +      struct au_cpup_single_args *a = args;
-+      *a->errp = au_cpup_single(a->dentry, a->bdst, a->bsrc, a->len,
-+                                a->flags, a->dst_parent);
++
++      au_pin_hdir_acquire_nest(a->cpg->pin);
++      *a->errp = au_cpup_single(a->cpg, a->dst_parent);
++      au_pin_hdir_release(a->cpg->pin);
 +}
++#endif
 +
 +/*
 + * prevent SIGXFSZ in copy-up.
 + * testing CAP_MKNOD is for generic fs,
 + * but CAP_FSETID is for xfs only, currently.
 + */
-+static int au_cpup_sio_test(struct super_block *sb, umode_t mode)
++static int au_cpup_sio_test(struct au_pin *pin, umode_t mode)
 +{
 +      int do_sio;
++      struct super_block *sb;
++      struct inode *h_dir;
 +
 +      do_sio = 0;
++      sb = au_pinned_parent(pin)->d_sb;
 +      if (!au_wkq_test()
 +          && (!au_sbi(sb)->si_plink_maint_pid
 +              || au_plink_maint(sb, AuLock_NOPLM))) {
@@ -4038,30 +4241,29 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +              if (!do_sio)
 +                      do_sio = ((mode & (S_ISUID | S_ISGID))
 +                                && !capable(CAP_FSETID));
++              /* this workaround may be removed in the future */
++              if (!do_sio) {
++                      h_dir = au_pinned_h_dir(pin);
++                      do_sio = h_dir->i_mode & S_ISVTX;
++              }
 +      }
 +
 +      return do_sio;
 +}
 +
-+int au_sio_cpup_single(struct dentry *dentry, aufs_bindex_t bdst,
-+                     aufs_bindex_t bsrc, loff_t len, unsigned int flags,
-+                     struct dentry *dst_parent)
++#if 0 /* unused */
++int au_sio_cpup_single(struct au_cp_generic *cpg, struct dentry *dst_parent)
 +{
 +      int err, wkq_err;
 +      struct dentry *h_dentry;
 +
-+      h_dentry = au_h_dptr(dentry, bsrc);
-+      if (!au_cpup_sio_test(dentry->d_sb, h_dentry->d_inode->i_mode))
-+              err = au_cpup_single(dentry, bdst, bsrc, len, flags,
-+                                   dst_parent);
++      h_dentry = au_h_dptr(cpg->dentry, cpg->bsrc);
++      if (!au_cpup_sio_test(pin, h_dentry->d_inode->i_mode))
++              err = au_cpup_single(cpg, dst_parent);
 +      else {
 +              struct au_cpup_single_args args = {
 +                      .errp           = &err,
-+                      .dentry         = dentry,
-+                      .bdst           = bdst,
-+                      .bsrc           = bsrc,
-+                      .len            = len,
-+                      .flags          = flags,
++                      .cpg            = cpg,
 +                      .dst_parent     = dst_parent
 +              };
 +              wkq_err = au_wkq_wait(au_call_cpup_single, &args);
@@ -4071,31 +4273,35 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +      return err;
 +}
++#endif
 +
 +/*
 + * copyup the @dentry from the first active lower branch to @bdst,
 + * using au_cpup_single().
 + */
-+static int au_cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-+                        unsigned int flags)
++static int au_cpup_simple(struct au_cp_generic *cpg)
 +{
 +      int err;
-+      aufs_bindex_t bsrc, bend;
++      unsigned int flags_orig;
++      struct dentry *dentry;
 +
-+      bend = au_dbend(dentry);
-+      for (bsrc = bdst + 1; bsrc <= bend; bsrc++)
-+              if (au_h_dptr(dentry, bsrc))
-+                      break;
++      AuDebugOn(cpg->bsrc < 0);
++
++      dentry = cpg->dentry;
++      DiMustWriteLock(dentry);
 +
-+      err = au_lkup_neg(dentry, bdst);
++      err = au_lkup_neg(dentry, cpg->bdst, /*wh*/1);
 +      if (!err) {
-+              err = au_cpup_single(dentry, bdst, bsrc, len, flags, NULL);
++              flags_orig = cpg->flags;
++              au_fset_cpup(cpg->flags, RENAME);
++              err = au_cpup_single(cpg, NULL);
++              cpg->flags = flags_orig;
 +              if (!err)
 +                      return 0; /* success */
 +
 +              /* revert */
-+              au_set_h_dptr(dentry, bdst, NULL);
-+              au_set_dbstart(dentry, bsrc);
++              au_set_h_dptr(dentry, cpg->bdst, NULL);
++              au_set_dbstart(dentry, cpg->bsrc);
 +      }
 +
 +      return err;
@@ -4103,37 +4309,44 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +struct au_cpup_simple_args {
 +      int *errp;
-+      struct dentry *dentry;
-+      aufs_bindex_t bdst;
-+      loff_t len;
-+      unsigned int flags;
++      struct au_cp_generic *cpg;
 +};
 +
 +static void au_call_cpup_simple(void *args)
 +{
 +      struct au_cpup_simple_args *a = args;
-+      *a->errp = au_cpup_simple(a->dentry, a->bdst, a->len, a->flags);
++
++      au_pin_hdir_acquire_nest(a->cpg->pin);
++      *a->errp = au_cpup_simple(a->cpg);
++      au_pin_hdir_release(a->cpg->pin);
 +}
 +
-+int au_sio_cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-+                     unsigned int flags)
++static int au_do_sio_cpup_simple(struct au_cp_generic *cpg)
 +{
 +      int err, wkq_err;
-+      struct dentry *parent;
++      struct dentry *dentry, *parent;
++      struct file *h_file;
 +      struct inode *h_dir;
 +
++      dentry = cpg->dentry;
++      h_file = NULL;
++      if (au_ftest_cpup(cpg->flags, HOPEN)) {
++              AuDebugOn(cpg->bsrc < 0);
++              h_file = au_h_open_pre(dentry, cpg->bsrc);
++              err = PTR_ERR(h_file);
++              if (IS_ERR(h_file))
++                      goto out;
++      }
++
 +      parent = dget_parent(dentry);
-+      h_dir = au_h_iptr(parent->d_inode, bdst);
++      h_dir = au_h_iptr(parent->d_inode, cpg->bdst);
 +      if (!au_test_h_perm_sio(h_dir, MAY_EXEC | MAY_WRITE)
-+          && !au_cpup_sio_test(dentry->d_sb, dentry->d_inode->i_mode))
-+              err = au_cpup_simple(dentry, bdst, len, flags);
++          && !au_cpup_sio_test(cpg->pin, dentry->d_inode->i_mode))
++              err = au_cpup_simple(cpg);
 +      else {
 +              struct au_cpup_simple_args args = {
 +                      .errp           = &err,
-+                      .dentry         = dentry,
-+                      .bdst           = bdst,
-+                      .len            = len,
-+                      .flags          = flags
++                      .cpg            = cpg
 +              };
 +              wkq_err = au_wkq_wait(au_call_cpup_simple, &args);
 +              if (unlikely(wkq_err))
@@ -4141,58 +4354,97 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +      }
 +
 +      dput(parent);
++      if (h_file)
++              au_h_open_post(dentry, cpg->bsrc, h_file);
++
++out:
 +      return err;
 +}
 +
++int au_sio_cpup_simple(struct au_cp_generic *cpg)
++{
++      aufs_bindex_t bsrc, bend;
++      struct dentry *dentry, *h_dentry;
++
++      if (cpg->bsrc < 0) {
++              dentry = cpg->dentry;
++              bend = au_dbend(dentry);
++              for (bsrc = cpg->bdst + 1; bsrc <= bend; bsrc++) {
++                      h_dentry = au_h_dptr(dentry, bsrc);
++                      if (h_dentry) {
++                              AuDebugOn(!h_dentry->d_inode);
++                              break;
++                      }
++              }
++              AuDebugOn(bsrc > bend);
++              cpg->bsrc = bsrc;
++      }
++      AuDebugOn(cpg->bsrc <= cpg->bdst);
++      return au_do_sio_cpup_simple(cpg);
++}
++
++int au_sio_cpdown_simple(struct au_cp_generic *cpg)
++{
++      AuDebugOn(cpg->bdst <= cpg->bsrc);
++      return au_do_sio_cpup_simple(cpg);
++}
++
 +/* ---------------------------------------------------------------------- */
 +
 +/*
 + * copyup the deleted file for writing.
 + */
-+static int au_do_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst,
-+                       struct dentry *wh_dentry, struct file *file,
-+                       loff_t len)
++static int au_do_cpup_wh(struct au_cp_generic *cpg, struct dentry *wh_dentry,
++                       struct file *file)
 +{
 +      int err;
-+      aufs_bindex_t bstart;
-+      struct au_dinfo *dinfo;
++      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;
 +
-+      dinfo = au_di(dentry);
++      dinfo = au_di(cpg->dentry);
 +      AuRwMustWriteLock(&dinfo->di_rwsem);
 +
-+      bstart = dinfo->di_bstart;
++      bsrc_orig = cpg->bsrc;
++      cpg->bsrc = dinfo->di_bstart;
 +      hdp = dinfo->di_hdentry;
-+      h_d_dst = hdp[0 + bdst].hd_dentry;
-+      dinfo->di_bstart = bdst;
-+      hdp[0 + bdst].hd_dentry = wh_dentry;
++      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;
 +      if (file) {
-+              h_d_start = hdp[0 + bstart].hd_dentry;
-+              hdp[0 + bstart].hd_dentry = au_hf_top(file)->f_dentry;
++              h_d_start = hdp[0 + cpg->bsrc].hd_dentry;
++              hdp[0 + cpg->bsrc].hd_dentry = au_hf_top(file)->f_dentry;
 +      }
-+      err = au_cpup_single(dentry, bdst, bstart, len, !AuCpup_DTIME,
-+                           /*h_parent*/NULL);
++      flags_orig = cpg->flags;
++      cpg->flags = !AuCpup_DTIME;
++      err = au_cpup_single(cpg, /*h_parent*/NULL);
++      cpg->flags = flags_orig;
 +      if (file) {
 +              if (!err)
 +                      err = au_reopen_nondir(file);
-+              hdp[0 + bstart].hd_dentry = h_d_start;
++              hdp[0 + cpg->bsrc].hd_dentry = h_d_start;
 +      }
-+      hdp[0 + bdst].hd_dentry = h_d_dst;
-+      dinfo->di_bstart = bstart;
++      hdp[0 + cpg->bdst].hd_dentry = h_d_dst;
++      dinfo->di_bstart = cpg->bsrc;
++      cpg->bsrc = bsrc_orig;
 +
 +      return err;
 +}
 +
-+static int au_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-+                    struct file *file)
++static int au_cpup_wh(struct au_cp_generic *cpg, struct file *file)
 +{
 +      int err;
++      aufs_bindex_t bdst;
 +      struct au_dtime dt;
-+      struct dentry *parent, *h_parent, *wh_dentry;
++      struct dentry *dentry, *parent, *h_parent, *wh_dentry;
 +      struct au_branch *br;
 +      struct path h_path;
 +
++      dentry = cpg->dentry;
++      bdst = cpg->bdst;
 +      br = au_sbr(dentry->d_sb, bdst);
 +      parent = dget_parent(dentry);
 +      h_parent = au_h_dptr(parent, bdst);
@@ -4202,9 +4454,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +              goto out;
 +
 +      h_path.dentry = h_parent;
-+      h_path.mnt = br->br_mnt;
++      h_path.mnt = au_br_mnt(br);
 +      au_dtime_store(&dt, parent, &h_path);
-+      err = au_do_cpup_wh(dentry, bdst, wh_dentry, file, len);
++      err = au_do_cpup_wh(cpg, wh_dentry, file);
 +      if (unlikely(err))
 +              goto out_wh;
 +
@@ -4231,32 +4483,37 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +
 +struct au_cpup_wh_args {
 +      int *errp;
-+      struct dentry *dentry;
-+      aufs_bindex_t bdst;
-+      loff_t len;
++      struct au_cp_generic *cpg;
 +      struct file *file;
 +};
 +
 +static void au_call_cpup_wh(void *args)
 +{
 +      struct au_cpup_wh_args *a = args;
-+      *a->errp = au_cpup_wh(a->dentry, a->bdst, a->len, a->file);
++
++      au_pin_hdir_acquire_nest(a->cpg->pin);
++      *a->errp = au_cpup_wh(a->cpg, a->file);
++      au_pin_hdir_release(a->cpg->pin);
 +}
 +
-+int au_sio_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-+                 struct file *file)
++int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file)
 +{
 +      int err, wkq_err;
-+      struct dentry *parent, *h_orph, *h_parent, *h_dentry;
-+      struct inode *dir, *h_dir, *h_tmpdir, *h_inode;
++      aufs_bindex_t bdst;
++      struct dentry *dentry, *parent, *h_orph, *h_parent, *h_dentry;
++      struct inode *dir, *h_dir, *h_tmpdir;
 +      struct au_wbr *wbr;
++      struct au_pin wh_pin, *pin_orig;
 +
++      dentry = cpg->dentry;
++      bdst = cpg->bdst;
 +      parent = dget_parent(dentry);
 +      dir = parent->d_inode;
 +      h_orph = NULL;
 +      h_parent = NULL;
 +      h_dir = au_igrab(au_h_iptr(dir, bdst));
 +      h_tmpdir = h_dir;
++      pin_orig = NULL;
 +      if (!h_dir->i_nlink) {
 +              wbr = au_sbr(dentry->d_sb, bdst)->br_wbr;
 +              h_orph = wbr->wbr_orph;
@@ -4266,28 +4523,26 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +              h_tmpdir = h_orph->d_inode;
 +              au_set_h_iptr(dir, bdst, au_igrab(h_tmpdir), /*flags*/0);
 +
-+              /* this temporary unlock is safe */
 +              if (file)
 +                      h_dentry = au_hf_top(file)->f_dentry;
 +              else
 +                      h_dentry = au_h_dptr(dentry, au_dbstart(dentry));
-+              h_inode = h_dentry->d_inode;
-+              IMustLock(h_inode);
-+              mutex_unlock(&h_inode->i_mutex);
 +              mutex_lock_nested(&h_tmpdir->i_mutex, AuLsc_I_PARENT3);
-+              mutex_lock_nested(&h_inode->i_mutex, AuLsc_I_CHILD);
 +              /* todo: au_h_open_pre()? */
++
++              pin_orig = cpg->pin;
++              au_pin_init(&wh_pin, dentry, bdst, AuLsc_DI_PARENT,
++                          AuLsc_I_PARENT3, cpg->pin->udba, AuPin_DI_LOCKED);
++              cpg->pin = &wh_pin;
 +      }
 +
 +      if (!au_test_h_perm_sio(h_tmpdir, MAY_EXEC | MAY_WRITE)
-+          && !au_cpup_sio_test(dentry->d_sb, dentry->d_inode->i_mode))
-+              err = au_cpup_wh(dentry, bdst, len, file);
++          && !au_cpup_sio_test(cpg->pin, dentry->d_inode->i_mode))
++              err = au_cpup_wh(cpg, file);
 +      else {
 +              struct au_cpup_wh_args args = {
 +                      .errp   = &err,
-+                      .dentry = dentry,
-+                      .bdst   = bdst,
-+                      .len    = len,
++                      .cpg    = cpg,
 +                      .file   = file
 +              };
 +              wkq_err = au_wkq_wait(au_call_cpup_wh, &args);
@@ -4300,6 +4555,8 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +              /* todo: au_h_open_post()? */
 +              au_set_h_iptr(dir, bdst, au_igrab(h_dir), /*flags*/0);
 +              au_set_h_dptr(parent, bdst, h_parent);
++              AuDebugOn(!pin_orig);
++              cpg->pin = pin_orig;
 +      }
 +      iput(h_dir);
 +      dput(parent);
@@ -4315,6 +4572,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +/* cf. revalidate function in file.c */
 +int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst,
 +             int (*cp)(struct dentry *dentry, aufs_bindex_t bdst,
++                       struct au_pin *pin,
 +                       struct dentry *h_parent, void *arg),
 +             void *arg)
 +{
@@ -4360,7 +4618,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +                      au_pin_set_dentry(&pin, d);
 +                      err = au_do_pin(&pin);
 +                      if (!err) {
-+                              err = cp(d, bdst, h_parent, arg);
++                              err = cp(d, bdst, &pin, h_parent, arg);
 +                              au_unpin(&pin);
 +                      }
 +              }
@@ -4377,10 +4635,19 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +}
 +
 +static int au_cpup_dir(struct dentry *dentry, aufs_bindex_t bdst,
++                     struct au_pin *pin,
 +                     struct dentry *h_parent __maybe_unused ,
 +                     void *arg __maybe_unused)
 +{
-+      return au_sio_cpup_simple(dentry, bdst, -1, AuCpup_DTIME);
++      struct au_cp_generic cpg = {
++              .dentry = dentry,
++              .bdst   = bdst,
++              .bsrc   = -1,
++              .len    = 0,
++              .pin    = pin,
++              .flags  = AuCpup_DTIME
++      };
++      return au_sio_cpup_simple(&cpg);
 +}
 +
 +int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst)
@@ -4413,8 +4680,8 @@ 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       2013-02-19 08:40:03.946892891 +0100
-@@ -0,0 +1,81 @@
++++ linux/fs/aufs/cpup.h       2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,90 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -4446,8 +4713,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 +
 +struct inode;
 +struct file;
++struct au_pin;
 +
-+void au_cpup_attr_flags(struct inode *dst, struct inode *src);
++void au_cpup_attr_flags(struct inode *dst, unsigned int iflags);
 +void au_cpup_attr_timesizes(struct inode *inode);
 +void au_cpup_attr_nlink(struct inode *inode, int force);
 +void au_cpup_attr_changeable(struct inode *inode);
@@ -4456,10 +4724,21 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 +
 +/* ---------------------------------------------------------------------- */
 +
++struct au_cp_generic {
++      struct dentry   *dentry;
++      aufs_bindex_t   bdst, bsrc;
++      loff_t          len;
++      struct au_pin   *pin;
++      unsigned int    flags;
++};
++
 +/* cpup flags */
 +#define AuCpup_DTIME  1               /* do dtime_store/revert */
 +#define AuCpup_KEEPLINO       (1 << 1)        /* do not clear the lower xino,
 +                                         for link(2) */
++#define AuCpup_RENAME (1 << 2)        /* rename after cpup */
++#define AuCpup_HOPEN  (1 << 3)        /* call h_open_pre/post() in cpup */
++
 +#define au_ftest_cpup(flags, name)    ((flags) & AuCpup_##name)
 +#define au_fset_cpup(flags, name) \
 +      do { (flags) |= AuCpup_##name; } while (0)
@@ -4467,16 +4746,13 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 +      do { (flags) &= ~AuCpup_##name; } while (0)
 +
 +int au_copy_file(struct file *dst, struct file *src, loff_t len);
-+int au_sio_cpup_single(struct dentry *dentry, aufs_bindex_t bdst,
-+                     aufs_bindex_t bsrc, loff_t len, unsigned int flags,
-+                     struct dentry *dst_parent);
-+int au_sio_cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-+                     unsigned int flags);
-+int au_sio_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-+                 struct file *file);
++int au_sio_cpup_simple(struct au_cp_generic *cpg);
++int au_sio_cpdown_simple(struct au_cp_generic *cpg);
++int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file);
 +
 +int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst,
 +             int (*cp)(struct dentry *dentry, aufs_bindex_t bdst,
++                       struct au_pin *pin,
 +                       struct dentry *h_parent, void *arg),
 +             void *arg);
 +int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst);
@@ -4498,8 +4774,8 @@ 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    2013-07-01 12:54:21.039493094 +0200
-@@ -0,0 +1,332 @@
++++ linux/fs/aufs/dbgaufs.c    2013-07-06 13:20:47.740198107 +0200
+@@ -0,0 +1,433 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -4598,28 +4874,123 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +
 +/* ---------------------------------------------------------------------- */
 +
-+static int dbgaufs_xib_open(struct inode *inode, struct file *file)
++struct dbgaufs_plink_arg {
++      int n;
++      char a[];
++};
++
++static int dbgaufs_plink_release(struct inode *inode __maybe_unused,
++                               struct file *file)
 +{
-+      int err;
++      free_page((unsigned long)file->private_data);
++      return 0;
++}
++
++static int dbgaufs_plink_open(struct inode *inode, struct file *file)
++{
++      int err, i, limit;
++      unsigned long n, sum;
++      struct dbgaufs_plink_arg *p;
 +      struct au_sbinfo *sbinfo;
 +      struct super_block *sb;
++      struct au_sphlhead *sphl;
++
++      err = -ENOMEM;
++      p = (void *)get_zeroed_page(GFP_NOFS);
++      if (unlikely(!p))
++              goto out;
 +
++      err = -EFBIG;
 +      sbinfo = inode->i_private;
 +      sb = sbinfo->si_sb;
 +      si_noflush_read_lock(sb);
-+      err = dbgaufs_xi_open(sbinfo->si_xib, file, /*do_fcnt*/0);
++      if (au_opt_test(au_mntflags(sb), PLINK)) {
++              limit = PAGE_SIZE - sizeof(p->n);
++
++              /* the number of buckets */
++              n = snprintf(p->a + p->n, limit, "%d\n", AuPlink_NHASH);
++              p->n += n;
++              limit -= n;
++
++              sum = 0;
++              for (i = 0, sphl = sbinfo->si_plink;
++                   i < AuPlink_NHASH;
++                   i++, sphl++) {
++                      n = au_sphl_count(sphl);
++                      sum += n;
++
++                      n = snprintf(p->a + p->n, limit, "%lu ", n);
++                      p->n += n;
++                      limit -= n;
++                      if (unlikely(limit <= 0))
++                              goto out_free;
++              }
++              p->a[p->n - 1] = '\n';
++
++              /* the sum of plinks */
++              n = snprintf(p->a + p->n, limit, "%lu\n", sum);
++              p->n += n;
++              limit -= n;
++              if (unlikely(limit <= 0))
++                      goto out_free;
++      } else {
++#define str "1\n0\n0\n"
++              p->n = sizeof(str) - 1;
++              strcpy(p->a, str);
++#undef str
++      }
 +      si_read_unlock(sb);
++
++      err = 0;
++      file->private_data = p;
++      goto out; /* success */
++
++out_free:
++      free_page((unsigned long)p);
++out:
 +      return err;
 +}
 +
-+static const struct file_operations dbgaufs_xib_fop = {
-+      .owner          = THIS_MODULE,
-+      .open           = dbgaufs_xib_open,
-+      .release        = dbgaufs_xi_release,
-+      .read           = dbgaufs_xi_read
-+};
-+
-+/* ---------------------------------------------------------------------- */
++static ssize_t dbgaufs_plink_read(struct file *file, char __user *buf,
++                                size_t count, loff_t *ppos)
++{
++      struct dbgaufs_plink_arg *p;
++
++      p = file->private_data;
++      return simple_read_from_buffer(buf, count, ppos, p->a, p->n);
++}
++
++static const struct file_operations dbgaufs_plink_fop = {
++      .owner          = THIS_MODULE,
++      .open           = dbgaufs_plink_open,
++      .release        = dbgaufs_plink_release,
++      .read           = dbgaufs_plink_read
++};
++
++/* ---------------------------------------------------------------------- */
++
++static int dbgaufs_xib_open(struct inode *inode, struct file *file)
++{
++      int err;
++      struct au_sbinfo *sbinfo;
++      struct super_block *sb;
++
++      sbinfo = inode->i_private;
++      sb = sbinfo->si_sb;
++      si_noflush_read_lock(sb);
++      err = dbgaufs_xi_open(sbinfo->si_xib, file, /*do_fcnt*/0);
++      si_read_unlock(sb);
++      return err;
++}
++
++static const struct file_operations dbgaufs_xib_fop = {
++      .owner          = THIS_MODULE,
++      .open           = dbgaufs_xib_open,
++      .release        = dbgaufs_xi_release,
++      .read           = dbgaufs_xi_read
++};
++
++/* ---------------------------------------------------------------------- */
 +
 +#define DbgaufsXi_PREFIX "xi"
 +
@@ -4805,6 +5176,12 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +      if (unlikely(!sbinfo->si_dbgaufs_xib))
 +              goto out_dir;
 +
++      sbinfo->si_dbgaufs_plink = debugfs_create_file
++              ("plink", dbgaufs_mode, sbinfo->si_dbgaufs, sbinfo,
++               &dbgaufs_plink_fop);
++      if (unlikely(!sbinfo->si_dbgaufs_plink))
++              goto out_dir;
++
 +      err = dbgaufs_xigen_init(sbinfo);
 +      if (!err)
 +              goto out; /* success */
@@ -4834,7 +5211,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 --- /usr/share/empty/fs/aufs/dbgaufs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dbgaufs.h    2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dbgaufs.h    2013-07-06 13:20:47.740198107 +0200
 @@ -0,0 +1,49 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -4887,7 +5264,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 +#endif /* __DBGAUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 --- /usr/share/empty/fs/aufs/dcsub.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dcsub.c      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dcsub.c      2013-07-30 22:42:55.839613269 +0200
 @@ -0,0 +1,243 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -5134,7 +5511,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 --- /usr/share/empty/fs/aufs/dcsub.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dcsub.h      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dcsub.h      2013-07-06 13:20:47.740198107 +0200
 @@ -0,0 +1,94 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -5232,7 +5609,7 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 +#endif /* __AUFS_DCSUB_H__ */
 diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 --- /usr/share/empty/fs/aufs/debug.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/debug.c      2013-07-01 12:54:21.039493094 +0200
++++ linux/fs/aufs/debug.c      2013-08-23 23:59:39.634916914 +0200
 @@ -0,0 +1,491 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -5323,7 +5700,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +              return -1;
 +      }
 +
-+      /* the type of i_blocks depends upon CONFIG_LSF */
++      /* the type of i_blocks depends upon CONFIG_LBDAF */
 +      BUILD_BUG_ON(sizeof(inode->i_blocks) != sizeof(unsigned long)
 +                   && sizeof(inode->i_blocks) != sizeof(u64));
 +      if (wh) {
@@ -5491,7 +5868,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +
 +      if (!br || IS_ERR(br))
 +              goto out;
-+      mnt = br->br_mnt;
++      mnt = au_br_mnt(br);
 +      if (!mnt || IS_ERR(mnt))
 +              goto out;
 +      sb = mnt->mnt_sb;
@@ -5532,7 +5909,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +
 +      a->mnt.mnt_sb = sb;
 +      a->fake.br_perm = 0;
-+      a->fake.br_mnt = &a->mnt;
++      a->fake.br_path.mnt = &a->mnt;
 +      a->fake.br_xino.xi_file = NULL;
 +      atomic_set(&a->fake.br_count, 0);
 +      smp_mb(); /* atomic_set */
@@ -5727,7 +6104,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +}
 diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h
 --- /usr/share/empty/fs/aufs/debug.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/debug.h      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/debug.h      2013-07-06 13:20:47.740198107 +0200
 @@ -0,0 +1,242 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -5973,8 +6350,8 @@ 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     2013-07-01 12:54:18.772748151 +0200
-@@ -0,0 +1,1061 @@
++++ linux/fs/aufs/dentry.c     2013-07-06 13:20:47.740198107 +0200
+@@ -0,0 +1,1065 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -6223,15 +6600,19 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +/*
 + * lookup @dentry on @bindex which should be negative.
 + */
-+int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex)
++int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex, int wh)
 +{
 +      int err;
 +      struct dentry *parent, *h_parent, *h_dentry;
++      struct au_branch *br;
 +
 +      parent = dget_parent(dentry);
 +      h_parent = au_h_dptr(parent, bindex);
-+      h_dentry = au_sio_lkup_one(&dentry->d_name, h_parent,
-+                                 au_sbr(dentry->d_sb, bindex));
++      br = au_sbr(dentry->d_sb, bindex);
++      if (wh)
++              h_dentry = au_whtmp_lkup(h_parent, br, &dentry->d_name);
++      else
++              h_dentry = au_sio_lkup_one(&dentry->d_name, h_parent, br);
 +      err = PTR_ERR(h_dentry);
 +      if (IS_ERR(h_dentry))
 +              goto out;
@@ -7038,7 +7419,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +};
 diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 --- /usr/share/empty/fs/aufs/dentry.h  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dentry.h     2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dentry.h     2013-07-06 13:20:47.740198107 +0200
 @@ -0,0 +1,234 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -7094,7 +7475,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +              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_neg(struct dentry *dentry, aufs_bindex_t bindex);
++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);
 +
@@ -7276,7 +7657,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +#endif /* __AUFS_DENTRY_H__ */
 diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 --- /usr/share/empty/fs/aufs/dinfo.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dinfo.c      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dinfo.c      2013-07-30 22:42:55.839613269 +0200
 @@ -0,0 +1,543 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -7823,8 +8204,8 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 --- /usr/share/empty/fs/aufs/dir.c     1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.c        2013-07-01 12:54:18.776081600 +0200
-@@ -0,0 +1,630 @@
++++ linux/fs/aufs/dir.c        2013-07-30 22:42:55.839613269 +0200
+@@ -0,0 +1,632 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -7860,6 +8241,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +      nlink += h_dir->i_nlink - 2;
 +      if (h_dir->i_nlink < 2)
 +              nlink += 2;
++      smp_mb();
 +      /* 0 can happen in revaliding */
 +      set_nlink(dir, nlink);
 +}
@@ -7874,6 +8256,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +      nlink -= h_dir->i_nlink - 2;
 +      if (h_dir->i_nlink < 2)
 +              nlink -= 2;
++      smp_mb();
 +      /* nlink == 0 means the branch-fs is broken */
 +      set_nlink(dir, nlink);
 +}
@@ -8457,7 +8840,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +};
 diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 --- /usr/share/empty/fs/aufs/dir.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.h        2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dir.h        2013-07-30 22:42:55.839613269 +0200
 @@ -0,0 +1,137 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -8598,7 +8981,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +#endif /* __AUFS_DIR_H__ */
 diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 --- /usr/share/empty/fs/aufs/dynop.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.c      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dynop.c      2013-07-30 22:42:55.839613269 +0200
 @@ -0,0 +1,379 @@
 +/*
 + * Copyright (C) 2010-2013 Junjiro R. Okajima
@@ -8841,7 +9224,7 @@ 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, br->br_mnt->mnt_sb);
++      p->set(key, op->dy_hop, au_br_sb(br));
 +      old = dy_gadd(spl, key);
 +      if (old) {
 +              kfree(key);
@@ -8981,7 +9364,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 --- /usr/share/empty/fs/aufs/dynop.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dynop.h      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/dynop.h      2013-07-06 13:20:47.740198107 +0200
 @@ -0,0 +1,76 @@
 +/*
 + * Copyright (C) 2010-2013 Junjiro R. Okajima
@@ -9061,7 +9444,7 @@ diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h
 +#endif /* __AUFS_DYNOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 --- /usr/share/empty/fs/aufs/export.c  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/export.c     2013-07-01 12:54:18.776081600 +0200
++++ linux/fs/aufs/export.c     2013-07-30 22:42:55.839613269 +0200
 @@ -0,0 +1,826 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -9572,7 +9955,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +      struct path path;
 +
 +      br = au_sbr(sb, nsi_lock->bindex);
-+      h_mnt = br->br_mnt;
++      h_mnt = au_br_mnt(br);
 +      h_sb = h_mnt->mnt_sb;
 +      /* todo: call lower fh_to_dentry()? fh_to_parent()? */
 +      h_parent = exportfs_decode_fh(h_mnt, (void *)(fh + Fh_tail),
@@ -9796,7 +10179,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +
 +      err = -EPERM;
 +      br = au_sbr(sb, bindex);
-+      h_sb = br->br_mnt->mnt_sb;
++      h_sb = au_br_sb(br);
 +      if (unlikely(!h_sb->s_export_op)) {
 +              AuErr1("%s branch is not exportable\n", au_sbtype(h_sb));
 +              goto out_hparent;
@@ -9891,8 +10274,8 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +}
 diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 --- /usr/share/empty/fs/aufs/file.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.c       2013-07-01 12:54:18.776081600 +0200
-@@ -0,0 +1,679 @@
++++ linux/fs/aufs/file.c       2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,708 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -9962,7 +10345,7 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +      br = au_sbr(sb, bindex);
 +      h_file = ERR_PTR(-EACCES);
 +      exec_flag = flags & __FMODE_EXEC;
-+      if (exec_flag && (br->br_mnt->mnt_flags & MNT_NOEXEC))
++      if (exec_flag && (au_br_mnt(br)->mnt_flags & MNT_NOEXEC))
 +              goto out;
 +
 +      /* drop flags for writing */
@@ -9971,7 +10354,7 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +      flags &= ~O_CREAT;
 +      atomic_inc(&br->br_count);
 +      h_path.dentry = h_dentry;
-+      h_path.mnt = br->br_mnt;
++      h_path.mnt = au_br_mnt(br);
 +      if (!au_special_file(h_inode->i_mode))
 +              h_file = vfsub_dentry_open(&h_path, flags);
 +      else {
@@ -10049,13 +10432,29 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +              au_set_h_fptr(file, bstart, NULL);
 +      }
 +      AuDebugOn(au_fi(file)->fi_hdir);
-+      AuDebugOn(au_fbstart(file) < bstart);
++      /*
++       * it can happen
++       * file exists on both of rw and ro
++       * open --> dbstart and fbstart are both 0
++       * prepend a branch as rw, "rw" become ro
++       * remove rw/file
++       * delete the top branch, "rw" becomes rw again
++       *      --> dbstart is 1, fbstart is still 0
++       * write --> fbstart is 0 but dbstart is 1
++       */
++      /* AuDebugOn(au_fbstart(file) < bstart); */
 +
 +      h_file = au_h_open(dentry, bstart, vfsub_file_flags(file) & ~O_TRUNC,
 +                         file);
 +      err = PTR_ERR(h_file);
-+      if (IS_ERR(h_file))
++      if (IS_ERR(h_file)) {
++              if (h_file_tmp) {
++                      atomic_inc(&au_sbr(dentry->d_sb, bstart)->br_count);
++                      au_set_h_fptr(file, bstart, h_file_tmp);
++                      h_file_tmp = NULL;
++              }
 +              goto out; /* todo: close all? */
++      }
 +
 +      err = 0;
 +      au_set_fbstart(file, bstart);
@@ -10097,32 +10496,39 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +}
 +
 +static int au_ready_to_write_wh(struct file *file, loff_t len,
-+                              aufs_bindex_t bcpup)
++                              aufs_bindex_t bcpup, struct au_pin *pin)
 +{
 +      int err;
 +      struct inode *inode, *h_inode;
-+      struct dentry *dentry, *h_dentry, *hi_wh;
++      struct dentry *h_dentry, *hi_wh;
++      struct au_cp_generic cpg = {
++              .dentry = file->f_dentry,
++              .bdst   = bcpup,
++              .bsrc   = -1,
++              .len    = len,
++              .pin    = pin
++      };
 +
-+      dentry = file->f_dentry;
-+      au_update_dbstart(dentry);
-+      inode = dentry->d_inode;
++      au_update_dbstart(cpg.dentry);
++      inode = cpg.dentry->d_inode;
 +      h_inode = NULL;
-+      if (au_dbstart(dentry) <= bcpup && au_dbend(dentry) >= bcpup) {
-+              h_dentry = au_h_dptr(dentry, bcpup);
++      if (au_dbstart(cpg.dentry) <= bcpup
++          && au_dbend(cpg.dentry) >= bcpup) {
++              h_dentry = au_h_dptr(cpg.dentry, bcpup);
 +              if (h_dentry)
 +                      h_inode = h_dentry->d_inode;
 +      }
 +      hi_wh = au_hi_wh(inode, bcpup);
 +      if (!hi_wh && !h_inode)
-+              err = au_sio_cpup_wh(dentry, bcpup, len, file);
++              err = au_sio_cpup_wh(&cpg, file);
 +      else
 +              /* already copied-up after unlink */
 +              err = au_reopen_wh(file, bcpup, hi_wh);
 +
 +      if (!err
 +          && inode->i_nlink > 1
-+          && au_opt_test(au_mntflags(dentry->d_sb), PLINK))
-+              au_plink_append(inode, bcpup, au_h_dptr(dentry, bcpup));
++          && au_opt_test(au_mntflags(cpg.dentry->d_sb), PLINK))
++              au_plink_append(inode, bcpup, au_h_dptr(cpg.dentry, bcpup));
 +
 +      return err;
 +}
@@ -10133,81 +10539,80 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +int au_ready_to_write(struct file *file, loff_t len, struct au_pin *pin)
 +{
 +      int err;
-+      aufs_bindex_t bstart, bcpup, dbstart;
-+      struct dentry *dentry, *parent, *h_dentry;
-+      struct inode *h_inode, *inode;
++      aufs_bindex_t dbstart;
++      struct dentry *parent, *h_dentry;
++      struct inode *inode;
 +      struct super_block *sb;
 +      struct file *h_file;
++      struct au_cp_generic cpg = {
++              .dentry = file->f_dentry,
++              .bdst   = -1,
++              .bsrc   = -1,
++              .len    = len,
++              .pin    = pin,
++              .flags  = AuCpup_DTIME
++      };
 +
-+      dentry = file->f_dentry;
-+      sb = dentry->d_sb;
-+      inode = dentry->d_inode;
++      sb = cpg.dentry->d_sb;
++      inode = cpg.dentry->d_inode;
 +      AuDebugOn(au_special_file(inode->i_mode));
-+      bstart = au_fbstart(file);
-+      err = au_test_ro(sb, bstart, inode);
++      cpg.bsrc = au_fbstart(file);
++      err = au_test_ro(sb, cpg.bsrc, inode);
 +      if (!err && (au_hf_top(file)->f_mode & FMODE_WRITE)) {
-+              err = au_pin(pin, dentry, bstart, AuOpt_UDBA_NONE, /*flags*/0);
++              err = au_pin(pin, cpg.dentry, cpg.bsrc, AuOpt_UDBA_NONE,
++                           /*flags*/0);
 +              goto out;
 +      }
 +
 +      /* need to cpup or reopen */
-+      parent = dget_parent(dentry);
++      parent = dget_parent(cpg.dentry);
 +      di_write_lock_parent(parent);
-+      err = AuWbrCopyup(au_sbi(sb), dentry);
-+      bcpup = err;
++      err = AuWbrCopyup(au_sbi(sb), cpg.dentry);
++      cpg.bdst = err;
 +      if (unlikely(err < 0))
 +              goto out_dgrade;
 +      err = 0;
 +
-+      if (!d_unhashed(dentry) && !au_h_dptr(parent, bcpup)) {
-+              err = au_cpup_dirs(dentry, bcpup);
++      if (!d_unhashed(cpg.dentry) && !au_h_dptr(parent, cpg.bdst)) {
++              err = au_cpup_dirs(cpg.dentry, cpg.bdst);
 +              if (unlikely(err))
 +                      goto out_dgrade;
 +      }
 +
-+      err = au_pin(pin, dentry, bcpup, AuOpt_UDBA_NONE,
++      err = au_pin(pin, cpg.dentry, cpg.bdst, AuOpt_UDBA_NONE,
 +                   AuPin_DI_LOCKED | AuPin_MNT_WRITE);
 +      if (unlikely(err))
 +              goto out_dgrade;
 +
 +      h_dentry = au_hf_top(file)->f_dentry;
-+      h_inode = h_dentry->d_inode;
-+      dbstart = au_dbstart(dentry);
-+      if (dbstart <= bcpup) {
-+              h_dentry = au_h_dptr(dentry, bcpup);
++      dbstart = au_dbstart(cpg.dentry);
++      if (dbstart <= cpg.bdst) {
++              h_dentry = au_h_dptr(cpg.dentry, cpg.bdst);
 +              AuDebugOn(!h_dentry);
-+              h_inode = h_dentry->d_inode;
-+              AuDebugOn(!h_inode);
-+              bstart = bcpup;
++              cpg.bsrc = cpg.bdst;
 +      }
 +
-+      if (dbstart <= bcpup            /* just reopen */
-+          || !d_unhashed(dentry)      /* copyup and reopen */
++      if (dbstart <= cpg.bdst         /* just reopen */
++          || !d_unhashed(cpg.dentry)  /* copyup and reopen */
 +              ) {
-+              mutex_lock_nested(&h_inode->i_mutex, AuLsc_I_CHILD);
-+              h_file = au_h_open_pre(dentry, bstart);
-+              if (IS_ERR(h_file)) {
++              h_file = au_h_open_pre(cpg.dentry, cpg.bsrc);
++              if (IS_ERR(h_file))
 +                      err = PTR_ERR(h_file);
-+                      h_file = NULL;
-+              } else {
++              else {
 +                      di_downgrade_lock(parent, AuLock_IR);
-+                      if (dbstart > bcpup)
-+                              err = au_sio_cpup_simple(dentry, bcpup, len,
-+                                                       AuCpup_DTIME);
++                      if (dbstart > cpg.bdst)
++                              err = au_sio_cpup_simple(&cpg);
 +                      if (!err)
 +                              err = au_reopen_nondir(file);
++                      au_h_open_post(cpg.dentry, cpg.bsrc, h_file);
 +              }
-+              mutex_unlock(&h_inode->i_mutex);
-+              au_h_open_post(dentry, bstart, h_file);
 +      } else {                        /* copyup as wh and reopen */
 +              /*
 +               * since writable hfsplus branch is not supported,
 +               * h_open_pre/post() are unnecessary.
 +               */
-+              mutex_lock_nested(&h_inode->i_mutex, AuLsc_I_CHILD);
-+              err = au_ready_to_write_wh(file, len, bcpup);
++              err = au_ready_to_write_wh(file, len, cpg.bdst, pin);
 +              di_downgrade_lock(parent, AuLock_IR);
-+              mutex_unlock(&h_inode->i_mutex);
 +      }
 +
 +      if (!err) {
@@ -10256,29 +10661,35 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +static int au_file_refresh_by_inode(struct file *file, int *need_reopen)
 +{
 +      int err;
-+      aufs_bindex_t bstart;
 +      struct au_pin pin;
 +      struct au_finfo *finfo;
-+      struct dentry *dentry, *parent, *hi_wh;
++      struct dentry *parent, *hi_wh;
 +      struct inode *inode;
 +      struct super_block *sb;
++      struct au_cp_generic cpg = {
++              .dentry = file->f_dentry,
++              .bdst   = -1,
++              .bsrc   = -1,
++              .len    = -1,
++              .pin    = &pin,
++              .flags  = AuCpup_DTIME
++      };
 +
 +      FiMustWriteLock(file);
 +
 +      err = 0;
 +      finfo = au_fi(file);
-+      dentry = file->f_dentry;
-+      sb = dentry->d_sb;
-+      inode = dentry->d_inode;
-+      bstart = au_ibstart(inode);
-+      if (bstart == finfo->fi_btop || IS_ROOT(dentry))
++      sb = cpg.dentry->d_sb;
++      inode = cpg.dentry->d_inode;
++      cpg.bdst = au_ibstart(inode);
++      if (cpg.bdst == finfo->fi_btop || IS_ROOT(cpg.dentry))
 +              goto out;
 +
-+      parent = dget_parent(dentry);
-+      if (au_test_ro(sb, bstart, inode)) {
++      parent = dget_parent(cpg.dentry);
++      if (au_test_ro(sb, cpg.bdst, inode)) {
 +              di_read_lock_parent(parent, !AuLock_IR);
-+              err = AuWbrCopyup(au_sbi(sb), dentry);
-+              bstart = err;
++              err = AuWbrCopyup(au_sbi(sb), cpg.dentry);
++              cpg.bdst = err;
 +              di_read_unlock(parent, !AuLock_IR);
 +              if (unlikely(err < 0))
 +                      goto out_parent;
@@ -10286,25 +10697,26 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +      }
 +
 +      di_read_lock_parent(parent, AuLock_IR);
-+      hi_wh = au_hi_wh(inode, bstart);
++      hi_wh = au_hi_wh(inode, cpg.bdst);
 +      if (!S_ISDIR(inode->i_mode)
 +          && au_opt_test(au_mntflags(sb), PLINK)
 +          && au_plink_test(inode)
-+          && !d_unhashed(dentry)) {
-+              err = au_test_and_cpup_dirs(dentry, bstart);
++          && !d_unhashed(cpg.dentry)
++          && cpg.bdst < au_dbstart(cpg.dentry)) {
++              err = au_test_and_cpup_dirs(cpg.dentry, cpg.bdst);
 +              if (unlikely(err))
 +                      goto out_unlock;
 +
 +              /* always superio. */
-+              err = au_pin(&pin, dentry, bstart, AuOpt_UDBA_NONE,
++              err = au_pin(&pin, cpg.dentry, cpg.bdst, AuOpt_UDBA_NONE,
 +                           AuPin_DI_LOCKED | AuPin_MNT_WRITE);
-+              if (!err)
-+                      err = au_sio_cpup_simple(dentry, bstart, -1,
-+                                               AuCpup_DTIME);
-+              au_unpin(&pin);
++              if (!err) {
++                      err = au_sio_cpup_simple(&cpg);
++                      au_unpin(&pin);
++              }
 +      } else if (hi_wh) {
 +              /* already copied-up after unlink */
-+              err = au_reopen_wh(file, bstart, hi_wh);
++              err = au_reopen_wh(file, cpg.bdst, hi_wh);
 +              *need_reopen = 0;
 +      }
 +
@@ -10574,8 +10986,8 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 +};
 diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 --- /usr/share/empty/fs/aufs/file.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.h       2013-02-19 08:40:03.946892891 +0100
-@@ -0,0 +1,298 @@
++++ linux/fs/aufs/file.h       2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,310 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -10687,9 +11099,14 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +
 +#ifdef CONFIG_AUFS_SP_IATTR
 +/* f_op_sp.c */
++struct au_finfo *au_fi_sp(struct file *file);
 +int au_special_file(umode_t mode);
 +void au_init_special_fop(struct inode *inode, umode_t mode, dev_t rdev);
 +#else
++static inline struct au_finfo *au_fi_sp(struct file *file)
++{
++      return NULL;
++}
 +AuStubInt0(au_special_file, umode_t mode)
 +static inline void au_init_special_fop(struct inode *inode, umode_t mode,
 +                                     dev_t rdev)
@@ -10716,13 +11133,20 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +#ifdef CONFIG_COMPAT
 +long aufs_compat_ioctl_dir(struct file *file, unsigned int cmd,
 +                         unsigned long arg);
++long aufs_compat_ioctl_nondir(struct file *file, unsigned int cmd,
++                            unsigned long arg);
 +#endif
 +
 +/* ---------------------------------------------------------------------- */
 +
 +static inline struct au_finfo *au_fi(struct file *file)
 +{
-+      return file->private_data;
++      struct au_finfo *finfo;
++
++      finfo = au_fi_sp(file);
++      if (!finfo)
++              finfo = file->private_data;
++      return finfo;
 +}
 +
 +/* ---------------------------------------------------------------------- */
@@ -10876,7 +11300,7 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
 +#endif /* __AUFS_FILE_H__ */
 diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 --- /usr/share/empty/fs/aufs/finfo.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/finfo.c      2013-02-19 08:40:03.946892891 +0100
++++ linux/fs/aufs/finfo.c      2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,157 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -11037,8 +11461,8 @@ diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 --- /usr/share/empty/fs/aufs/f_op.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op.c       2013-07-01 12:54:18.776081600 +0200
-@@ -0,0 +1,720 @@
++++ linux/fs/aufs/f_op.c       2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,721 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -11061,6 +11485,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 + * file and vm operations
 + */
 +
++#include <linux/aio.h>
 +#include <linux/fs_stack.h>
 +#include <linux/mman.h>
 +#include <linux/security.h>
@@ -11742,7 +12167,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +#endif
 +      .unlocked_ioctl = aufs_ioctl_nondir,
 +#ifdef CONFIG_COMPAT
-+      .compat_ioctl   = aufs_ioctl_nondir, /* same */
++      .compat_ioctl   = aufs_compat_ioctl_nondir,
 +#endif
 +      .mmap           = aufs_mmap,
 +      .open           = aufs_open_nondir,
@@ -11761,8 +12186,8 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
 +};
 diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 --- /usr/share/empty/fs/aufs/f_op_sp.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op_sp.c    2013-07-01 12:54:18.776081600 +0200
-@@ -0,0 +1,295 @@
++++ linux/fs/aufs/f_op_sp.c    2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,383 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -11787,8 +12212,80 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 + * their file I/O is handled out of aufs.
 + */
 +
++#include <linux/aio.h>
 +#include "aufs.h"
 +
++/*
++ * I don't think the size of this list grows much.
++ * so here is a very simple list implemented in order to find finfo matching a
++ * given file.
++ */
++static struct au_sphlhead au_finfo_sp = {
++      .spin   = __SPIN_LOCK_INITIALIZER(au_finfo_sp.spin),
++      .head   = HLIST_HEAD_INIT
++};
++
++struct au_finfo_sp {
++      struct hlist_node       hlist;
++      struct file             *file;
++      struct au_finfo         *finfo;
++};
++
++struct au_finfo *au_fi_sp(struct file *file)
++{
++      struct au_finfo *finfo;
++      struct au_finfo_sp *sp;
++
++      finfo = NULL;
++      spin_lock(&au_finfo_sp.spin);
++      hlist_for_each_entry(sp, &au_finfo_sp.head, hlist) {
++              if (sp->file != file)
++                      continue;
++              finfo = sp->finfo;
++              break;
++      }
++      spin_unlock(&au_finfo_sp.spin);
++
++      return finfo;
++}
++
++static int au_fi_sp_add(struct file *file)
++{
++      int err;
++      struct au_finfo_sp *sp;
++
++      err = -ENOMEM;
++      sp = kmalloc(sizeof(*sp), GFP_NOFS);
++      if (sp) {
++              err = 0;
++              sp->file = file;
++              sp->finfo = file->private_data;
++              spin_lock(&au_finfo_sp.spin);
++              hlist_add_head(&sp->hlist, &au_finfo_sp.head);
++              spin_unlock(&au_finfo_sp.spin);
++      }
++      return err;
++}
++
++static void au_fi_sp_del(struct file *file)
++{
++      struct au_finfo_sp *sp, *do_free;
++
++      do_free = NULL;
++      spin_lock(&au_finfo_sp.spin);
++      hlist_for_each_entry(sp, &au_finfo_sp.head, hlist) {
++              if (sp->file != file)
++                      continue;
++              hlist_del(&sp->hlist);
++              do_free = sp;
++              break;
++      }
++      spin_unlock(&au_finfo_sp.spin);
++      kfree(do_free);
++}
++
++/* ---------------------------------------------------------------------- */
++
 +static ssize_t aufs_aio_read_sp(struct kiocb *kio, const struct iovec *iov,
 +                              unsigned long nv, loff_t pos)
 +{
@@ -11855,6 +12352,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +      /* close this fifo in aufs */
 +      err = h_file->f_op->release(inode, file); /* ignore */
 +      aufs_release_nondir(inode, file); /* ignore */
++      au_fi_sp_del(file);
 +      return err;
 +}
 +
@@ -11939,12 +12437,19 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +static int au_cpup_sp(struct dentry *dentry)
 +{
 +      int err;
-+      aufs_bindex_t bcpup;
 +      struct au_pin pin;
 +      struct au_wr_dir_args wr_dir_args = {
 +              .force_btgt     = -1,
 +              .flags          = 0
 +      };
++      struct au_cp_generic cpg = {
++              .dentry = dentry,
++              .bdst   = -1,
++              .bsrc   = -1,
++              .len    = -1,
++              .pin    = &pin,
++              .flags  = AuCpup_DTIME
++      };
 +
 +      AuDbg("%.*s\n", AuDLNPair(dentry));
 +
@@ -11953,15 +12458,15 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +      err = au_wr_dir(dentry, /*src_dentry*/NULL, &wr_dir_args);
 +      if (unlikely(err < 0))
 +              goto out;
-+      bcpup = err;
++      cpg.bdst = err;
 +      err = 0;
-+      if (bcpup == au_dbstart(dentry))
++      if (cpg.bdst == au_dbstart(dentry))
 +              goto out; /* success */
 +
-+      err = au_pin(&pin, dentry, bcpup, au_opt_udba(dentry->d_sb),
++      err = au_pin(&pin, dentry, cpg.bdst, au_opt_udba(dentry->d_sb),
 +                   AuPin_MNT_WRITE);
 +      if (!err) {
-+              err = au_sio_cpup_simple(dentry, bcpup, -1, AuCpup_DTIME);
++              err = au_sio_cpup_simple(&cpg);
 +              au_unpin(&pin);
 +      }
 +
@@ -11978,6 +12483,10 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +      struct file *h_file;
 +      struct inode *h_inode;
 +
++      err = au_fi_sp_add(file);
++      if (unlikely(err))
++              goto out;
++
 +      dentry = file->f_dentry;
 +      AuDbg("%.*s\n", AuDLNPair(dentry));
 +
@@ -11990,7 +12499,7 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +      /* prepare h_file */
 +      err = au_do_open_nondir(file, vfsub_file_flags(file));
 +      if (unlikely(err))
-+              goto out;
++              goto out_del;
 +
 +      sb = dentry->d_sb;
 +      h_file = au_hf_top(file);
@@ -12003,9 +12512,13 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +      si_noflush_read_lock(sb);
 +      fi_write_lock(file);
 +      di_read_lock_child(dentry, AuLock_IR);
-+      if (!err)
++      if (!err) {
 +              au_init_fop_sp(file);
++              goto out; /* success */
++      }
 +
++out_del:
++      au_fi_sp_del(file);
 +out:
 +      return err;
 +}
@@ -12060,8 +12573,8 @@ diff -urN /usr/share/empty/fs/aufs/f_op_sp.c linux/fs/aufs/f_op_sp.c
 +}
 diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 --- /usr/share/empty/fs/aufs/fstype.h  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/fstype.h     2013-02-19 08:40:03.946892891 +0100
-@@ -0,0 +1,481 @@
++++ linux/fs/aufs/fstype.h     2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,470 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -12174,15 +12687,6 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +#endif
 +}
 +
-+static inline int au_test_smbfs(struct super_block *sb __maybe_unused)
-+{
-+#if defined(CONFIG_SMB_FS) || defined(CONFIG_SMB_FS_MODULE)
-+      return sb->s_magic == SMB_SUPER_MAGIC;
-+#else
-+      return 0;
-+#endif
-+}
-+
 +static inline int au_test_ocfs2(struct super_block *sb __maybe_unused)
 +{
 +#if defined(CONFIG_OCFS2_FS) || defined(CONFIG_OCFS2_FS_MODULE)
@@ -12221,7 +12725,7 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +
 +static inline int au_test_ext4(struct super_block *sb __maybe_unused)
 +{
-+#if defined(CONFIG_EXT4DEV_FS) || defined(CONFIG_EXT4DEV_FS_MODULE)
++#if defined(CONFIG_EXT4_FS) || defined(CONFIG_EXT4_FS_MODULE)
 +      return sb->s_magic == EXT4_SUPER_MAGIC;
 +#else
 +      return 0;
@@ -12429,7 +12933,6 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +{
 +      return au_test_nfs(sb)
 +              || au_test_fuse(sb)
-+              /* || au_test_smbfs(sb) */      /* untested */
 +              /* || au_test_ocfs2(sb) */      /* untested */
 +              /* || au_test_btrfs(sb) */      /* untested */
 +              /* || au_test_coda(sb) */       /* untested */
@@ -12475,7 +12978,6 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +              || au_test_ramfs(sb)
 +#endif
 +              || au_test_ubifs(sb)
-+              || au_test_btrfs(sb)
 +              || au_test_hfsplus(sb);
 +}
 +
@@ -12545,7 +13047,7 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h
 +#endif /* __AUFS_FSTYPE_H__ */
 diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 --- /usr/share/empty/fs/aufs/hfsnotify.c       1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsnotify.c  2013-07-01 12:54:21.039493094 +0200
++++ linux/fs/aufs/hfsnotify.c  2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,296 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -12845,8 +13347,8 @@ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c
 +};
 diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 --- /usr/share/empty/fs/aufs/hfsplus.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hfsplus.c    2013-02-19 08:40:03.946892891 +0100
-@@ -0,0 +1,57 @@
++++ linux/fs/aufs/hfsplus.c    2013-07-06 13:20:47.750198454 +0200
+@@ -0,0 +1,56 @@
 +/*
 + * Copyright (C) 2010-2013 Junjiro R. Okajima
 + *
@@ -12885,7 +13387,6 @@ diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 +      h_dentry = au_h_dptr(dentry, bindex);
 +      AuDebugOn(!h_dentry);
 +      AuDebugOn(!h_dentry->d_inode);
-+      IMustLock(h_dentry->d_inode);
 +
 +      h_file = NULL;
 +      if (au_test_hfsplus(h_dentry->d_sb)
@@ -12906,7 +13407,7 @@ diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c
 +}
 diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
 --- /usr/share/empty/fs/aufs/hnotify.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hnotify.c    2013-07-01 12:54:18.776081600 +0200
++++ linux/fs/aufs/hnotify.c    2013-07-30 22:42:55.842946719 +0200
 @@ -0,0 +1,712 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -13622,7 +14123,7 @@ diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
 +}
 diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c
 --- /usr/share/empty/fs/aufs/iinfo.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/iinfo.c      2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/iinfo.c      2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,276 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -13902,7 +14403,7 @@ diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 --- /usr/share/empty/fs/aufs/inode.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.c      2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/inode.c      2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,492 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -14398,8 +14899,8 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
 +}
 diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 --- /usr/share/empty/fs/aufs/inode.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.h      2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,588 @@
++++ linux/fs/aufs/inode.h      2013-07-06 13:20:47.750198454 +0200
+@@ -0,0 +1,600 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -14503,8 +15004,19 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 +      struct dentry *parent;
 +      struct au_hinode *hdir;
 +      struct vfsmount *h_mnt;
++
++      /* temporary unlock/relock for copyup */
++      struct dentry *h_dentry, *h_parent;
++      struct au_branch *br;
++      struct task_struct *task;
 +};
 +
++void au_pin_hdir_unlock(struct au_pin *p);
++int au_pin_hdir_relock(struct au_pin *p);
++void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task);
++void au_pin_hdir_acquire_nest(struct au_pin *p);
++void au_pin_hdir_release(struct au_pin *p);
++
 +/* ---------------------------------------------------------------------- */
 +
 +static inline struct au_iinfo *au_ii(struct inode *inode)
@@ -14546,7 +15058,8 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 +
 +/* au_wr_dir flags */
 +#define AuWrDir_ADD_ENTRY     1
-+#define AuWrDir_ISDIR         (1 << 1)
++#define AuWrDir_TMP_WHENTRY   (1 << 1)
++#define AuWrDir_ISDIR         (1 << 2)
 +#define au_ftest_wrdir(flags, name)   ((flags) & AuWrDir_##name)
 +#define au_fset_wrdir(flags, name) \
 +      do { (flags) |= AuWrDir_##name; } while (0)
@@ -14990,8 +15503,8 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
 +#endif /* __AUFS_INODE_H__ */
 diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 --- /usr/share/empty/fs/aufs/ioctl.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/ioctl.c      2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,196 @@
++++ linux/fs/aufs/ioctl.c      2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,202 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -15014,8 +15527,11 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 + * ioctl
 + * plink-management and readdir in userspace.
 + * assist the pathconf(3) wrapper library.
++ * move-down
 + */
 +
++#include <linux/compat.h>
++#include <linux/file.h>
 +#include "aufs.h"
 +
 +static int au_wbr_fd(struct path *path, struct aufs_wbr_fd __user *arg)
@@ -15142,6 +15658,11 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 +      long err;
 +
 +      switch (cmd) {
++      case AUFS_CTL_MVDOWN:
++              WARN_ONCE(1, "move-down is still testing...\n");
++              err = au_mvdown(file->f_dentry, (void __user *)arg);
++              break;
++
 +      case AUFS_CTL_WBR_FD:
 +              err = au_wbr_fd(&file->f_path, (void __user *)arg);
 +              break;
@@ -15180,18 +15701,16 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 +      return err;
 +}
 +
-+#if 0 /* unused yet */
 +long aufs_compat_ioctl_nondir(struct file *file, unsigned int cmd,
 +                            unsigned long arg)
 +{
 +      return aufs_ioctl_nondir(file, cmd, (unsigned long)compat_ptr(arg));
 +}
 +#endif
-+#endif
 diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 --- /usr/share/empty/fs/aufs/i_op_add.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_add.c   2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,713 @@
++++ linux/fs/aufs/i_op_add.c   2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,739 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -15384,7 +15903,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +      if (dt) {
 +              struct path tmp = {
 +                      .dentry = h_parent,
-+                      .mnt    = br->br_mnt
++                      .mnt    = au_br_mnt(br)
 +              };
 +              au_dtime_store(dt, au_pinned_parent(pin), &tmp);
 +      }
@@ -15428,47 +15947,55 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +      int err;
 +      aufs_bindex_t bstart;
 +      unsigned char created;
-+      struct au_dtime dt;
-+      struct au_pin pin;
-+      struct path h_path;
 +      struct dentry *wh_dentry, *parent;
 +      struct inode *h_dir;
-+      struct au_wr_dir_args wr_dir_args = {
-+              .force_btgt     = -1,
-+              .flags          = AuWrDir_ADD_ENTRY
-+      };
++      /* to reuduce stack size */
++      struct {
++              struct au_dtime dt;
++              struct au_pin pin;
++              struct path h_path;
++              struct au_wr_dir_args wr_dir_args;
++      } *a;
 +
 +      AuDbg("%.*s\n", AuDLNPair(dentry));
 +      IMustLock(dir);
 +
++      err = -ENOMEM;
++      a = kmalloc(sizeof(*a), GFP_NOFS);
++      if (unlikely(!a))
++              goto out;
++      a->wr_dir_args.force_btgt = -1;
++      a->wr_dir_args.flags = AuWrDir_ADD_ENTRY;
++
 +      parent = dentry->d_parent; /* dir inode is locked */
 +      err = aufs_read_lock(dentry, AuLock_DW | AuLock_GEN);
 +      if (unlikely(err))
-+              goto out;
++              goto out_free;
 +      err = au_d_may_add(dentry);
 +      if (unlikely(err))
 +              goto out_unlock;
 +      di_write_lock_parent(parent);
-+      wh_dentry = lock_hdir_lkup_wh(dentry, &dt, /*src_dentry*/NULL, &pin,
-+                                    &wr_dir_args);
++      wh_dentry = lock_hdir_lkup_wh(dentry, &a->dt, /*src_dentry*/NULL,
++                                    &a->pin, &a->wr_dir_args);
 +      err = PTR_ERR(wh_dentry);
 +      if (IS_ERR(wh_dentry))
 +              goto out_parent;
 +
 +      bstart = au_dbstart(dentry);
-+      h_path.dentry = au_h_dptr(dentry, bstart);
-+      h_path.mnt = au_sbr_mnt(dentry->d_sb, bstart);
-+      h_dir = au_pinned_h_dir(&pin);
++      a->h_path.dentry = au_h_dptr(dentry, bstart);
++      a->h_path.mnt = au_sbr_mnt(dentry->d_sb, bstart);
++      h_dir = au_pinned_h_dir(&a->pin);
 +      switch (arg->type) {
 +      case Creat:
-+              err = vfsub_create(h_dir, &h_path, arg->u.c.mode,
++              err = vfsub_create(h_dir, &a->h_path, arg->u.c.mode,
 +                                 arg->u.c.want_excl);
 +              break;
 +      case Symlink:
-+              err = vfsub_symlink(h_dir, &h_path, arg->u.s.symname);
++              err = vfsub_symlink(h_dir, &a->h_path, arg->u.s.symname);
 +              break;
 +      case Mknod:
-+              err = vfsub_mknod(h_dir, &h_path, arg->u.m.mode, arg->u.m.dev);
++              err = vfsub_mknod(h_dir, &a->h_path, arg->u.m.mode,
++                                arg->u.m.dev);
 +              break;
 +      default:
 +              BUG();
@@ -15478,18 +16005,18 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +              err = epilog(dir, bstart, wh_dentry, dentry);
 +
 +      /* revert */
-+      if (unlikely(created && err && h_path.dentry->d_inode)) {
++      if (unlikely(created && err && a->h_path.dentry->d_inode)) {
 +              int rerr;
-+              rerr = vfsub_unlink(h_dir, &h_path, /*force*/0);
++              rerr = vfsub_unlink(h_dir, &a->h_path, /*force*/0);
 +              if (rerr) {
 +                      AuIOErr("%.*s revert failure(%d, %d)\n",
 +                              AuDLNPair(dentry), err, rerr);
 +                      err = -EIO;
 +              }
-+              au_dtime_revert(&dt);
++              au_dtime_revert(&a->dt);
 +      }
 +
-+      au_unpin(&pin);
++      au_unpin(&a->pin);
 +      dput(wh_dentry);
 +
 +out_parent:
@@ -15500,6 +16027,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +              d_drop(dentry);
 +      }
 +      aufs_read_unlock(dentry, AuLock_DW);
++out_free:
++      kfree(a);
 +out:
 +      return err;
 +}
@@ -15553,8 +16082,14 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +{
 +      int err;
 +      struct dentry *h_src_dentry;
-+      struct mutex *h_mtx;
-+      struct file *h_file;
++      struct au_cp_generic cpg = {
++              .dentry = src_dentry,
++              .bdst   = a->bdst,
++              .bsrc   = a->bsrc,
++              .len    = -1,
++              .pin    = &a->pin,
++              .flags  = AuCpup_DTIME | AuCpup_HOPEN /* | AuCpup_KEEPLINO */
++      };
 +
 +      di_read_lock_parent(a->src_parent, AuLock_IR);
 +      err = au_test_and_cpup_dirs(src_dentry, a->bdst);
@@ -15562,22 +16097,13 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +              goto out;
 +
 +      h_src_dentry = au_h_dptr(src_dentry, a->bsrc);
-+      h_mtx = &h_src_dentry->d_inode->i_mutex;
 +      err = au_pin(&a->pin, src_dentry, a->bdst,
 +                   au_opt_udba(src_dentry->d_sb),
 +                   AuPin_DI_LOCKED | AuPin_MNT_WRITE);
 +      if (unlikely(err))
 +              goto out;
-+      mutex_lock_nested(h_mtx, AuLsc_I_CHILD);
-+      h_file = au_h_open_pre(src_dentry, a->bsrc);
-+      if (IS_ERR(h_file)) {
-+              err = PTR_ERR(h_file);
-+              h_file = NULL;
-+      } else
-+              err = au_sio_cpup_simple(src_dentry, a->bdst, -1,
-+                                       AuCpup_DTIME /* | AuCpup_KEEPLINO */);
-+      mutex_unlock(h_mtx);
-+      au_h_open_post(src_dentry, a->bsrc, h_file);
++
++      err = au_sio_cpup_simple(&cpg);
 +      au_unpin(&a->pin);
 +
 +out:
@@ -15585,12 +16111,14 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +      return err;
 +}
 +
-+static int au_cpup_or_link(struct dentry *src_dentry, struct au_link_args *a)
++static int au_cpup_or_link(struct dentry *src_dentry, struct dentry *dentry,
++                         struct au_link_args *a)
 +{
 +      int err;
 +      unsigned char plink;
-+      struct inode *h_inode, *inode;
++      aufs_bindex_t bend;
 +      struct dentry *h_src_dentry;
++      struct inode *h_inode, *inode;
 +      struct super_block *sb;
 +      struct file *h_file;
 +
@@ -15602,22 +16130,38 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +              h_inode = au_h_iptr(inode, a->bdst);
 +      if (!h_inode || !h_inode->i_nlink) {
 +              /* copyup src_dentry as the name of dentry. */
-+              au_set_dbstart(src_dentry, a->bdst);
-+              au_set_h_dptr(src_dentry, a->bdst, dget(a->h_path.dentry));
-+              h_inode = au_h_dptr(src_dentry, a->bsrc)->d_inode;
-+              mutex_lock_nested(&h_inode->i_mutex, AuLsc_I_CHILD);
-+              h_file = au_h_open_pre(src_dentry, a->bsrc);
-+              if (IS_ERR(h_file)) {
++              bend = au_dbend(dentry);
++              if (bend < a->bsrc)
++                      au_set_dbend(dentry, a->bsrc);
++              au_set_h_dptr(dentry, a->bsrc,
++                            dget(au_h_dptr(src_dentry, a->bsrc)));
++              dget(a->h_path.dentry);
++              au_set_h_dptr(dentry, a->bdst, NULL);
++              dentry->d_inode = src_dentry->d_inode; /* tmp */
++              h_file = au_h_open_pre(dentry, a->bsrc);
++              if (IS_ERR(h_file))
 +                      err = PTR_ERR(h_file);
-+                      h_file = NULL;
-+              } else
-+                      err = au_sio_cpup_single(src_dentry, a->bdst, a->bsrc,
-+                                               -1, AuCpup_KEEPLINO,
-+                                               a->parent);
-+              mutex_unlock(&h_inode->i_mutex);
-+              au_h_open_post(src_dentry, a->bsrc, h_file);
-+              au_set_h_dptr(src_dentry, a->bdst, NULL);
-+              au_set_dbstart(src_dentry, a->bsrc);
++              else {
++                      struct au_cp_generic cpg = {
++                              .dentry = dentry,
++                              .bdst   = a->bdst,
++                              .bsrc   = -1,
++                              .len    = -1,
++                              .pin    = &a->pin,
++                              .flags  = AuCpup_KEEPLINO
++                      };
++                      err = au_sio_cpup_simple(&cpg);
++                      au_h_open_post(dentry, a->bsrc, h_file);
++                      if (!err) {
++                              dput(a->h_path.dentry);
++                              a->h_path.dentry = au_h_dptr(dentry, a->bdst);
++                      } else
++                              au_set_h_dptr(dentry, a->bdst,
++                                            a->h_path.dentry);
++              }
++              dentry->d_inode = NULL; /* restore */
++              au_set_h_dptr(dentry, a->bsrc, NULL);
++              au_set_dbend(dentry, bend);
 +      } else {
 +              /* the inode of src_dentry already exists on a.bdst branch */
 +              h_src_dentry = d_find_alias(h_inode);
@@ -15716,7 +16260,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +      if (au_opt_test(au_mntflags(sb), PLINK)) {
 +              if (a->bdst < a->bsrc
 +                  /* && h_src_dentry->d_sb != a->h_path.dentry->d_sb */)
-+                      err = au_cpup_or_link(src_dentry, a);
++                      err = au_cpup_or_link(src_dentry, dentry, a);
 +              else
 +                      err = vfsub_link(h_src_dentry, au_pinned_h_dir(&a->pin),
 +                                       &a->h_path);
@@ -15795,6 +16339,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +out_kfree:
 +      kfree(a);
 +out:
++      AuTraceErr(err);
 +      return err;
 +}
 +
@@ -15907,8 +16452,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 --- /usr/share/empty/fs/aufs/i_op.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op.c       2013-07-01 12:54:18.776081600 +0200
-@@ -0,0 +1,1030 @@
++++ linux/fs/aufs/i_op.c       2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,1115 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -16025,7 +16570,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              err = 0;
 +              bindex = au_ibstart(inode);
 +              br = au_sbr(sb, bindex);
-+              err = h_permission(h_inode, mask, br->br_mnt, br->br_perm);
++              err = h_permission(h_inode, mask, au_br_mnt(br), br->br_perm);
 +              if (write_mask
 +                  && !err
 +                  && !special_file(h_inode->i_mode)) {
@@ -16051,7 +16596,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +                              break;
 +
 +                      br = au_sbr(sb, bindex);
-+                      err = h_permission(h_inode, mask, br->br_mnt,
++                      err = h_permission(h_inode, mask, au_br_mnt(br),
 +                                         br->br_perm);
 +              }
 +      }
@@ -16171,16 +16716,19 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +
 +      err = 0;
 +      if (!au_h_dptr(parent, bcpup)) {
-+              if (bstart < bcpup)
++              if (bstart > bcpup)
++                      err = au_cpup_dirs(dentry, bcpup);
++              else if (bstart < bcpup)
 +                      err = au_cpdown_dirs(dentry, bcpup);
 +              else
-+                      err = au_cpup_dirs(dentry, bcpup);
++                      BUG();
 +      }
 +      if (!err && add_entry) {
 +              h_parent = au_h_dptr(parent, bcpup);
 +              h_dir = h_parent->d_inode;
 +              mutex_lock_nested(&h_dir->i_mutex, AuLsc_I_PARENT);
-+              err = au_lkup_neg(dentry, bcpup);
++              err = au_lkup_neg(dentry, bcpup,
++                                au_ftest_wrdir(add_entry, TMP_WHENTRY));
 +              /* todo: no unlock here */
 +              mutex_unlock(&h_dir->i_mutex);
 +
@@ -16211,8 +16759,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +{
 +      int err;
 +      aufs_bindex_t bcpup, bstart, src_bstart;
-+      const unsigned char add_entry = !!au_ftest_wrdir(args->flags,
-+                                                       ADD_ENTRY);
++      const unsigned char add_entry
++              = au_ftest_wrdir(args->flags, ADD_ENTRY)
++              | au_ftest_wrdir(args->flags, TMP_WHENTRY);
 +      struct super_block *sb;
 +      struct dentry *parent;
 +      struct au_sbinfo *sbinfo;
@@ -16276,6 +16825,85 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +
 +/* ---------------------------------------------------------------------- */
 +
++void au_pin_hdir_unlock(struct au_pin *p)
++{
++      if (p->hdir)
++              au_hn_imtx_unlock(p->hdir);
++}
++
++static int au_pin_hdir_lock(struct au_pin *p)
++{
++      int err;
++
++      err = 0;
++      if (!p->hdir)
++              goto out;
++
++      /* even if an error happens later, keep this lock */
++      au_hn_imtx_lock_nested(p->hdir, p->lsc_hi);
++
++      err = -EBUSY;
++      if (unlikely(p->hdir->hi_inode != p->h_parent->d_inode))
++              goto out;
++
++      err = 0;
++      if (p->h_dentry)
++              err = au_h_verify(p->h_dentry, p->udba, p->hdir->hi_inode,
++                                p->h_parent, p->br);
++
++out:
++      return err;
++}
++
++int au_pin_hdir_relock(struct au_pin *p)
++{
++      int err, i;
++      struct inode *h_i;
++      struct dentry *h_d[] = {
++              p->h_dentry,
++              p->h_parent
++      };
++
++      err = au_pin_hdir_lock(p);
++      if (unlikely(err))
++              goto out;
++
++      for (i = 0; !err && i < sizeof(h_d)/sizeof(*h_d); i++) {
++              if (!h_d[i])
++                      continue;
++              h_i = h_d[i]->d_inode;
++              if (h_i)
++                      err = !h_i->i_nlink;
++      }
++
++out:
++      return err;
++}
++
++void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task)
++{
++#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
++      p->hdir->hi_inode->i_mutex.owner = task;
++#endif
++}
++
++void au_pin_hdir_acquire_nest(struct au_pin *p)
++{
++      if (p->hdir) {
++              mutex_acquire_nest(&p->hdir->hi_inode->i_mutex.dep_map,
++                                 p->lsc_hi, 0, NULL, _RET_IP_);
++              au_pin_hdir_set_owner(p, current);
++      }
++}
++
++void au_pin_hdir_release(struct au_pin *p)
++{
++      if (p->hdir) {
++              au_pin_hdir_set_owner(p, p->task);
++              mutex_release(&p->hdir->hi_inode->i_mutex.dep_map, 1, _RET_IP_);
++      }
++}
++
 +struct dentry *au_pinned_h_parent(struct au_pin *pin)
 +{
 +      if (pin && pin->parent)
@@ -16285,12 +16913,13 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +
 +void au_unpin(struct au_pin *p)
 +{
++      if (p->hdir)
++              au_pin_hdir_unlock(p);
 +      if (p->h_mnt && au_ftest_pin(p->flags, MNT_WRITE))
 +              vfsub_mnt_drop_write(p->h_mnt);
 +      if (!p->hdir)
 +              return;
 +
-+      au_hn_imtx_unlock(p->hdir);
 +      if (!au_ftest_pin(p->flags, DI_LOCKED))
 +              di_read_unlock(p->parent, AuLock_IR);
 +      iput(p->hdir->hi_inode);
@@ -16298,22 +16927,21 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +      p->parent = NULL;
 +      p->hdir = NULL;
 +      p->h_mnt = NULL;
++      /* do not clear p->task */
 +}
 +
 +int au_do_pin(struct au_pin *p)
 +{
 +      int err;
 +      struct super_block *sb;
-+      struct dentry *h_dentry, *h_parent;
-+      struct au_branch *br;
 +      struct inode *h_dir;
 +
 +      err = 0;
 +      sb = p->dentry->d_sb;
-+      br = au_sbr(sb, p->bindex);
++      p->br = au_sbr(sb, p->bindex);
 +      if (IS_ROOT(p->dentry)) {
 +              if (au_ftest_pin(p->flags, MNT_WRITE)) {
-+                      p->h_mnt = br->br_mnt;
++                      p->h_mnt = au_br_mnt(p->br);
 +                      err = vfsub_mnt_want_write(p->h_mnt);
 +                      if (unlikely(err)) {
 +                              au_fclr_pin(p->flags, MNT_WRITE);
@@ -16323,16 +16951,16 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              goto out;
 +      }
 +
-+      h_dentry = NULL;
++      p->h_dentry = NULL;
 +      if (p->bindex <= au_dbend(p->dentry))
-+              h_dentry = au_h_dptr(p->dentry, p->bindex);
++              p->h_dentry = au_h_dptr(p->dentry, p->bindex);
 +
 +      p->parent = dget_parent(p->dentry);
 +      if (!au_ftest_pin(p->flags, DI_LOCKED))
 +              di_read_lock(p->parent, AuLock_IR, p->lsc_di);
 +
 +      h_dir = NULL;
-+      h_parent = au_h_dptr(p->parent, p->bindex);
++      p->h_parent = au_h_dptr(p->parent, p->bindex);
 +      p->hdir = au_hi(p->parent->d_inode, p->bindex);
 +      if (p->hdir)
 +              h_dir = p->hdir->hi_inode;
@@ -16342,7 +16970,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +       * if DI_LOCKED is not set, then p->parent may be different
 +       * and h_parent can be NULL.
 +       */
-+      if (unlikely(!p->hdir || !h_dir || !h_parent)) {
++      if (unlikely(!p->hdir || !h_dir || !p->h_parent)) {
 +              err = -EBUSY;
 +              if (!au_ftest_pin(p->flags, DI_LOCKED))
 +                      di_read_unlock(p->parent, AuLock_IR);
@@ -16351,33 +16979,24 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              goto out_err;
 +      }
 +
-+      au_igrab(h_dir);
-+      au_hn_imtx_lock_nested(p->hdir, p->lsc_hi);
-+
-+      if (unlikely(p->hdir->hi_inode != h_parent->d_inode)) {
-+              err = -EBUSY;
-+              goto out_unpin;
-+      }
-+      if (h_dentry) {
-+              err = au_h_verify(h_dentry, p->udba, h_dir, h_parent, br);
-+              if (unlikely(err)) {
-+                      au_fclr_pin(p->flags, MNT_WRITE);
-+                      goto out_unpin;
-+              }
-+      }
-+
 +      if (au_ftest_pin(p->flags, MNT_WRITE)) {
-+              p->h_mnt = br->br_mnt;
++              p->h_mnt = au_br_mnt(p->br);
 +              err = vfsub_mnt_want_write(p->h_mnt);
 +              if (unlikely(err)) {
 +                      au_fclr_pin(p->flags, MNT_WRITE);
-+                      goto out_unpin;
++                      if (!au_ftest_pin(p->flags, DI_LOCKED))
++                              di_read_unlock(p->parent, AuLock_IR);
++                      dput(p->parent);
++                      p->parent = NULL;
++                      goto out_err;
 +              }
 +      }
-+      goto out; /* success */
 +
-+out_unpin:
-+      au_unpin(p);
++      au_igrab(h_dir);
++      err = au_pin_hdir_lock(p);
++      if (!err)
++              goto out; /* success */
++
 +out_err:
 +      pr_err("err %d\n", err);
 +      err = au_busy_or_stale();
@@ -16399,6 +17018,11 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +      p->parent = NULL;
 +      p->hdir = NULL;
 +      p->h_mnt = NULL;
++
++      p->h_dentry = NULL;
++      p->h_parent = NULL;
++      p->br = NULL;
++      p->task = current;
 +}
 +
 +int au_pin(struct au_pin *pin, struct dentry *dentry, aufs_bindex_t bindex,
@@ -16464,7 +17088,6 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +      aufs_bindex_t bstart, ibstart;
 +      struct dentry *hi_wh, *parent;
 +      struct inode *inode;
-+      struct file *h_file;
 +      struct au_wr_dir_args wr_dir_args = {
 +              .force_btgt     = -1,
 +              .flags          = 0
@@ -16504,13 +17127,20 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +      sz = -1;
 +      if ((ia->ia_valid & ATTR_SIZE) && ia->ia_size < i_size_read(a->h_inode))
 +              sz = ia->ia_size;
++      mutex_unlock(&a->h_inode->i_mutex);
 +
-+      h_file = NULL;
 +      hi_wh = NULL;
 +      if (au_ftest_icpup(a->flags, DID_CPUP) && d_unlinked(dentry)) {
 +              hi_wh = au_hi_wh(inode, a->btgt);
 +              if (!hi_wh) {
-+                      err = au_sio_cpup_wh(dentry, a->btgt, sz, /*file*/NULL);
++                      struct au_cp_generic cpg = {
++                              .dentry = dentry,
++                              .bdst   = a->btgt,
++                              .bsrc   = -1,
++                              .len    = sz,
++                              .pin    = &a->pin
++                      };
++                      err = au_sio_cpup_wh(&cpg, /*file*/NULL);
 +                      if (unlikely(err))
 +                              goto out_unlock;
 +                      hi_wh = au_hi_wh(inode, a->btgt);
@@ -16528,13 +17158,15 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              goto out; /* success */
 +
 +      if (!d_unhashed(dentry)) {
-+              h_file = au_h_open_pre(dentry, bstart);
-+              if (IS_ERR(h_file)) {
-+                      err = PTR_ERR(h_file);
-+                      h_file = NULL;
-+              } else
-+                      err = au_sio_cpup_simple(dentry, a->btgt, sz,
-+                                               AuCpup_DTIME);
++              struct au_cp_generic cpg = {
++                      .dentry = dentry,
++                      .bdst   = a->btgt,
++                      .bsrc   = bstart,
++                      .len    = sz,
++                      .pin    = &a->pin,
++                      .flags  = AuCpup_DTIME | AuCpup_HOPEN
++              };
++              err = au_sio_cpup_simple(&cpg);
 +              if (!err)
 +                      a->h_path.dentry = au_h_dptr(dentry, a->btgt);
 +      } else if (!hi_wh)
@@ -16543,14 +17175,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              a->h_path.dentry = hi_wh; /* do not dget here */
 +
 +out_unlock:
-+      mutex_unlock(&a->h_inode->i_mutex);
-+      au_h_open_post(dentry, bstart, h_file);
 +      a->h_inode = a->h_path.dentry->d_inode;
-+      if (!err) {
-+              mutex_lock_nested(&a->h_inode->i_mutex, AuLsc_I_CHILD);
++      if (!err)
 +              goto out; /* success */
-+      }
-+
 +      au_unpin(&a->pin);
 +out_parent:
 +      if (parent) {
@@ -16558,6 +17185,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              dput(parent);
 +      }
 +out:
++      if (!err)
++              mutex_lock_nested(&a->h_inode->i_mutex, AuLsc_I_CHILD);
 +      return err;
 +}
 +
@@ -16626,8 +17255,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +                      goto out_unlock;
 +      } else if ((ia->ia_valid & (ATTR_UID | ATTR_GID))
 +                 && (ia->ia_valid & ATTR_CTIME)) {
-+              err = security_path_chown(&a->h_path, vfsub_ia_uid(ia),
-+                                        vfsub_ia_gid(ia));
++              err = security_path_chown(&a->h_path, ia->ia_uid, ia->ia_gid);
 +              if (unlikely(err))
 +                      goto out_unlock;
 +      }
@@ -16677,8 +17305,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +      unsigned int n;
 +
 +      inode->i_mode = st->mode;
-+      i_uid_write(inode, st->uid);
-+      i_gid_write(inode, st->gid);
++      /* don't i_[ug]id_write() here */
++      inode->i_uid = st->uid;
++      inode->i_gid = st->gid;
 +      inode->i_atime = st->atime;
 +      inode->i_mtime = st->mtime;
 +      inode->i_ctime = st->ctime;
@@ -16688,6 +17317,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +              n = inode->i_nlink;
 +              n -= nlink;
 +              n += st->nlink;
++              smp_mb();
 +              /* 0 can happen */
 +              set_nlink(inode, n);
 +      }
@@ -16941,8 +17571,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +};
 diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 --- /usr/share/empty/fs/aufs/i_op_del.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_del.c   2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,477 @@
++++ linux/fs/aufs/i_op_del.c   2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,502 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -17244,17 +17874,25 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +{
 +      int err;
 +      aufs_bindex_t bwh, bindex, bstart;
-+      struct au_dtime dt;
-+      struct au_pin pin;
-+      struct path h_path;
 +      struct inode *inode, *h_dir;
 +      struct dentry *parent, *wh_dentry;
++      /* to reuduce stack size */
++      struct {
++              struct au_dtime dt;
++              struct au_pin pin;
++              struct path h_path;
++      } *a;
 +
 +      IMustLock(dir);
 +
++      err = -ENOMEM;
++      a = kmalloc(sizeof(*a), GFP_NOFS);
++      if (unlikely(!a))
++              goto out;
++
 +      err = aufs_read_lock(dentry, AuLock_DW | AuLock_GEN);
 +      if (unlikely(err))
-+              goto out;
++              goto out_free;
 +      err = au_d_hashed_positive(dentry);
 +      if (unlikely(err))
 +              goto out_unlock;
@@ -17269,17 +17907,18 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +      bindex = -1;
 +      parent = dentry->d_parent; /* dir inode is locked */
 +      di_write_lock_parent(parent);
-+      wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/0, &bindex, &dt, &pin);
++      wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/0, &bindex, &a->dt,
++                                      &a->pin);
 +      err = PTR_ERR(wh_dentry);
 +      if (IS_ERR(wh_dentry))
 +              goto out_parent;
 +
-+      h_path.mnt = au_sbr_mnt(dentry->d_sb, bstart);
-+      h_path.dentry = au_h_dptr(dentry, bstart);
-+      dget(h_path.dentry);
++      a->h_path.mnt = au_sbr_mnt(dentry->d_sb, bstart);
++      a->h_path.dentry = au_h_dptr(dentry, bstart);
++      dget(a->h_path.dentry);
 +      if (bindex == bstart) {
-+              h_dir = au_pinned_h_dir(&pin);
-+              err = vfsub_unlink(h_dir, &h_path, /*force*/0);
++              h_dir = au_pinned_h_dir(&a->pin);
++              err = vfsub_unlink(h_dir, &a->h_path, /*force*/0);
 +      } else {
 +              /* dir inode is locked */
 +              h_dir = wh_dentry->d_parent->d_inode;
@@ -17293,8 +17932,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +
 +              /* update target timestamps */
 +              if (bindex == bstart) {
-+                      vfsub_update_h_iattr(&h_path, /*did*/NULL); /*ignore*/
-+                      inode->i_ctime = h_path.dentry->d_inode->i_ctime;
++                      vfsub_update_h_iattr(&a->h_path, /*did*/NULL);
++                      /*ignore*/
++                      inode->i_ctime = a->h_path.dentry->d_inode->i_ctime;
 +              } else
 +                      /* todo: this timestamp may be reverted later */
 +                      inode->i_ctime = h_dir->i_ctime;
@@ -17305,19 +17945,22 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +      if (wh_dentry) {
 +              int rerr;
 +
-+              rerr = do_revert(err, dir, bindex, bwh, wh_dentry, dentry, &dt);
++              rerr = do_revert(err, dir, bindex, bwh, wh_dentry, dentry,
++                               &a->dt);
 +              if (rerr)
 +                      err = rerr;
 +      }
 +
 +out_unpin:
-+      au_unpin(&pin);
++      au_unpin(&a->pin);
 +      dput(wh_dentry);
-+      dput(h_path.dentry);
++      dput(a->h_path.dentry);
 +out_parent:
 +      di_write_unlock(parent);
 +out_unlock:
 +      aufs_read_unlock(dentry, AuLock_DW);
++out_free:
++      kfree(a);
 +out:
 +      return err;
 +}
@@ -17326,17 +17969,25 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +{
 +      int err, rmdir_later;
 +      aufs_bindex_t bwh, bindex, bstart;
-+      struct au_dtime dt;
-+      struct au_pin pin;
 +      struct inode *inode;
 +      struct dentry *parent, *wh_dentry, *h_dentry;
 +      struct au_whtmp_rmdir *args;
++      /* to reuduce stack size */
++      struct {
++              struct au_dtime dt;
++              struct au_pin pin;
++      } *a;
 +
 +      IMustLock(dir);
 +
++      err = -ENOMEM;
++      a = kmalloc(sizeof(*a), GFP_NOFS);
++      if (unlikely(!a))
++              goto out;
++
 +      err = aufs_read_lock(dentry, AuLock_DW | AuLock_FLUSH | AuLock_GEN);
 +      if (unlikely(err))
-+              goto out;
++              goto out_free;
 +      err = au_alive_dir(dentry);
 +      if (unlikely(err))
 +              goto out_unlock;
@@ -17360,7 +18011,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +      bstart = au_dbstart(dentry);
 +      bwh = au_dbwh(dentry);
 +      bindex = -1;
-+      wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/1, &bindex, &dt, &pin);
++      wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/1, &bindex, &a->dt,
++                                      &a->pin);
 +      err = PTR_ERR(wh_dentry);
 +      if (IS_ERR(wh_dentry))
 +              goto out_parent;
@@ -17401,13 +18053,14 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +      if (wh_dentry) {
 +              int rerr;
 +
-+              rerr = do_revert(err, dir, bindex, bwh, wh_dentry, dentry, &dt);
++              rerr = do_revert(err, dir, bindex, bwh, wh_dentry, dentry,
++                               &a->dt);
 +              if (rerr)
 +                      err = rerr;
 +      }
 +
 +out_unpin:
-+      au_unpin(&pin);
++      au_unpin(&a->pin);
 +      dput(wh_dentry);
 +      dput(h_dentry);
 +out_parent:
@@ -17416,14 +18069,16 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +              au_whtmp_rmdir_free(args);
 +out_unlock:
 +      aufs_read_unlock(dentry, AuLock_DW);
++out_free:
++      kfree(a);
 +out:
 +      AuTraceErr(err);
 +      return err;
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 --- /usr/share/empty/fs/aufs/i_op_ren.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_ren.c   2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,1026 @@
++++ linux/fs/aufs/i_op_ren.c   2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,1009 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -17634,32 +18289,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +              AuDebugOn(au_dbstart(d) != a->btgt);
 +              err = vfsub_rename(a->src_h_dir, au_h_dptr(d, a->btgt),
 +                                 a->dst_h_dir, &a->h_path);
-+      } else {
-+              struct mutex *h_mtx = &a->src_h_dentry->d_inode->i_mutex;
-+              struct file *h_file;
++      } else
++              BUG();
 +
-+              au_fset_ren(a->flags, CPUP);
-+              mutex_lock_nested(h_mtx, AuLsc_I_CHILD);
-+              au_set_dbstart(d, a->btgt);
-+              au_set_h_dptr(d, a->btgt, dget(a->dst_h_dentry));
-+              h_file = au_h_open_pre(d, a->src_bstart);
-+              if (IS_ERR(h_file)) {
-+                      err = PTR_ERR(h_file);
-+                      h_file = NULL;
-+              } else
-+                      err = au_sio_cpup_single(d, a->btgt, a->src_bstart, -1,
-+                                               !AuCpup_DTIME, a->dst_parent);
-+              mutex_unlock(h_mtx);
-+              au_h_open_post(d, a->src_bstart, h_file);
-+              if (!err) {
-+                      d = a->dst_dentry;
-+                      au_set_h_dptr(d, a->btgt, NULL);
-+                      au_update_dbstart(d);
-+              } else {
-+                      au_set_h_dptr(d, a->btgt, NULL);
-+                      au_set_dbstart(d, a->src_bstart);
-+              }
-+      }
 +      if (!err && a->h_dst)
 +              /* it will be set to dinfo later */
 +              dget(a->h_dst);
@@ -17760,31 +18392,13 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +
 +              d = a->dst_dentry;
 +              au_set_h_dptr(d, a->btgt, NULL);
-+              err = au_lkup_neg(d, a->btgt);
++              err = au_lkup_neg(d, a->btgt, /*wh*/0);
 +              if (unlikely(err))
 +                      goto out_whtmp;
 +              a->dst_h_dentry = au_h_dptr(d, a->btgt);
 +      }
 +
-+      /* cpup src */
-+      if (a->dst_h_dentry->d_inode && a->src_bstart != a->btgt) {
-+              struct mutex *h_mtx = &a->src_h_dentry->d_inode->i_mutex;
-+              struct file *h_file;
-+
-+              mutex_lock_nested(h_mtx, AuLsc_I_CHILD);
-+              AuDebugOn(au_dbstart(a->src_dentry) != a->src_bstart);
-+              h_file = au_h_open_pre(a->src_dentry, a->src_bstart);
-+              if (IS_ERR(h_file)) {
-+                      err = PTR_ERR(h_file);
-+                      h_file = NULL;
-+              } else
-+                      err = au_sio_cpup_simple(a->src_dentry, a->btgt, -1,
-+                                               !AuCpup_DTIME);
-+              mutex_unlock(h_mtx);
-+              au_h_open_post(a->src_dentry, a->src_bstart, h_file);
-+              if (unlikely(err))
-+                      goto out_whtmp;
-+      }
++      BUG_ON(a->dst_h_dentry->d_inode && a->src_bstart != a->btgt);
 +
 +      /* rename by vfs_rename or cpup */
 +      d = a->dst_dentry;
@@ -18036,13 +18650,10 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 + */
 +static void au_ren_unlock(struct au_ren_args *a)
 +{
-+      struct super_block *sb;
-+
-+      sb = a->dst_dentry->d_sb;
-+      if (au_ftest_ren(a->flags, MNT_WRITE))
-+              vfsub_mnt_drop_write(a->br->br_mnt);
 +      vfsub_unlock_rename(a->src_h_parent, a->src_hdir,
 +                          a->dst_h_parent, a->dst_hdir);
++      if (au_ftest_ren(a->flags, MNT_WRITE))
++              vfsub_mnt_drop_write(au_br_mnt(a->br));
 +}
 +
 +static int au_ren_lock(struct au_ren_args *a)
@@ -18055,6 +18666,11 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +      a->src_hdir = au_hi(a->src_dir, a->btgt);
 +      a->dst_h_parent = au_h_dptr(a->dst_parent, a->btgt);
 +      a->dst_hdir = au_hi(a->dst_dir, a->btgt);
++
++      err = vfsub_mnt_want_write(au_br_mnt(a->br));
++      if (unlikely(err))
++              goto out;
++      au_fset_ren(a->flags, MNT_WRITE);
 +      a->h_trap = vfsub_lock_rename(a->src_h_parent, a->src_hdir,
 +                                    a->dst_h_parent, a->dst_hdir);
 +      udba = au_opt_udba(a->src_dentry->d_sb);
@@ -18069,18 +18685,12 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +              err = au_h_verify(a->dst_h_dentry, udba,
 +                                a->dst_h_parent->d_inode, a->dst_h_parent,
 +                                a->br);
-+      if (!err) {
-+              err = vfsub_mnt_want_write(a->br->br_mnt);
-+              if (unlikely(err))
-+                      goto out_unlock;
-+              au_fset_ren(a->flags, MNT_WRITE);
++      if (!err)
 +              goto out; /* success */
-+      }
 +
 +      err = au_busy_or_stale();
-+
-+out_unlock:
 +      au_ren_unlock(a);
++
 +out:
 +      return err;
 +}
@@ -18350,7 +18960,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +      if (unlikely(err < 0))
 +              goto out_parent;
 +      a->br = au_sbr(a->dst_dentry->d_sb, a->btgt);
-+      a->h_path.mnt = a->br->br_mnt;
++      a->h_path.mnt = au_br_mnt(a->br);
 +
 +      /* are they available to be renamed */
 +      err = au_ren_may_dir(a);
@@ -18388,9 +18998,37 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +      if (err)
 +              au_fset_ren(a->flags, WHSRC);
 +
++      /* cpup src */
++      if (a->src_bstart != a->btgt) {
++              struct au_pin pin;
++
++              err = au_pin(&pin, a->src_dentry, a->btgt,
++                           au_opt_udba(a->src_dentry->d_sb),
++                           AuPin_DI_LOCKED | AuPin_MNT_WRITE);
++              if (!err) {
++                      struct au_cp_generic cpg = {
++                              .dentry = a->src_dentry,
++                              .bdst   = a->btgt,
++                              .bsrc   = a->src_bstart,
++                              .len    = -1,
++                              .pin    = &pin,
++                              .flags  = AuCpup_DTIME | AuCpup_HOPEN
++                      };
++                      AuDebugOn(au_dbstart(a->src_dentry) != a->src_bstart);
++                      err = au_sio_cpup_simple(&cpg);
++                      au_unpin(&pin);
++              }
++              if (unlikely(err))
++                      goto out_children;
++              a->src_bstart = a->btgt;
++              a->src_h_dentry = au_h_dptr(a->src_dentry, a->btgt);
++              au_fset_ren(a->flags, WHSRC);
++      }
++
 +      /* lock them all */
 +      err = au_ren_lock(a);
 +      if (unlikely(err))
++              /* leave the copied-up one */
 +              goto out_children;
 +
 +      if (!au_opt_test(au_mntflags(a->dst_dir->i_sb), UDBA_NONE))
@@ -18452,7 +19090,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 +}
 diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig
 --- /usr/share/empty/fs/aufs/Kconfig   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/Kconfig      2013-07-01 12:54:18.772748151 +0200
++++ linux/fs/aufs/Kconfig      2013-07-06 13:20:47.736864659 +0200
 @@ -0,0 +1,202 @@
 +config AUFS_FS
 +      tristate "Aufs (Advanced multi layered unification filesystem) support"
@@ -18658,7 +19296,7 @@ diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig
 +endif
 diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c
 --- /usr/share/empty/fs/aufs/loop.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/loop.c       2013-03-14 20:07:18.764260309 +0100
++++ linux/fs/aufs/loop.c       2013-07-30 22:42:55.842946719 +0200
 @@ -0,0 +1,135 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -18797,7 +19435,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c
 +}
 diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h
 --- /usr/share/empty/fs/aufs/loop.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/loop.h       2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/loop.h       2013-07-30 22:42:55.842946719 +0200
 @@ -0,0 +1,50 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -18851,7 +19489,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h
 +#endif /* __AUFS_LOOP_H__ */
 diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk
 --- /usr/share/empty/fs/aufs/magic.mk  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/magic.mk     2012-08-26 08:39:00.760508065 +0200
++++ linux/fs/aufs/magic.mk     2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,54 @@
 +
 +# defined in ${srctree}/fs/fuse/inode.c
@@ -18909,7 +19547,7 @@ diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk
 +endif
 diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 --- /usr/share/empty/fs/aufs/Makefile  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/Makefile     2012-08-26 08:39:00.757174634 +0200
++++ linux/fs/aufs/Makefile     2013-08-23 23:59:39.631583456 +0200
 @@ -0,0 +1,42 @@
 +
 +include ${src}/magic.mk
@@ -18937,7 +19575,7 @@ diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 +      finfo.o file.o f_op.o \
 +      dir.o vdir.o \
 +      iinfo.o inode.o i_op.o i_op_add.o i_op_del.o i_op_ren.o \
-+      ioctl.o
++      mvdown.o ioctl.o
 +
 +# all are boolean
 +aufs-$(CONFIG_PROC_FS) += procfs.o plink.o
@@ -18955,7 +19593,7 @@ diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile
 +aufs-$(CONFIG_AUFS_MAGIC_SYSRQ) += sysrq.o
 diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 --- /usr/share/empty/fs/aufs/module.c  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/module.c     2013-07-01 12:54:21.042826542 +0200
++++ linux/fs/aufs/module.c     2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,203 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -19162,7 +19800,7 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 +module_exit(aufs_exit);
 diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 --- /usr/share/empty/fs/aufs/module.h  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/module.h     2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/module.h     2013-07-06 13:20:47.750198454 +0200
 @@ -0,0 +1,105 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -19208,71 +19846,608 @@ diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 +      AuLcNonDir_DIINFO,
 +      AuLcNonDir_IIINFO,
 +
-+      AuLcDir_FIINFO,
-+      AuLcDir_DIINFO,
-+      AuLcDir_IIINFO,
++      AuLcDir_FIINFO,
++      AuLcDir_DIINFO,
++      AuLcDir_IIINFO,
++
++      AuLcSymlink_DIINFO,
++      AuLcSymlink_IIINFO,
++
++      AuLcKey_Last
++};
++extern struct lock_class_key au_lc_key[AuLcKey_Last];
++
++void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp);
++int au_seq_path(struct seq_file *seq, struct path *path);
++
++#ifdef CONFIG_PROC_FS
++/* procfs.c */
++int __init au_procfs_init(void);
++void au_procfs_fin(void);
++#else
++AuStubInt0(au_procfs_init, void);
++AuStubVoid(au_procfs_fin, void);
++#endif
++
++/* ---------------------------------------------------------------------- */
++
++/* kmem cache */
++enum {
++      AuCache_DINFO,
++      AuCache_ICNTNR,
++      AuCache_FINFO,
++      AuCache_VDIR,
++      AuCache_DEHSTR,
++      AuCache_HNOTIFY, /* must be last */
++      AuCache_Last
++};
++
++#define AuCacheFlags          (SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD)
++#define AuCache(type)         KMEM_CACHE(type, AuCacheFlags)
++#define AuCacheCtor(type, ctor)       \
++      kmem_cache_create(#type, sizeof(struct type), \
++                        __alignof__(struct type), AuCacheFlags, ctor)
++
++extern struct kmem_cache *au_cachep[];
++
++#define AuCacheFuncs(name, index) \
++static inline struct au_##name *au_cache_alloc_##name(void) \
++{ return kmem_cache_alloc(au_cachep[AuCache_##index], GFP_NOFS); } \
++static inline void au_cache_free_##name(struct au_##name *p) \
++{ kmem_cache_free(au_cachep[AuCache_##index], p); }
++
++AuCacheFuncs(dinfo, DINFO);
++AuCacheFuncs(icntnr, ICNTNR);
++AuCacheFuncs(finfo, FINFO);
++AuCacheFuncs(vdir, VDIR);
++AuCacheFuncs(vdir_dehstr, DEHSTR);
++#ifdef CONFIG_AUFS_HNOTIFY
++AuCacheFuncs(hnotify, HNOTIFY);
++#endif
++
++#endif /* __KERNEL__ */
++#endif /* __AUFS_MODULE_H__ */
+diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c
+--- /usr/share/empty/fs/aufs/mvdown.c  1970-01-01 01:00:00.000000000 +0100
++++ linux/fs/aufs/mvdown.c     2013-08-23 23:59:39.634916914 +0200
+@@ -0,0 +1,533 @@
++/*
++ * Copyright (C) 2011-2013 Junjiro R. Okajima
++ *
++ * This program, aufs is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
++ */
++
++#include "aufs.h"
++
++enum {
++      AUFS_MVDOWN_SRC,
++      AUFS_MVDOWN_DST,
++      AUFS_MVDOWN_NARRAY
++};
++
++struct au_mvd_args {
++      struct {
++              aufs_bindex_t bindex;
++              struct super_block *h_sb;
++              struct dentry *h_parent;
++              struct au_hinode *hdir;
++              struct inode *h_dir;
++      } info[AUFS_MVDOWN_NARRAY];
++
++      struct aufs_mvdown mvdown;
++      struct dentry *dentry, *parent;
++      struct inode *inode, *dir;
++      struct super_block *sb;
++      aufs_bindex_t bopq, bwh, bfound;
++      unsigned char rename_lock;
++      struct au_pin pin;
++};
++
++#define mvd_bsrc              info[AUFS_MVDOWN_SRC].bindex
++#define mvd_h_src_sb          info[AUFS_MVDOWN_SRC].h_sb
++#define mvd_h_src_parent      info[AUFS_MVDOWN_SRC].h_parent
++#define mvd_hdir_src          info[AUFS_MVDOWN_SRC].hdir
++#define mvd_h_src_dir         info[AUFS_MVDOWN_SRC].h_dir
++
++#define mvd_bdst              info[AUFS_MVDOWN_DST].bindex
++#define mvd_h_dst_sb          info[AUFS_MVDOWN_DST].h_sb
++#define mvd_h_dst_parent      info[AUFS_MVDOWN_DST].h_parent
++#define mvd_hdir_dst          info[AUFS_MVDOWN_DST].hdir
++#define mvd_h_dst_dir         info[AUFS_MVDOWN_DST].h_dir
++
++#define AU_MVD_PR(flag, ...) do {                     \
++              if (flag)                               \
++                      pr_err(__VA_ARGS__);            \
++      } while (0)
++
++/* make the parent dir on bdst */
++static int au_do_mkdir(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++
++      err = 0;
++      a->mvd_hdir_src = au_hi(a->dir, a->mvd_bsrc);
++      a->mvd_hdir_dst = au_hi(a->dir, a->mvd_bdst);
++      a->mvd_h_src_parent = au_h_dptr(a->parent, a->mvd_bsrc);
++      a->mvd_h_dst_parent = NULL;
++      if (au_dbend(a->parent) >= a->mvd_bdst)
++              a->mvd_h_dst_parent = au_h_dptr(a->parent, a->mvd_bdst);
++      if (!a->mvd_h_dst_parent) {
++              err = au_cpdown_dirs(a->dentry, a->mvd_bdst);
++              if (unlikely(err)) {
++                      AU_MVD_PR(verbose, "cpdown_dirs failed\n");
++                      goto out;
++              }
++              a->mvd_h_dst_parent = au_h_dptr(a->parent, a->mvd_bdst);
++      }
++
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++/* lock them all */
++static int au_do_lock(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++      struct dentry *h_trap;
++
++      a->mvd_h_src_sb = au_sbr_sb(a->sb, a->mvd_bsrc);
++      a->mvd_h_dst_sb = au_sbr_sb(a->sb, a->mvd_bdst);
++      if (a->mvd_h_src_sb != a->mvd_h_dst_sb) {
++              a->rename_lock = 0;
++              err = au_pin(&a->pin, a->dentry, a->mvd_bdst, au_opt_udba(a->sb),
++                           AuPin_MNT_WRITE | AuPin_DI_LOCKED);
++              if (!err) {
++                      a->mvd_h_src_dir = a->mvd_h_src_parent->d_inode;
++                      mutex_lock_nested(&a->mvd_h_src_dir->i_mutex,
++                                        AuLsc_I_PARENT3);
++              } else
++                      AU_MVD_PR(verbose, "pin failed\n");
++              goto out;
++      }
++
++      err = 0;
++      a->rename_lock = 1;
++      h_trap = vfsub_lock_rename(a->mvd_h_src_parent, a->mvd_hdir_src,
++                                 a->mvd_h_dst_parent, a->mvd_hdir_dst);
++      if (h_trap) {
++              err = (h_trap != a->mvd_h_src_parent);
++              if (err)
++                      err = (h_trap != a->mvd_h_dst_parent);
++      }
++      BUG_ON(err); /* it should never happen */
++
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++static void au_do_unlock(const unsigned char verbose, struct au_mvd_args *a)
++{
++      if (!a->rename_lock) {
++              mutex_unlock(&a->mvd_h_src_dir->i_mutex);
++              au_unpin(&a->pin);
++      } else
++              vfsub_unlock_rename(a->mvd_h_src_parent, a->mvd_hdir_src,
++                                  a->mvd_h_dst_parent, a->mvd_hdir_dst);
++}
++
++/* copy-down the file */
++static int au_do_cpdown(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++      struct au_cp_generic cpg = {
++              .dentry = a->dentry,
++              .bdst   = a->mvd_bdst,
++              .bsrc   = a->mvd_bsrc,
++              .len    = -1,
++              .pin    = &a->pin,
++              .flags  = AuCpup_DTIME | AuCpup_HOPEN
++      };
++
++      AuDbg("b%d, b%d\n", cpg.bsrc, cpg.bdst);
++      err = au_sio_cpdown_simple(&cpg);
++      if (unlikely(err))
++              AU_MVD_PR(verbose, "cpdown failed\n");
++
++      AuTraceErr(err);
++      return err;
++}
++
++/*
++ * unlink the whiteout on bdst if exist which may be created by UDBA while we
++ * were sleeping
++ */
++static int au_do_unlink_wh(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++      struct path h_path;
++      struct au_branch *br;
++
++      br = au_sbr(a->sb, a->mvd_bdst);
++      h_path.dentry = au_wh_lkup(a->mvd_h_dst_parent, &a->dentry->d_name, br);
++      err = PTR_ERR(h_path.dentry);
++      if (IS_ERR(h_path.dentry)) {
++              AU_MVD_PR(verbose, "wh_lkup failed\n");
++              goto out;
++      }
++
++      err = 0;
++      if (h_path.dentry->d_inode) {
++              h_path.mnt = au_br_mnt(br);
++              err = vfsub_unlink(a->mvd_h_dst_parent->d_inode, &h_path,
++                                 /*force*/0);
++              if (unlikely(err))
++                      AU_MVD_PR(verbose, "wh_unlink failed\n");
++      }
++      dput(h_path.dentry);
++
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++/*
++ * unlink the topmost h_dentry
++ * Note: the target file MAY be modified by UDBA between this mutex_unlock() and
++ *    mutex_lock() in vfs_unlink(). in this case, such changes may be lost.
++ */
++static int au_do_unlink(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++      struct path h_path;
++
++      h_path.mnt = au_sbr_mnt(a->sb, a->mvd_bsrc);
++      h_path.dentry = au_h_dptr(a->dentry, a->mvd_bsrc);
++      err = vfsub_unlink(a->mvd_h_src_dir, &h_path, /*force*/0);
++      if (unlikely(err))
++              AU_MVD_PR(verbose, "unlink failed\n");
++
++      AuTraceErr(err);
++      return err;
++}
++
++/*
++ * copy-down the file and unlink the bsrc file.
++ * - unlink the bdst whout if exist
++ * - copy-down the file (with whtmp name and rename)
++ * - unlink the bsrc file
++ */
++static int au_do_mvdown(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++
++      err = au_do_mkdir(verbose, a);
++      if (!err)
++              err = au_do_lock(verbose, a);
++      if (unlikely(err))
++              goto out;
++
++      /*
++       * do not revert the activities we made on bdst since they should be
++       * harmless in aufs.
++       */
++
++      err = au_do_cpdown(verbose, a);
++      if (!err)
++              err = au_do_unlink_wh(verbose, a);
++      if (!err)
++              err = au_do_unlink(verbose, a);
++      if (unlikely(err))
++              goto out_unlock;
++
++      /* maintain internal array */
++      au_set_h_dptr(a->dentry, a->mvd_bsrc, NULL);
++      au_set_dbstart(a->dentry, a->mvd_bdst);
++      if (au_dbend(a->dentry) < a->mvd_bdst)
++              au_set_dbend(a->dentry, a->mvd_bdst);
++      au_set_h_iptr(a->inode, a->mvd_bsrc, NULL, /*flags*/0);
++      au_set_ibstart(a->inode, a->mvd_bdst);
++      if (au_ibend(a->inode) < a->mvd_bdst)
++              au_set_ibend(a->inode, a->mvd_bdst);
++
++out_unlock:
++      au_do_unlock(verbose, a);
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++/* ---------------------------------------------------------------------- */
++
++static int find_lower_writable(struct super_block *sb, aufs_bindex_t bindex)
++{
++      aufs_bindex_t bend;
++      struct au_branch *br;
++
++      bend = au_sbend(sb);
++      for (bindex++; bindex <= bend; bindex++) {
++              br = au_sbr(sb, bindex);
++              if (!au_br_rdonly(br))
++                      return bindex;
++      }
++
++      return -1;
++}
++
++/* make sure the file is idle */
++static int au_mvd_args_busy(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err, plinked;
++      struct inode *h_src_inode;
++
++      err = 0;
++      h_src_inode = au_h_iptr(a->inode, a->mvd_bsrc);
++      plinked = !!au_opt_test(au_mntflags(a->sb), PLINK);
++      if (au_dbstart(a->dentry) == a->mvd_bsrc
++          && a->dentry->d_count == 1
++          && atomic_read(&a->inode->i_count) == 1
++          /* && h_src_inode->i_nlink == 1 */
++          && (!plinked || !au_plink_test(a->inode))
++          && a->inode->i_nlink == 1)
++              goto out;
++
++      err = -EBUSY;
++      AU_MVD_PR(verbose,
++                "b%d, d{b%d, c%u?}, i{c%d?, l%u}, hi{l%u}, p{%d, %d}\n",
++                a->mvd_bsrc, au_dbstart(a->dentry), a->dentry->d_count,
++                atomic_read(&a->inode->i_count), a->inode->i_nlink,
++                h_src_inode->i_nlink,
++                plinked, plinked ? au_plink_test(a->inode) : 0);
++
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++/* make sure the parent dir is fine */
++static int au_mvd_args_parent(const unsigned char verbose,
++                            struct au_mvd_args *a)
++{
++      int err;
++      aufs_bindex_t bindex;
++
++      err = 0;
++      if (unlikely(au_alive_dir(a->parent))) {
++              err = -ENOENT;
++              AU_MVD_PR(verbose, "parent dir is dead\n");
++              goto out;
++      }
++
++      a->bopq = au_dbdiropq(a->parent);
++      bindex = au_wbr_nonopq(a->dentry, a->mvd_bdst);
++      AuDbg("b%d\n", bindex);
++      if (unlikely((bindex >= 0 && bindex < a->mvd_bdst)
++                   || (a->bopq != -1 && a->bopq < a->mvd_bdst))) {
++              err = -EINVAL;
++              AU_MVD_PR(verbose, "parent dir is opaque b%d, b%d\n",
++                        a->bopq, a->mvd_bdst);
++      }
++
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++static int au_mvd_args_intermediate(const unsigned char verbose,
++                                  struct au_mvd_args *a)
++{
++      int err;
++      struct au_dinfo *dinfo, *tmp;
++
++      /* lookup the next lower positive entry */
++      err = -ENOMEM;
++      tmp = au_di_alloc(a->sb, AuLsc_DI_TMP);
++      if (unlikely(!tmp))
++              goto out;
++
++      a->bfound = -1;
++      a->bwh = -1;
++      dinfo = au_di(a->dentry);
++      au_di_cp(tmp, dinfo);
++      au_di_swap(tmp, dinfo);
++
++      /* returns the number of positive dentries */
++      err = au_lkup_dentry(a->dentry, a->mvd_bsrc + 1, /*type*/0);
++      if (!err)
++              a->bwh = au_dbwh(a->dentry);
++      else if (err > 0)
++              a->bfound = au_dbstart(a->dentry);
++
++      au_di_swap(tmp, dinfo);
++      au_rw_write_unlock(&tmp->di_rwsem);
++      au_di_free(tmp);
++      if (unlikely(err < 0))
++              AU_MVD_PR(verbose, "failed look-up lower\n");
++
++      /*
++       * here, we have these cases.
++       * bfound == -1
++       *      no positive dentry under bsrc. there are more sub-cases.
++       *      bwh < 0
++       *              there no whiteout, we can safely move-down.
++       *      bwh <= bsrc
++       *              impossible
++       *      bsrc < bwh && bwh < bdst
++       *              there is a whiteout on RO branch. cannot proceed.
++       *      bwh == bdst
++       *              there is a whiteout on the RW target branch. it should
++       *              be removed.
++       *      bdst < bwh
++       *              there is a whiteout somewhere unrelated branch.
++       * -1 < bfound && bfound <= bsrc
++       *      impossible.
++       * bfound < bdst
++       *      found, but it is on RO branch between bsrc and bdst. cannot
++       *      proceed.
++       * bfound == bdst
++       *      found, replace it if AUFS_MVDOWN_FORCE is set. otherwise return
++       *      error.
++       * bdst < bfound
++       *      found, after we create the file on bdst, it will be hidden.
++       */
++
++      AuDebugOn(a->bfound == -1
++                && a->bwh != -1
++                && a->bwh <= a->mvd_bsrc);
++      AuDebugOn(-1 < a->bfound
++                && a->bfound <= a->mvd_bsrc);
++
++      err = -EINVAL;
++      if (a->bfound == -1
++          && a->mvd_bsrc < a->bwh
++          && a->bwh != -1
++          && a->bwh < a->mvd_bdst) {
++              AU_MVD_PR(verbose, "bsrc %d, bdst %d, bfound %d, bwh %d\n",
++                        a->mvd_bsrc, a->mvd_bdst, a->bfound, a->bwh);
++              goto out;
++      } else if (a->bfound != -1 && a->bfound < a->mvd_bdst) {
++              AU_MVD_PR(verbose, "bdst %d, bfound %d\n",
++                        a->mvd_bdst, a->bfound);
++              goto out;
++      }
++
++      err = 0; /* success */
++
++out:
++      AuTraceErr(err);
++      return err;
++}
++
++static int au_mvd_args_exist(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++
++      err = (a->bfound != a->mvd_bdst) ? 0 : -EEXIST;
++      AuTraceErr(err);
++      return err;
++}
++
++static int au_mvd_args(const unsigned char verbose, struct au_mvd_args *a)
++{
++      int err;
++      struct au_branch *br;
++
++      err = -EISDIR;
++      if (unlikely(S_ISDIR(a->inode->i_mode)))
++              goto out;
++
++      err = -EINVAL;
++      a->mvd_bsrc = au_ibstart(a->inode);
++      if (unlikely(a->mvd_bsrc == au_sbend(a->sb))) {
++              AU_MVD_PR(verbose, "on the bottom\n");
++              goto out;
++      }
++      br = au_sbr(a->sb, a->mvd_bsrc);
++      err = au_br_rdonly(br);
++      if (unlikely(err))
++              goto out;
 +
-+      AuLcSymlink_DIINFO,
-+      AuLcSymlink_IIINFO,
++      err = -EINVAL;
++      a->mvd_bdst = find_lower_writable(a->sb, a->mvd_bsrc);
++      if (unlikely(a->mvd_bdst < 0)) {
++              AU_MVD_PR(verbose, "no writable lower branch\n");
++              goto out;
++      }
 +
-+      AuLcKey_Last
-+};
-+extern struct lock_class_key au_lc_key[AuLcKey_Last];
++      err = au_mvd_args_busy(verbose, a);
++      if (!err)
++              err = au_mvd_args_parent(verbose, a);
++      if (!err)
++              err = au_mvd_args_intermediate(verbose, a);
++      if (!err)
++              err = au_mvd_args_exist(verbose, a);
++      if (!err)
++              AuDbg("b%d, b%d\n", a->mvd_bsrc, a->mvd_bdst);
 +
-+void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp);
-+int au_seq_path(struct seq_file *seq, struct path *path);
++out:
++      AuTraceErr(err);
++      return err;
++}
 +
-+#ifdef CONFIG_PROC_FS
-+/* procfs.c */
-+int __init au_procfs_init(void);
-+void au_procfs_fin(void);
-+#else
-+AuStubInt0(au_procfs_init, void);
-+AuStubVoid(au_procfs_fin, void);
-+#endif
++int au_mvdown(struct dentry *dentry, struct aufs_mvdown __user *uarg)
++{
++      int err;
++      unsigned char verbose;
++      struct au_mvd_args args = {
++              .dentry = dentry,
++              .inode  = dentry->d_inode,
++              .sb     = dentry->d_sb
++      };
 +
-+/* ---------------------------------------------------------------------- */
++      err = -EPERM;
++      if (unlikely(!capable(CAP_SYS_ADMIN)))
++              goto out;
 +
-+/* kmem cache */
-+enum {
-+      AuCache_DINFO,
-+      AuCache_ICNTNR,
-+      AuCache_FINFO,
-+      AuCache_VDIR,
-+      AuCache_DEHSTR,
-+      AuCache_HNOTIFY, /* must be last */
-+      AuCache_Last
-+};
++      err = copy_from_user(&args.mvdown, uarg, sizeof(args.mvdown));
++      if (unlikely(err)) {
++              err = -EFAULT;
++              goto out;
++      }
++      AuDbg("flags 0x%x\n", args.mvdown.flags);
 +
-+#define AuCacheFlags          (SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD)
-+#define AuCache(type)         KMEM_CACHE(type, AuCacheFlags)
-+#define AuCacheCtor(type, ctor)       \
-+      kmem_cache_create(#type, sizeof(struct type), \
-+                        __alignof__(struct type), AuCacheFlags, ctor)
++      err = -EBUSY;
++      verbose = !!(args.mvdown.flags & AUFS_MVDOWN_VERBOSE);
++      args.parent = dget_parent(dentry);
++      args.dir = args.parent->d_inode;
++      mutex_lock_nested(&args.dir->i_mutex, I_MUTEX_PARENT);
++      dput(args.parent);
++      if (unlikely(args.parent != dentry->d_parent)) {
++              AU_MVD_PR(verbose, "parent dir is moved\n");
++              goto out_dir;
++      }
 +
-+extern struct kmem_cache *au_cachep[];
++      mutex_lock_nested(&args.inode->i_mutex, I_MUTEX_CHILD);
++      err = aufs_read_lock(dentry, AuLock_DW | AuLock_FLUSH);
++      if (unlikely(err))
++              goto out_inode;
 +
-+#define AuCacheFuncs(name, index) \
-+static inline struct au_##name *au_cache_alloc_##name(void) \
-+{ return kmem_cache_alloc(au_cachep[AuCache_##index], GFP_NOFS); } \
-+static inline void au_cache_free_##name(struct au_##name *p) \
-+{ kmem_cache_free(au_cachep[AuCache_##index], p); }
++      di_write_lock_parent(args.parent);
++      err = au_mvd_args(verbose, &args);
++      if (unlikely(err))
++              goto out_parent;
 +
-+AuCacheFuncs(dinfo, DINFO);
-+AuCacheFuncs(icntnr, ICNTNR);
-+AuCacheFuncs(finfo, FINFO);
-+AuCacheFuncs(vdir, VDIR);
-+AuCacheFuncs(vdir_dehstr, DEHSTR);
-+#ifdef CONFIG_AUFS_HNOTIFY
-+AuCacheFuncs(hnotify, HNOTIFY);
-+#endif
++      AuDbgDentry(dentry);
++      AuDbgInode(args.inode);
++      err = au_do_mvdown(verbose, &args);
++      if (unlikely(err))
++              goto out_parent;
++      AuDbgDentry(dentry);
++      AuDbgInode(args.inode);
 +
-+#endif /* __KERNEL__ */
-+#endif /* __AUFS_MODULE_H__ */
++      au_cpup_attr_timesizes(args.dir);
++      au_cpup_attr_timesizes(args.inode);
++      au_cpup_igen(args.inode, au_h_iptr(args.inode, args.mvd_bdst));
++      /* au_digen_dec(dentry); */
++
++out_parent:
++      di_write_unlock(args.parent);
++      aufs_read_unlock(dentry, AuLock_DW);
++out_inode:
++      mutex_unlock(&args.inode->i_mutex);
++out_dir:
++      mutex_unlock(&args.dir->i_mutex);
++out:
++      AuTraceErr(err);
++      return err;
++}
 diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 --- /usr/share/empty/fs/aufs/opts.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.c       2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,1677 @@
++++ linux/fs/aufs/opts.c       2013-07-06 13:20:47.753531903 +0200
+@@ -0,0 +1,1697 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -19461,17 +20636,16 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +      {0, NULL}
 +};
 +
-+static match_table_t brrattr = {
++static match_table_t brattr = {
++      {AuBrAttr_UNPIN, AUFS_BRATTR_UNPIN},
 +      {AuBrRAttr_WH, AUFS_BRRATTR_WH},
-+      {0, NULL}
-+};
-+
-+static match_table_t brwattr = {
 +      {AuBrWAttr_NoLinkWH, AUFS_BRWATTR_NLWH},
 +      {0, NULL}
 +};
 +
-+#define AuBrStr_LONGEST       AUFS_BRPERM_RW "+" AUFS_BRWATTR_NLWH
++#define AuBrStr_LONGEST       AUFS_BRPERM_RW \
++      "+" AUFS_BRATTR_UNPIN \
++      "+" AUFS_BRWATTR_NLWH
 +
 +static int br_attr_val(char *str, match_table_t table, substring_t args[])
 +{
@@ -19502,7 +20676,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +static int noinline_for_stack br_perm_val(char *perm)
 +{
 +      int val;
-+      char *p;
++      char *p, *q;
 +      substring_t args[MAX_OPT_ARGS];
 +
 +      p = strchr(perm, '+');
@@ -19519,13 +20693,33 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +      if (!p)
 +              goto out;
 +
-+      switch (val) {
++      p++;
++      while (1) {
++              q = strchr(p, '+');
++              if (q)
++                      *q = 0;
++              val |= br_attr_val(p, brattr, args);
++              if (q) {
++                      *q = '+';
++                      p = q + 1;
++              } else
++                      break;
++      }
++      switch (val & AuBrPerm_Mask) {
 +      case AuBrPerm_RO:
 +      case AuBrPerm_RR:
-+              val |= br_attr_val(p + 1, brrattr, args);
++              if (unlikely(val & AuBrWAttr_NoLinkWH)) {
++                      pr_warn("ignored branch attribute %s\n",
++                              AUFS_BRWATTR_NLWH);
++                      val &= ~AuBrWAttr_NoLinkWH;
++              }
 +              break;
 +      case AuBrPerm_RW:
-+              val |= br_attr_val(p + 1, brwattr, args);
++              if (unlikely(val & AuBrRAttr_WH)) {
++                      pr_warn("ignored branch attribute %s\n",
++                              AUFS_BRRATTR_WH);
++                      val &= ~AuBrRAttr_WH;
++              }
 +              break;
 +      }
 +
@@ -19568,6 +20762,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +              AuDebugOn(1);
 +      }
 +
++      AppendAttr(AuBrAttr_UNPIN, AUFS_BRATTR_UNPIN);
 +      AppendAttr(AuBrRAttr_WH, AUFS_BRRATTR_WH);
 +      AppendAttr(AuBrWAttr_NoLinkWH, AUFS_BRWATTR_NLWH);
 +
@@ -20793,7 +21988,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +              au_hn_imtx_lock_nested(hdir, AuLsc_I_PARENT);
 +              if (wbr)
 +                      wbr_wh_write_lock(wbr);
-+              err = au_wh_init(au_h_dptr(root, bindex), br, sb);
++              err = au_wh_init(br, sb);
 +              if (wbr)
 +                      wbr_wh_write_unlock(wbr);
 +              au_hn_imtx_unlock(hdir);
@@ -20952,7 +22147,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +}
 diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
 --- /usr/share/empty/fs/aufs/opts.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.h       2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/opts.h       2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,209 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -21165,8 +22360,8 @@ diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
 +#endif /* __AUFS_OPTS_H__ */
 diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 --- /usr/share/empty/fs/aufs/plink.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/plink.c      2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,511 @@
++++ linux/fs/aufs/plink.c      2013-07-06 13:20:47.753531903 +0200
+@@ -0,0 +1,520 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -21288,19 +22483,12 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +
 +/* ---------------------------------------------------------------------- */
 +
-+struct pseudo_link {
-+      union {
-+              struct list_head list;
-+              struct rcu_head rcu;
-+      };
-+      struct inode *inode;
-+};
-+
 +#ifdef CONFIG_AUFS_DEBUG
 +void au_plink_list(struct super_block *sb)
 +{
++      int i;
 +      struct au_sbinfo *sbinfo;
-+      struct list_head *plink_list;
++      struct hlist_head *plink_hlist;
 +      struct pseudo_link *plink;
 +
 +      SiMustAnyLock(sb);
@@ -21309,20 +22497,22 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +      AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
 +      AuDebugOn(au_plink_maint(sb, AuLock_NOPLM));
 +
-+      plink_list = &sbinfo->si_plink.head;
-+      rcu_read_lock();
-+      list_for_each_entry_rcu(plink, plink_list, list)
-+              AuDbg("%lu\n", plink->inode->i_ino);
-+      rcu_read_unlock();
++      for (i = 0; i < AuPlink_NHASH; i++) {
++              plink_hlist = &sbinfo->si_plink[i].head;
++              rcu_read_lock();
++              hlist_for_each_entry_rcu(plink, plink_hlist, hlist)
++                      AuDbg("%lu\n", plink->inode->i_ino);
++              rcu_read_unlock();
++      }
 +}
 +#endif
 +
 +/* is the inode pseudo-linked? */
 +int au_plink_test(struct inode *inode)
 +{
-+      int found;
++      int found, i;
 +      struct au_sbinfo *sbinfo;
-+      struct list_head *plink_list;
++      struct hlist_head *plink_hlist;
 +      struct pseudo_link *plink;
 +
 +      sbinfo = au_sbi(inode->i_sb);
@@ -21331,9 +22521,10 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +      AuDebugOn(au_plink_maint(inode->i_sb, AuLock_NOPLM));
 +
 +      found = 0;
-+      plink_list = &sbinfo->si_plink.head;
++      i = au_plink_hash(inode->i_ino);
++      plink_hlist = &sbinfo->si_plink[i].head;
 +      rcu_read_lock();
-+      list_for_each_entry_rcu(plink, plink_list, list)
++      hlist_for_each_entry_rcu(plink, plink_hlist, hlist)
 +              if (plink->inode == inode) {
 +                      found = 1;
 +                      break;
@@ -21429,7 +22620,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +{
 +      int err;
 +      struct path h_path = {
-+              .mnt = br->br_mnt
++              .mnt = au_br_mnt(br)
 +      };
 +      struct inode *h_dir;
 +
@@ -21512,7 +22703,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +static void do_put_plink(struct pseudo_link *plink, int do_del)
 +{
 +      if (do_del)
-+              list_del(&plink->list);
++              hlist_del(&plink->hlist);
 +      iput(plink->inode);
 +      kfree(plink);
 +}
@@ -21535,30 +22726,23 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +{
 +      struct super_block *sb;
 +      struct au_sbinfo *sbinfo;
-+      struct list_head *plink_list;
++      struct hlist_head *plink_hlist;
 +      struct pseudo_link *plink, *tmp;
-+      int found, err, cnt;
++      struct au_sphlhead *sphl;
++      int found, err, cnt, i;
 +
 +      sb = inode->i_sb;
 +      sbinfo = au_sbi(sb);
 +      AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
 +      AuDebugOn(au_plink_maint(sb, AuLock_NOPLM));
 +
-+      cnt = 0;
-+      found = 0;
-+      plink_list = &sbinfo->si_plink.head;
-+      rcu_read_lock();
-+      list_for_each_entry_rcu(plink, plink_list, list) {
-+              cnt++;
-+              if (plink->inode == inode) {
-+                      found = 1;
-+                      break;
-+              }
-+      }
-+      rcu_read_unlock();
++      found = au_plink_test(inode);
 +      if (found)
 +              return;
 +
++      i = au_plink_hash(inode->i_ino);
++      sphl = sbinfo->si_plink + i;
++      plink_hlist = &sphl->head;
 +      tmp = kmalloc(sizeof(*plink), GFP_NOFS);
 +      if (tmp)
 +              tmp->inode = au_igrab(inode);
@@ -21567,20 +22751,22 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +              goto out;
 +      }
 +
-+      spin_lock(&sbinfo->si_plink.spin);
-+      list_for_each_entry(plink, plink_list, list) {
++      spin_lock(&sphl->spin);
++      hlist_for_each_entry(plink, plink_hlist, hlist) {
 +              if (plink->inode == inode) {
 +                      found = 1;
 +                      break;
 +              }
 +      }
 +      if (!found)
-+              list_add_rcu(&tmp->list, plink_list);
-+      spin_unlock(&sbinfo->si_plink.spin);
++              hlist_add_head_rcu(&tmp->hlist, plink_hlist);
++      spin_unlock(&sphl->spin);
 +      if (!found) {
-+              cnt++;
-+              WARN_ONCE(cnt > AUFS_PLINK_WARN,
-+                        "unexpectedly many pseudo links, %d\n", cnt);
++              cnt = au_sphl_count(sphl);
++#define msg "unexpectedly unblanced or too many pseudo-links"
++              if (cnt > AUFS_PLINK_WARN)
++                      AuWarn1(msg ", %d\n", cnt);
++#undef msg
 +              err = whplink(h_dentry, inode, bindex, au_sbr(sb, bindex));
 +      } else {
 +              do_put_plink(tmp, 0);
@@ -21591,7 +22777,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +      if (unlikely(err)) {
 +              pr_warn("err %d, damaged pseudo link.\n", err);
 +              if (tmp) {
-+                      au_spl_del_rcu(&tmp->list, &sbinfo->si_plink);
++                      au_sphl_del_rcu(&tmp->hlist, sphl);
 +                      call_rcu(&tmp->rcu, do_put_plink_rcu);
 +              }
 +      }
@@ -21600,9 +22786,11 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +/* free all plinks */
 +void au_plink_put(struct super_block *sb, int verbose)
 +{
++      int i, warned;
 +      struct au_sbinfo *sbinfo;
-+      struct list_head *plink_list;
-+      struct pseudo_link *plink, *tmp;
++      struct hlist_head *plink_hlist;
++      struct hlist_node *tmp;
++      struct pseudo_link *plink;
 +
 +      SiMustWriteLock(sb);
 +
@@ -21610,12 +22798,18 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +      AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
 +      AuDebugOn(au_plink_maint(sb, AuLock_NOPLM));
 +
-+      plink_list = &sbinfo->si_plink.head;
 +      /* no spin_lock since sbinfo is write-locked */
-+      WARN(verbose && !list_empty(plink_list), "pseudo-link is not flushed");
-+      list_for_each_entry_safe(plink, tmp, plink_list, list)
-+              do_put_plink(plink, 0);
-+      INIT_LIST_HEAD(plink_list);
++      warned = 0;
++      for (i = 0; i < AuPlink_NHASH; i++) {
++              plink_hlist = &sbinfo->si_plink[i].head;
++              if (!warned && verbose && !hlist_empty(plink_hlist)) {
++                      pr_warn("pseudo-link is not flushed");
++                      warned = 1;
++              }
++              hlist_for_each_entry_safe(plink, tmp, plink_hlist, hlist)
++                      do_put_plink(plink, 0);
++              INIT_HLIST_HEAD(plink_hlist);
++      }
 +}
 +
 +void au_plink_clean(struct super_block *sb, int verbose)
@@ -21629,15 +22823,44 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +      aufs_write_unlock(root);
 +}
 +
++static int au_plink_do_half_refresh(struct inode *inode, aufs_bindex_t br_id)
++{
++      int do_put;
++      aufs_bindex_t bstart, bend, bindex;
++
++      do_put = 0;
++      bstart = au_ibstart(inode);
++      bend = au_ibend(inode);
++      if (bstart >= 0) {
++              for (bindex = bstart; bindex <= bend; bindex++) {
++                      if (!au_h_iptr(inode, bindex)
++                          || au_ii_br_id(inode, bindex) != br_id)
++                              continue;
++                      au_set_h_iptr(inode, bindex, NULL, 0);
++                      do_put = 1;
++                      break;
++              }
++              if (do_put)
++                      for (bindex = bstart; bindex <= bend; bindex++)
++                              if (au_h_iptr(inode, bindex)) {
++                                      do_put = 0;
++                                      break;
++                              }
++      } else
++              do_put = 1;
++
++      return do_put;
++}
++
 +/* free the plinks on a branch specified by @br_id */
 +void au_plink_half_refresh(struct super_block *sb, aufs_bindex_t br_id)
 +{
 +      struct au_sbinfo *sbinfo;
-+      struct list_head *plink_list;
-+      struct pseudo_link *plink, *tmp;
++      struct hlist_head *plink_hlist;
++      struct hlist_node *tmp;
++      struct pseudo_link *plink;
 +      struct inode *inode;
-+      aufs_bindex_t bstart, bend, bindex;
-+      unsigned char do_put;
++      int i, do_put;
 +
 +      SiMustWriteLock(sb);
 +
@@ -21645,42 +22868,23 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +      AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK));
 +      AuDebugOn(au_plink_maint(sb, AuLock_NOPLM));
 +
-+      plink_list = &sbinfo->si_plink.head;
 +      /* no spin_lock since sbinfo is write-locked */
-+      list_for_each_entry_safe(plink, tmp, plink_list, list) {
-+              do_put = 0;
-+              inode = au_igrab(plink->inode);
-+              ii_write_lock_child(inode);
-+              bstart = au_ibstart(inode);
-+              bend = au_ibend(inode);
-+              if (bstart >= 0) {
-+                      for (bindex = bstart; bindex <= bend; bindex++) {
-+                              if (!au_h_iptr(inode, bindex)
-+                                  || au_ii_br_id(inode, bindex) != br_id)
-+                                      continue;
-+                              au_set_h_iptr(inode, bindex, NULL, 0);
-+                              do_put = 1;
-+                              break;
-+                      }
-+              } else
-+                      do_put_plink(plink, 1);
-+
-+              if (do_put) {
-+                      for (bindex = bstart; bindex <= bend; bindex++)
-+                              if (au_h_iptr(inode, bindex)) {
-+                                      do_put = 0;
-+                                      break;
-+                              }
++      for (i = 0; i < AuPlink_NHASH; i++) {
++              plink_hlist = &sbinfo->si_plink[i].head;
++              hlist_for_each_entry_safe(plink, tmp, plink_hlist, hlist) {
++                      inode = au_igrab(plink->inode);
++                      ii_write_lock_child(inode);
++                      do_put = au_plink_do_half_refresh(inode, br_id);
 +                      if (do_put)
 +                              do_put_plink(plink, 1);
++                      ii_write_unlock(inode);
++                      iput(inode);
 +              }
-+              ii_write_unlock(inode);
-+              iput(inode);
 +      }
 +}
 diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 --- /usr/share/empty/fs/aufs/poll.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/poll.c       2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/poll.c       2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,56 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -21740,7 +22944,7 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +}
 diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 --- /usr/share/empty/fs/aufs/procfs.c  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/procfs.c     2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/procfs.c     2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,170 @@
 +/*
 + * Copyright (C) 2010-2013 Junjiro R. Okajima
@@ -21914,7 +23118,7 @@ diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
 --- /usr/share/empty/fs/aufs/rdu.c     1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rdu.c        2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/rdu.c        2013-07-30 22:42:55.842946719 +0200
 @@ -0,0 +1,384 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -22302,7 +23506,7 @@ diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
 +#endif
 diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h
 --- /usr/share/empty/fs/aufs/rwsem.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rwsem.h      2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/rwsem.h      2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,188 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -22494,8 +23698,8 @@ diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h
 +#endif /* __AUFS_RWSEM_H__ */
 diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 --- /usr/share/empty/fs/aufs/sbinfo.c  1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sbinfo.c     2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,343 @@
++++ linux/fs/aufs/sbinfo.c     2013-07-06 13:20:47.753531903 +0200
+@@ -0,0 +1,346 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -22525,11 +23729,13 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 + */
 +void au_si_free(struct kobject *kobj)
 +{
++      int i;
 +      struct au_sbinfo *sbinfo;
 +      char *locked __maybe_unused; /* debug only */
 +
 +      sbinfo = container_of(kobj, struct au_sbinfo, si_kobj);
-+      AuDebugOn(!list_empty(&sbinfo->si_plink.head));
++      for (i = 0; i < AuPlink_NHASH; i++)
++              AuDebugOn(!hlist_empty(&sbinfo->si_plink[i].head));
 +      AuDebugOn(atomic_read(&sbinfo->si_nowait.nw_len));
 +
 +      au_rw_write_lock(&sbinfo->si_rwsem);
@@ -22551,7 +23757,7 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +
 +int au_si_alloc(struct super_block *sb)
 +{
-+      int err;
++      int err, i;
 +      struct au_sbinfo *sbinfo;
 +      static struct lock_class_key aufs_si;
 +
@@ -22604,7 +23810,8 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +      sbinfo->si_rdhash = AUFS_RDHASH_DEF;
 +      sbinfo->si_dirwh = AUFS_DIRWH_DEF;
 +
-+      au_spl_init(&sbinfo->si_plink);
++      for (i = 0; i < AuPlink_NHASH; i++)
++              au_sphl_init(sbinfo->si_plink + i);
 +      init_waitqueue_head(&sbinfo->si_plink_wq);
 +      spin_lock_init(&sbinfo->si_plink_maint_lock);
 +
@@ -22841,8 +24048,8 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +}
 diff -urN /usr/share/empty/fs/aufs/spl.h linux/fs/aufs/spl.h
 --- /usr/share/empty/fs/aufs/spl.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/spl.h        2013-02-19 08:40:03.950226347 +0100
-@@ -0,0 +1,62 @@
++++ linux/fs/aufs/spl.h        2013-07-06 13:20:47.753531903 +0200
+@@ -0,0 +1,112 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -22903,11 +24110,61 @@ diff -urN /usr/share/empty/fs/aufs/spl.h linux/fs/aufs/spl.h
 +      spin_unlock(&spl->spin);
 +}
 +
++/* ---------------------------------------------------------------------- */
++
++struct au_sphlhead {
++      spinlock_t              spin;
++      struct hlist_head       head;
++};
++
++static inline void au_sphl_init(struct au_sphlhead *sphl)
++{
++      spin_lock_init(&sphl->spin);
++      INIT_HLIST_HEAD(&sphl->head);
++}
++
++static inline void au_sphl_add(struct hlist_node *hlist,
++                             struct au_sphlhead *sphl)
++{
++      spin_lock(&sphl->spin);
++      hlist_add_head(hlist, &sphl->head);
++      spin_unlock(&sphl->spin);
++}
++
++static inline void au_sphl_del(struct hlist_node *hlist,
++                             struct au_sphlhead *sphl)
++{
++      spin_lock(&sphl->spin);
++      hlist_del(hlist);
++      spin_unlock(&sphl->spin);
++}
++
++static inline void au_sphl_del_rcu(struct hlist_node *hlist,
++                                 struct au_sphlhead *sphl)
++{
++      spin_lock(&sphl->spin);
++      hlist_del_rcu(hlist);
++      spin_unlock(&sphl->spin);
++}
++
++static inline unsigned long au_sphl_count(struct au_sphlhead *sphl)
++{
++      unsigned long cnt;
++      struct hlist_node *pos;
++
++      cnt = 0;
++      spin_lock(&sphl->spin);
++      hlist_for_each(pos, &sphl->head)
++              cnt++;
++      spin_unlock(&sphl->spin);
++      return cnt;
++}
++
 +#endif /* __KERNEL__ */
 +#endif /* __AUFS_SPL_H__ */
 diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 --- /usr/share/empty/fs/aufs/super.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.c      2013-07-01 12:54:18.776081600 +0200
++++ linux/fs/aufs/super.c      2013-08-23 23:59:39.634916914 +0200
 @@ -0,0 +1,992 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -23015,7 +24272,7 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +      hdp = au_di(sb->s_root)->di_hdentry;
 +      for (bindex = 0; !err && bindex <= bend; bindex++) {
 +              br = au_sbr(sb, bindex);
-+              path.mnt = br->br_mnt;
++              path.mnt = au_br_mnt(br);
 +              path.dentry = hdp[bindex].hd_dentry;
 +              err = au_seq_path(seq, &path);
 +              if (err > 0) {
@@ -23042,14 +24299,14 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +
 +      AuRwMustAnyLock(&sbinfo->si_rwsem);
 +
-+      seq_printf(m, ",create=");
++      seq_puts(m, ",create=");
 +      pat = au_optstr_wbr_create(v);
 +      switch (v) {
 +      case AuWbrCreate_TDP:
 +      case AuWbrCreate_RR:
 +      case AuWbrCreate_MFS:
 +      case AuWbrCreate_PMFS:
-+              seq_printf(m, pat);
++              seq_puts(m, pat);
 +              break;
 +      case AuWbrCreate_MFSV:
 +              seq_printf(m, /*pat*/"mfs:%lu",
@@ -23903,8 +25160,8 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +};
 diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 --- /usr/share/empty/fs/aufs/super.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/super.h      2013-03-14 20:07:18.764260309 +0100
-@@ -0,0 +1,538 @@
++++ linux/fs/aufs/super.h      2013-08-23 23:59:39.638250372 +0200
+@@ -0,0 +1,559 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -23962,6 +25219,20 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +      unsigned long long      mfsrr_watermark;
 +};
 +
++struct pseudo_link {
++      union {
++              struct hlist_node hlist;
++              struct rcu_head rcu;
++      };
++      struct inode *inode;
++};
++
++#define AuPlink_NHASH 100
++static inline int au_plink_hash(ino_t ino)
++{
++      return ino % AuPlink_NHASH;
++}
++
 +struct au_branch;
 +struct au_sbinfo {
 +      /* nowait tasks in the system-wide workqueue */
@@ -24052,7 +25323,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +      /* int                  si_rendir; */
 +
 +      /* pseudo_link list */
-+      struct au_splhead       si_plink;
++      struct au_sphlhead      si_plink[AuPlink_NHASH];
 +      wait_queue_head_t       si_plink_wq;
 +      spinlock_t              si_plink_maint_lock;
 +      pid_t                   si_plink_maint_pid;
@@ -24065,7 +25336,9 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +       */
 +      struct kobject          si_kobj;
 +#ifdef CONFIG_DEBUG_FS
-+      struct dentry            *si_dbgaufs, *si_dbgaufs_xib;
++      struct dentry            *si_dbgaufs;
++      struct dentry            *si_dbgaufs_plink;
++      struct dentry            *si_dbgaufs_xib;
 +#ifdef CONFIG_AUFS_EXPORT
 +      struct dentry            *si_dbgaufs_xigen;
 +#endif
@@ -24162,6 +25435,10 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +extern struct au_wbr_copyup_operations au_wbr_copyup_ops[];
 +extern struct au_wbr_create_operations au_wbr_create_ops[];
 +int au_cpdown_dirs(struct dentry *dentry, aufs_bindex_t bdst);
++int au_wbr_nonopq(struct dentry *dentry, aufs_bindex_t bindex);
++
++/* mvdown.c */
++int au_mvdown(struct dentry *dentry, struct aufs_mvdown __user *arg);
 +
 +/* ---------------------------------------------------------------------- */
 +
@@ -24256,6 +25533,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +      /* AuRwMustWriteLock(&sbinfo->si_rwsem); */
 +#ifdef CONFIG_DEBUG_FS
 +      sbinfo->si_dbgaufs = NULL;
++      sbinfo->si_dbgaufs_plink = NULL;
 +      sbinfo->si_dbgaufs_xib = NULL;
 +#ifdef CONFIG_AUFS_EXPORT
 +      sbinfo->si_dbgaufs_xigen = NULL;
@@ -24445,7 +25723,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +#endif /* __AUFS_SUPER_H__ */
 diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 --- /usr/share/empty/fs/aufs/sysaufs.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysaufs.c    2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/sysaufs.c    2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,105 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -24554,7 +25832,7 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h
 --- /usr/share/empty/fs/aufs/sysaufs.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysaufs.h    2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/sysaufs.h    2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,104 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -24662,7 +25940,7 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h
 +#endif /* __SYSAUFS_H__ */
 diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 --- /usr/share/empty/fs/aufs/sysfs.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysfs.c      2013-02-19 08:40:03.950226347 +0100
++++ linux/fs/aufs/sysfs.c      2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,257 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -24758,7 +26036,7 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 +      root = sb->s_root;
 +      di_read_lock_parent(root, !AuLock_IR);
 +      br = au_sbr(sb, bindex);
-+      path.mnt = br->br_mnt;
++      path.mnt = au_br_mnt(br);
 +      path.dentry = au_h_dptr(root, bindex);
 +      au_seq_path(seq, &path);
 +      di_read_unlock(root, !AuLock_IR);
@@ -24923,7 +26201,7 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 +}
 diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c
 --- /usr/share/empty/fs/aufs/sysrq.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/sysrq.c      2013-07-01 12:54:21.042826542 +0200
++++ linux/fs/aufs/sysrq.c      2013-07-06 13:20:47.753531903 +0200
 @@ -0,0 +1,151 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -25078,7 +26356,7 @@ diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 --- /usr/share/empty/fs/aufs/vdir.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vdir.c       2013-07-01 12:54:18.776081600 +0200
++++ linux/fs/aufs/vdir.c       2013-07-30 22:42:55.842946719 +0200
 @@ -0,0 +1,878 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -25960,7 +27238,7 @@ diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 --- /usr/share/empty/fs/aufs/vfsub.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.c      2013-07-01 12:54:21.042826542 +0200
++++ linux/fs/aufs/vfsub.c      2013-07-30 22:42:55.842946719 +0200
 @@ -0,0 +1,769 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -26733,8 +28011,8 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +}
 diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 --- /usr/share/empty/fs/aufs/vfsub.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.h      2013-07-01 12:54:21.042826542 +0200
-@@ -0,0 +1,307 @@
++++ linux/fs/aufs/vfsub.h      2013-07-30 22:42:55.842946719 +0200
+@@ -0,0 +1,294 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -26840,19 +28118,6 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 +
 +/* ---------------------------------------------------------------------- */
 +
-+/* cf. i_[ug]id_read() in linux/include/fs.h */
-+static inline uid_t vfsub_ia_uid(struct iattr *ia)
-+{
-+      return from_kuid(&init_user_ns, ia->ia_uid);
-+}
-+
-+static inline gid_t vfsub_ia_gid(struct iattr *ia)
-+{
-+      return from_kgid(&init_user_ns, ia->ia_gid);
-+}
-+
-+/* ---------------------------------------------------------------------- */
-+
 +int vfsub_update_h_iattr(struct path *h_path, int *did);
 +struct file *vfsub_dentry_open(struct path *path, int flags);
 +struct file *vfsub_filp_open(const char *path, int oflags, int mode);
@@ -27044,8 +28309,8 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
 +#endif /* __AUFS_VFSUB_H__ */
 diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 --- /usr/share/empty/fs/aufs/wbr_policy.c      1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wbr_policy.c 2013-02-19 08:40:03.953559833 +0100
-@@ -0,0 +1,700 @@
++++ linux/fs/aufs/wbr_policy.c 2013-08-23 23:59:39.638250372 +0200
+@@ -0,0 +1,693 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -27085,7 +28350,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +      ia.ia_uid = h_isrc->i_uid;
 +      ia.ia_gid = h_isrc->i_gid;
 +      sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID));
-+      au_cpup_attr_flags(h_path->dentry->d_inode, h_isrc);
++      au_cpup_attr_flags(h_path->dentry->d_inode, h_isrc->i_flags);
 +      err = vfsub_sio_notify_change(h_path, &ia);
 +
 +      /* is this nfs only? */
@@ -27108,13 +28373,8 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +#define au_fclr_cpdown(flags, name) \
 +      do { (flags) &= ~AuCpdown_##name; } while (0)
 +
-+struct au_cpdown_dir_args {
-+      struct dentry *parent;
-+      unsigned int flags;
-+};
-+
 +static int au_cpdown_dir_opq(struct dentry *dentry, aufs_bindex_t bdst,
-+                           struct au_cpdown_dir_args *a)
++                           unsigned int *flags)
 +{
 +      int err;
 +      struct dentry *opq_dentry;
@@ -27124,7 +28384,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +      if (IS_ERR(opq_dentry))
 +              goto out;
 +      dput(opq_dentry);
-+      au_fset_cpdown(a->flags, DIROPQ);
++      au_fset_cpdown(*flags, DIROPQ);
 +
 +out:
 +      return err;
@@ -27145,7 +28405,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +
 +      err = 0;
 +      if (h_path.dentry->d_inode) {
-+              h_path.mnt = br->br_mnt;
++              h_path.mnt = au_br_mnt(br);
 +              err = au_wh_unlink_dentry(au_h_iptr(dir, bdst), &h_path,
 +                                        dentry);
 +      }
@@ -27156,6 +28416,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +}
 +
 +static int au_cpdown_dir(struct dentry *dentry, aufs_bindex_t bdst,
++                       struct au_pin *pin,
 +                       struct dentry *h_parent, void *arg)
 +{
 +      int err, rerr;
@@ -27163,7 +28424,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +      struct path h_path;
 +      struct dentry *parent;
 +      struct inode *h_dir, *h_inode, *inode, *dir;
-+      struct au_cpdown_dir_args *args = arg;
++      unsigned int *flags = arg;
 +
 +      bstart = au_dbstart(dentry);
 +      /* dentry is di-locked */
@@ -27173,7 +28434,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +      AuDebugOn(h_dir != au_h_iptr(dir, bdst));
 +      IMustLock(h_dir);
 +
-+      err = au_lkup_neg(dentry, bdst);
++      err = au_lkup_neg(dentry, bdst, /*wh*/0);
 +      if (unlikely(err < 0))
 +              goto out;
 +      h_path.dentry = au_h_dptr(dentry, bdst);
@@ -27182,19 +28443,19 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +                            S_IRWXU | S_IRUGO | S_IXUGO);
 +      if (unlikely(err))
 +              goto out_put;
-+      au_fset_cpdown(args->flags, MADE_DIR);
++      au_fset_cpdown(*flags, MADE_DIR);
 +
 +      bopq = au_dbdiropq(dentry);
-+      au_fclr_cpdown(args->flags, WHED);
-+      au_fclr_cpdown(args->flags, DIROPQ);
++      au_fclr_cpdown(*flags, WHED);
++      au_fclr_cpdown(*flags, DIROPQ);
 +      if (au_dbwh(dentry) == bdst)
-+              au_fset_cpdown(args->flags, WHED);
-+      if (!au_ftest_cpdown(args->flags, PARENT_OPQ) && bopq <= bdst)
-+              au_fset_cpdown(args->flags, PARENT_OPQ);
++              au_fset_cpdown(*flags, WHED);
++      if (!au_ftest_cpdown(*flags, PARENT_OPQ) && bopq <= bdst)
++              au_fset_cpdown(*flags, PARENT_OPQ);
 +      h_inode = h_path.dentry->d_inode;
 +      mutex_lock_nested(&h_inode->i_mutex, AuLsc_I_CHILD);
-+      if (au_ftest_cpdown(args->flags, WHED)) {
-+              err = au_cpdown_dir_opq(dentry, bdst, args);
++      if (au_ftest_cpdown(*flags, WHED)) {
++              err = au_cpdown_dir_opq(dentry, bdst, flags);
 +              if (unlikely(err)) {
 +                      mutex_unlock(&h_inode->i_mutex);
 +                      goto out_dir;
@@ -27206,7 +28467,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +      if (unlikely(err))
 +              goto out_opq;
 +
-+      if (au_ftest_cpdown(args->flags, WHED)) {
++      if (au_ftest_cpdown(*flags, WHED)) {
 +              err = au_cpdown_dir_wh(dentry, h_parent, dir, bdst);
 +              if (unlikely(err))
 +                      goto out_opq;
@@ -27221,7 +28482,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +
 +      /* revert */
 +out_opq:
-+      if (au_ftest_cpdown(args->flags, DIROPQ)) {
++      if (au_ftest_cpdown(*flags, DIROPQ)) {
 +              mutex_lock_nested(&h_inode->i_mutex, AuLsc_I_CHILD);
 +              rerr = au_diropq_remove(dentry, bdst);
 +              mutex_unlock(&h_inode->i_mutex);
@@ -27233,7 +28494,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +              }
 +      }
 +out_dir:
-+      if (au_ftest_cpdown(args->flags, MADE_DIR)) {
++      if (au_ftest_cpdown(*flags, MADE_DIR)) {
 +              rerr = vfsub_sio_rmdir(au_h_iptr(dir, bdst), &h_path);
 +              if (unlikely(rerr)) {
 +                      AuIOErr("failed removing %.*s b%d (%d)\n",
@@ -27253,13 +28514,10 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +int au_cpdown_dirs(struct dentry *dentry, aufs_bindex_t bdst)
 +{
 +      int err;
-+      struct au_cpdown_dir_args args = {
-+              .parent = dget_parent(dentry),
-+              .flags  = 0
-+      };
++      unsigned int flags;
 +
-+      err = au_cp_dirs(dentry, bdst, au_cpdown_dir, &args);
-+      dput(args.parent);
++      flags = 0;
++      err = au_cp_dirs(dentry, bdst, au_cpdown_dir, &flags);
 +
 +      return err;
 +}
@@ -27268,7 +28526,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +
 +/* policies for create */
 +
-+static int au_wbr_nonopq(struct dentry *dentry, aufs_bindex_t bindex)
++int au_wbr_nonopq(struct dentry *dentry, aufs_bindex_t bindex)
 +{
 +      int err, i, j, ndentry;
 +      aufs_bindex_t bopq;
@@ -27479,7 +28737,7 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +                      continue;
 +
 +              /* sb->s_root for NFS is unreliable */
-+              h_path.mnt = br->br_mnt;
++              h_path.mnt = au_br_mnt(br);
 +              h_path.dentry = h_path.mnt->mnt_root;
 +              err = vfs_statfs(&h_path, st);
 +              if (unlikely(err)) {
@@ -27748,8 +29006,8 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c
 +};
 diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 --- /usr/share/empty/fs/aufs/whout.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.c      2013-07-01 12:54:18.776081600 +0200
-@@ -0,0 +1,1041 @@
++++ linux/fs/aufs/whout.c      2013-07-06 13:20:47.760198800 +0200
+@@ -0,0 +1,1022 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -27926,7 +29184,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +{
 +      int err;
 +      struct path h_path = {
-+              .mnt = br->br_mnt
++              .mnt = au_br_mnt(br)
 +      };
 +      struct inode *h_dir;
 +      struct dentry *h_parent;
@@ -27985,7 +29243,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +{
 +      int err;
 +      struct path h_path = {
-+              .mnt = br->br_mnt
++              .mnt = au_br_mnt(br)
 +      };
 +
 +      err = 0;
@@ -28015,14 +29273,10 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      if (!whpath->dentry->d_inode)
 +              return;
 +
-+      err = vfsub_mnt_want_write(whpath->mnt);
-+      if (!err) {
-+              if (isdir)
-+                      err = vfsub_rmdir(h_dir, whpath);
-+              else
-+                      err = vfsub_unlink(h_dir, whpath, /*force*/0);
-+              vfsub_mnt_drop_write(whpath->mnt);
-+      }
++      if (isdir)
++              err = vfsub_rmdir(h_dir, whpath);
++      else
++              err = vfsub_unlink(h_dir, whpath, /*force*/0);
 +      if (unlikely(err))
 +              pr_warn("failed removing %.*s (%d), ignored.\n",
 +                      AuDLNPair(whpath->dentry), err);
@@ -28051,11 +29305,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +
 +              if (au_test_nfs(path->dentry->d_sb))
 +                      mode |= S_IXUGO;
-+              err = vfsub_mnt_want_write(path->mnt);
-+              if (!err) {
-+                      err = vfsub_mkdir(h_dir, path, mode);
-+                      vfsub_mnt_drop_write(path->mnt);
-+              }
++              err = vfsub_mkdir(h_dir, path, mode);
 +      } else if (S_ISDIR(path->dentry->d_inode->i_mode))
 +              err = 0;
 +      else
@@ -28149,13 +29399,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      err = -EEXIST;
 +      h_dir = h_root->d_inode;
 +      if (!base[AuBrWh_BASE].dentry->d_inode) {
-+              err = vfsub_mnt_want_write(h_path->mnt);
-+              if (!err) {
-+                      h_path->dentry = base[AuBrWh_BASE].dentry;
-+                      err = vfsub_create(h_dir, h_path, WH_MASK,
-+                                         /*want_excl*/true);
-+                      vfsub_mnt_drop_write(h_path->mnt);
-+              }
++              h_path->dentry = base[AuBrWh_BASE].dentry;
++              err = vfsub_create(h_dir, h_path, WH_MASK, /*want_excl*/true);
 +      } else if (S_ISREG(base[AuBrWh_BASE].dentry->d_inode->i_mode))
 +              err = 0;
 +      else
@@ -28187,16 +29432,14 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +/*
 + * initialize the whiteout base file/dir for @br.
 + */
-+int au_wh_init(struct dentry *h_root, struct au_branch *br,
-+             struct super_block *sb)
++int au_wh_init(struct au_branch *br, struct super_block *sb)
 +{
 +      int err, i;
 +      const unsigned char do_plink
 +              = !!au_opt_test(au_mntflags(sb), PLINK);
-+      struct path path = {
-+              .mnt = br->br_mnt
-+      };
 +      struct inode *h_dir;
++      struct path path = br->br_path;
++      struct dentry *h_root = path.dentry;
 +      struct au_wbr *wbr = br->br_wbr;
 +      static const struct qstr base_name[] = {
 +              [AuBrWh_BASE] = QSTR_INIT(AUFS_BASE_NAME,
@@ -28310,19 +29553,16 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      dir = a->sb->s_root->d_inode;
 +      hdir = au_hi(dir, bindex);
 +      h_root = au_h_dptr(a->sb->s_root, bindex);
++      AuDebugOn(h_root != au_br_dentry(a->br));
 +
 +      au_hn_imtx_lock_nested(hdir, AuLsc_I_PARENT);
 +      wbr_wh_write_lock(wbr);
 +      err = au_h_verify(wbr->wbr_whbase, au_opt_udba(a->sb), hdir->hi_inode,
 +                        h_root, a->br);
 +      if (!err) {
-+              err = vfsub_mnt_want_write(a->br->br_mnt);
-+              if (!err) {
-+                      h_path.dentry = wbr->wbr_whbase;
-+                      h_path.mnt = a->br->br_mnt;
-+                      err = vfsub_unlink(hdir->hi_inode, &h_path, /*force*/0);
-+                      vfsub_mnt_drop_write(a->br->br_mnt);
-+              }
++              h_path.dentry = wbr->wbr_whbase;
++              h_path.mnt = au_br_mnt(a->br);
++              err = vfsub_unlink(hdir->hi_inode, &h_path, /*force*/0);
 +      } else {
 +              pr_warn("%.*s is moved, ignored\n",
 +                      AuDLNPair(wbr->wbr_whbase));
@@ -28331,7 +29571,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      dput(wbr->wbr_whbase);
 +      wbr->wbr_whbase = NULL;
 +      if (!err)
-+              err = au_wh_init(h_root, a->br, a->sb);
++              err = au_wh_init(a->br, a->sb);
 +      wbr_wh_write_unlock(wbr);
 +      au_hn_imtx_unlock(hdir);
 +      di_read_unlock(a->sb->s_root, AuLock_IR);
@@ -28402,7 +29642,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      IMustLock(h_dir);
 +
 +      br = au_sbr(sb, bindex);
-+      h_path.mnt = br->br_mnt;
++      h_path.mnt = au_br_mnt(br);
 +      wbr = br->br_wbr;
 +      wbr_wh_read_lock(wbr);
 +      if (wbr->wbr_whbase) {
@@ -28451,7 +29691,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      } else {
 +              struct path tmp = {
 +                      .dentry = opq_dentry,
-+                      .mnt    = br->br_mnt
++                      .mnt    = au_br_mnt(br)
 +              };
 +              err = do_unlink_wh(au_h_iptr(dentry->d_inode, bindex), &tmp);
 +              if (!err)
@@ -28702,7 +29942,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +
 +      if (!err) {
 +              h_tmp.dentry = wh_dentry;
-+              h_tmp.mnt = br->br_mnt;
++              h_tmp.mnt = au_br_mnt(br);
 +              err = vfsub_rmdir(h_dir, &h_tmp);
 +      }
 +
@@ -28746,21 +29986,20 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +      h_parent = dget_parent(a->wh_dentry);
 +      h_dir = h_parent->d_inode;
 +      hdir = au_hi(a->dir, bindex);
++      err = vfsub_mnt_want_write(au_br_mnt(a->br));
++      if (unlikely(err))
++              goto out_mnt;
 +      au_hn_imtx_lock_nested(hdir, AuLsc_I_PARENT);
 +      err = au_h_verify(a->wh_dentry, au_opt_udba(sb), h_dir, h_parent,
 +                        a->br);
-+      if (!err) {
-+              err = vfsub_mnt_want_write(a->br->br_mnt);
-+              if (!err) {
-+                      err = au_whtmp_rmdir(a->dir, bindex, a->wh_dentry,
-+                                           &a->whlist);
-+                      vfsub_mnt_drop_write(a->br->br_mnt);
-+              }
-+      }
++      if (!err)
++              err = au_whtmp_rmdir(a->dir, bindex, a->wh_dentry, &a->whlist);
 +      au_hn_imtx_unlock(hdir);
++      vfsub_mnt_drop_write(au_br_mnt(a->br));
++
++out_mnt:
 +      dput(h_parent);
 +      ii_write_unlock(a->dir);
-+
 +out:
 +      /* mutex_unlock(&a->dir->i_mutex); */
 +      au_whtmp_rmdir_free(a);
@@ -28793,8 +30032,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
 +}
 diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 --- /usr/share/empty/fs/aufs/whout.h   1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.h      2013-02-19 08:40:03.953559833 +0100
-@@ -0,0 +1,88 @@
++++ linux/fs/aufs/whout.h      2013-07-06 13:20:47.760198800 +0200
+@@ -0,0 +1,87 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -28835,8 +30074,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 +int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br);
 +int au_wh_unlink_dentry(struct inode *h_dir, struct path *h_path,
 +                      struct dentry *dentry);
-+int au_wh_init(struct dentry *h_parent, struct au_branch *br,
-+             struct super_block *sb);
++int au_wh_init(struct au_branch *br, struct super_block *sb);
 +
 +/* diropq flags */
 +#define AuDiropq_CREATE       1
@@ -28885,8 +30123,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
 +#endif /* __AUFS_WHOUT_H__ */
 diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 --- /usr/share/empty/fs/aufs/wkq.c     1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wkq.c        2013-02-19 08:40:03.953559833 +0100
-@@ -0,0 +1,214 @@
++++ linux/fs/aufs/wkq.c        2013-08-23 23:59:39.638250372 +0200
+@@ -0,0 +1,213 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -28951,7 +30189,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 +/*
 + * Since struct completion is large, try allocating it dynamically.
 + */
-+#if defined(CONFIG_4KSTACKS) || defined(AuTest4KSTACKS)
++#if 1 /* defined(CONFIG_4KSTACKS) || defined(AuTest4KSTACKS) */
 +#define AuWkqCompDeclare(name)        struct completion *comp = NULL
 +
 +static int au_wkq_comp_alloc(struct au_wkinfo *wkinfo, struct completion **comp)
@@ -29092,8 +30330,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 +      int err;
 +
 +      err = 0;
-+      BUILD_BUG_ON(!WQ_RESCUER);
-+      au_wkq = alloc_workqueue(AUFS_WKQ_NAME, !WQ_RESCUER, WQ_DFL_ACTIVE);
++      au_wkq = alloc_workqueue(AUFS_WKQ_NAME, 0, WQ_DFL_ACTIVE);
 +      if (IS_ERR(au_wkq))
 +              err = PTR_ERR(au_wkq);
 +      else if (!au_wkq)
@@ -29103,7 +30340,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c
 +}
 diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 --- /usr/share/empty/fs/aufs/wkq.h     1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/wkq.h        2013-02-19 08:40:03.953559833 +0100
++++ linux/fs/aufs/wkq.h        2013-07-06 13:20:47.760198800 +0200
 @@ -0,0 +1,92 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -29199,7 +30436,7 @@ diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 +#endif /* __AUFS_WKQ_H__ */
 diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 --- /usr/share/empty/fs/aufs/xino.c    1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xino.c       2013-07-01 12:54:18.782748496 +0200
++++ linux/fs/aufs/xino.c       2013-07-06 13:20:47.760198800 +0200
 @@ -0,0 +1,1264 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
@@ -29471,12 +30708,12 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +      fput(file);
 +      br->br_xino.xi_file = new_xino;
 +
-+      h_sb = br->br_mnt->mnt_sb;
++      h_sb = au_br_sb(br);
 +      for (bi = 0; bi <= bend; bi++) {
 +              if (unlikely(bi == bindex))
 +                      continue;
 +              br = au_sbr(sb, bi);
-+              if (br->br_mnt->mnt_sb != h_sb)
++              if (au_br_sb(br) != h_sb)
 +                      continue;
 +
 +              fput(br->br_xino.xi_file);
@@ -29611,7 +30848,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +                             h_ino, ino);
 +      if (!err) {
 +              if (au_opt_test(mnt_flags, TRUNC_XINO)
-+                  && au_test_fs_trunc_xino(br->br_mnt->mnt_sb))
++                  && au_test_fs_trunc_xino(au_br_sb(br)))
 +                      xino_try_trunc(sb, br);
 +              return 0; /* success */
 +      }
@@ -29764,7 +31001,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +              err = au_xino_do_write(xwrite, br->br_xino.xi_file,
 +                                     h_inode->i_ino, /*ino*/0);
 +              if (!err && try_trunc
-+                  && au_test_fs_trunc_xino(br->br_mnt->mnt_sb))
++                  && au_test_fs_trunc_xino(au_br_sb(br)))
 +                      xino_try_trunc(sb, br);
 +      }
 +}
@@ -29971,10 +31208,10 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +      shared_br = NULL;
 +      bend = au_sbend(sb);
 +      if (do_test) {
-+              tgt_sb = br->br_mnt->mnt_sb;
++              tgt_sb = au_br_sb(br);
 +              for (bindex = 0; bindex <= bend; bindex++) {
 +                      b = au_sbr(sb, bindex);
-+                      if (tgt_sb == b->br_mnt->mnt_sb) {
++                      if (tgt_sb == au_br_sb(b)) {
 +                              shared_br = b;
 +                              break;
 +                      }
@@ -30403,7 +31640,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +      for (bindex = 0; bindex <= bend; bindex++) {
 +              br = au_sbr(sb, bindex);
 +              if (au_br_writable(br->br_perm)
-+                  && !au_test_fs_bad_xino(br->br_mnt->mnt_sb)) {
++                  && !au_test_fs_bad_xino(au_br_sb(br))) {
 +                      bwr = bindex;
 +                      break;
 +              }
@@ -30414,7 +31651,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +              page = (void *)__get_free_page(GFP_NOFS);
 +              if (unlikely(!page))
 +                      goto out;
-+              path.mnt = br->br_mnt;
++              path.mnt = au_br_mnt(br);
 +              path.dentry = au_h_dptr(sb->s_root, bwr);
 +              p = d_path(&path, page, PATH_MAX - sizeof(AUFS_XINO_FNAME));
 +              file = (void *)p;
@@ -30467,7 +31704,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +}
 diff -urN /usr/share/empty/include/linux/aufs_type.h linux/include/linux/aufs_type.h
 --- /usr/share/empty/include/linux/aufs_type.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/linux/aufs_type.h    2013-02-19 08:40:03.953559833 +0100
++++ linux/include/linux/aufs_type.h    2013-07-06 13:20:47.760198800 +0200
 @@ -0,0 +1,19 @@
 +/*
 + * Copyright (C) 2012-2013 Junjiro R. Okajima
@@ -30490,8 +31727,8 @@ diff -urN /usr/share/empty/include/linux/aufs_type.h linux/include/linux/aufs_ty
 +#include <uapi/linux/aufs_type.h>
 diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/linux/aufs_type.h
 --- /usr/share/empty/include/uapi/linux/aufs_type.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/uapi/linux/aufs_type.h       2013-07-01 12:54:21.042826542 +0200
-@@ -0,0 +1,234 @@
++++ linux/include/uapi/linux/aufs_type.h       2013-08-23 23:59:39.638250372 +0200
+@@ -0,0 +1,251 @@
 +/*
 + * Copyright (C) 2005-2013 Junjiro R. Okajima
 + *
@@ -30534,7 +31771,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +
 +#include <linux/limits.h>
 +
-+#define AUFS_VERSION  "3.x-rcN-20130325"
++#define AUFS_VERSION  "3.10-20130819"
 +
 +/* todo? move this to linux-2.6.19/include/magic.h */
 +#define AUFS_SUPER_MAGIC      ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
@@ -30571,7 +31808,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +#define AUFS_WH_PFX           ".wh."
 +#define AUFS_WH_PFX_LEN               ((int)sizeof(AUFS_WH_PFX) - 1)
 +#define AUFS_WH_TMP_LEN               4
-+/* a limit for rmdir/rename a dir */
++/* a limit for rmdir/rename a dir and copyup */
 +#define AUFS_MAX_NAMELEN      (NAME_MAX \
 +                              - AUFS_WH_PFX_LEN * 2   /* doubly whiteouted */\
 +                              - 1                     /* dot */\
@@ -30588,7 +31825,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +#define AUFS_WKQ_NAME         AUFS_NAME "d"
 +#define AUFS_MFS_DEF_SEC      30 /* seconds */
 +#define AUFS_MFS_MAX_SEC      3600 /* seconds */
-+#define AUFS_PLINK_WARN               100 /* number of plinks */
++#define AUFS_PLINK_WARN               50 /* number of plinks in a single bucket */
 +
 +/* pseudo-link maintenace under /proc */
 +#define AUFS_PLINK_MAINT_NAME "plink_maint"
@@ -30613,6 +31850,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +#define AUFS_BRPERM_RR                "rr"
 +#define AUFS_BRRATTR_WH               "wh"
 +#define AUFS_BRWATTR_NLWH     "nolwh"
++#define AUFS_BRATTR_UNPIN     "unpin"
 +
 +/* ---------------------------------------------------------------------- */
 +
@@ -30626,7 +31864,10 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +      AuCtl_WBR_FD,
 +
 +      /* busy inode */
-+      AuCtl_IBUSY
++      AuCtl_IBUSY,
++
++      /* move-down */
++      AuCtl_MVDOWN
 +};
 +
 +/* borrowed from linux/include/linux/kernel.h */
@@ -30718,11 +31959,24 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +
 +/* ---------------------------------------------------------------------- */
 +
++/* flags for move-down */
++#define AUFS_MVDOWN_VERBOSE   1
++/* will be added more */
++
++struct aufs_mvdown {
++      uint8_t         flags;
++      /* will be added more */
++} __aligned(8);
++
++/* ---------------------------------------------------------------------- */
++
 +#define AuCtlType             'A'
 +#define AUFS_CTL_RDU          _IOWR(AuCtlType, AuCtl_RDU, struct aufs_rdu)
 +#define AUFS_CTL_RDU_INO      _IOWR(AuCtlType, AuCtl_RDU_INO, struct aufs_rdu)
 +#define AUFS_CTL_WBR_FD               _IOW(AuCtlType, AuCtl_WBR_FD, \
 +                                   struct aufs_wbr_fd)
 +#define AUFS_CTL_IBUSY                _IOWR(AuCtlType, AuCtl_IBUSY, struct aufs_ibusy)
++#define AUFS_CTL_MVDOWN               _IOR(AuCtlType, AuCtl_MVDOWN, \
++                                   struct aufs_mvdown)
 +
 +#endif /* __AUFS_TYPE_H__ */
This page took 0.40928 seconds and 4 git commands to generate.