[packages/kernel] - up to 4.17.8

arekm arekm at pld-linux.org
Thu Jul 19 11:28:52 CEST 2018


commit 062440b31b215805734b824f7d36320744b6dda8
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Jul 19 11:28:43 2018 +0200

    - up to 4.17.8

 kernel-aufs4.patch | 2321 +++++++++++++++++++++++++++++-----------------------
 kernel.spec        |    4 +-
 2 files changed, 1292 insertions(+), 1033 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index de51ce1c..3e714642 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -69,7 +69,7 @@
 
 %define		rel		1
 %define		basever		4.17
-%define		postver		.6
+%define		postver		.8
 
 # define this to '-%{basever}' for longterm branch
 %define		versuffix	%{nil}
@@ -121,7 +121,7 @@ Source0:	https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{basever}.tar.xz
 # Source0-md5:	5bb13a03274b66b56c85b26682e407d7
 %if "%{postver}" != ".0"
 Patch0:		https://www.kernel.org/pub/linux/kernel/v4.x/patch-%{version}.xz
-# Patch0-md5:	61f796237d1b137c5ce707cb308950d4
+# Patch0-md5:	21cd29cb136dc6cd15187cab4d5f77cd
 %endif
 Source1:	kernel.sysconfig
 
diff --git a/kernel-aufs4.patch b/kernel-aufs4.patch
index aa18fc29..be2b4fca 100644
--- a/kernel-aufs4.patch
+++ b/kernel-aufs4.patch
@@ -662,12 +662,12 @@ index 1372373..6362dde 100644
  
 diff --git a/mm/prfile.c b/mm/prfile.c
 new file mode 100644
-index 0000000..14efc4f
+index 0000000..37e95e1
 --- /dev/null
 +++ b/mm/prfile.c
 @@ -0,0 +1,86 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
-+ * SPDX-License-Identifier: GPL-2.0
 + * Mainly for aufs which mmap(2) different file and wants to print different
 + * path in /proc/PID/maps.
 + * Call these functions via macros defined in linux/mm.h.
@@ -1190,8 +1190,8 @@ index 7bc2fde..6bd0468 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	2017-07-29 12:14:25.893041746 +0200
-@@ -0,0 +1,50 @@
++++ linux/Documentation/ABI/testing/debugfs-aufs	2018-07-19 09:46:13.053314374 +0200
+@@ -0,0 +1,55 @@
 +What:		/debug/aufs/si_<id>/
 +Date:		March 2009
 +Contact:	J. R. Okajima <hooanon05g at gmail.com>
@@ -1222,15 +1222,20 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document
 +		When the aufs mount option 'noxino' is specified, it
 +		will be empty. About XINO files, see the aufs manual.
 +
-+What:		/debug/aufs/si_<id>/xino0, xino1 ... xinoN
++What:		/debug/aufs/si_<id>/xi0, xi1 ... xiN and xiN-N
 +Date:		March 2009
 +Contact:	J. R. Okajima <hooanon05g at gmail.com>
 +Description:
 +		It shows the consumed blocks by xino (External Inode Number
 +		Translation Table), its link count, block size and file
 +		size.
-+		When the aufs mount option 'noxino' is specified, it
-+		will be empty. About XINO files, see the aufs manual.
++		Due to the file size limit, there may exist multiple
++		xino files per branch.  In this case, "-N" is added to
++		the filename and it corresponds to the index of the
++		internal xino array.  "-0" is omitted.
++		When the aufs mount option 'noxino' is specified, Those
++		entries won't exist.  About XINO files, see the aufs
++		manual.
 +
 +What:		/debug/aufs/si_<id>/xigen
 +Date:		March 2009
@@ -3075,8 +3080,9 @@ 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	2018-04-15 08:49:13.394483860 +0200
-@@ -0,0 +1,60 @@
++++ linux/fs/aufs/aufs.h	2018-07-19 09:46:13.053314374 +0200
+@@ -0,0 +1,61 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -3139,8 +3145,9 @@ 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	2018-04-15 08:49:13.394483860 +0200
-@@ -0,0 +1,1432 @@
++++ linux/fs/aufs/branch.c	2018-07-19 09:46:13.053314374 +0200
+@@ -0,0 +1,1422 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -3178,12 +3185,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	au_hnotify_fin_br(br);
 +	/* always, regardless the mount option */
 +	au_dr_hino_free(&br->br_dirren);
-+
-+	if (br->br_xino.xi_file)
-+		fput(br->br_xino.xi_file);
-+	for (i = br->br_xino.xi_nondir.total - 1; i >= 0; i--)
-+		AuDebugOn(br->br_xino.xi_nondir.array[i]);
-+	kfree(br->br_xino.xi_nondir.array);
++	au_xino_put(br);
 +
 +	AuDebugOn(au_br_count(br));
 +	au_br_count_fin(br);
@@ -3280,16 +3282,12 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	add_branch = kzalloc(sizeof(*add_branch), GFP_NOFS);
 +	if (unlikely(!add_branch))
 +		goto out;
-+	add_branch->br_xino.xi_nondir.total = 8; /* initial size */
-+	add_branch->br_xino.xi_nondir.array
-+		= kcalloc(add_branch->br_xino.xi_nondir.total, sizeof(ino_t),
-+			  GFP_NOFS);
-+	if (unlikely(!add_branch->br_xino.xi_nondir.array))
++	add_branch->br_xino = au_xino_alloc();
++	if (unlikely(!add_branch->br_xino))
 +		goto out_br;
-+
 +	err = au_hnotify_init_br(add_branch, perm);
 +	if (unlikely(err))
-+		goto out_xinondir;
++		goto out_xino;
 +
 +	if (au_br_writable(perm)) {
 +		/* may be freed separately at changing the branch permission */
@@ -3321,8 +3319,8 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	kfree(add_branch->br_wbr);
 +out_hnotify:
 +	au_hnotify_fin_br(add_branch);
-+out_xinondir:
-+	kfree(add_branch->br_xino.xi_nondir.array);
++out_xino:
++	au_xino_put(add_branch);
 +out_br:
 +	kfree(add_branch);
 +out:
@@ -3533,16 +3531,15 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		      struct au_opt_add *add)
 +{
 +	int err;
++	struct au_branch *brbase;
++	struct file *xf;
 +	struct inode *h_inode;
 +
 +	err = 0;
-+	spin_lock_init(&br->br_xino.xi_nondir.spin);
-+	init_waitqueue_head(&br->br_xino.xi_nondir.wqh);
 +	br->br_perm = add->perm;
 +	br->br_path = add->path; /* set first, path_get() later */
 +	spin_lock_init(&br->br_dykey_lock);
 +	au_br_count_init(br);
-+	atomic_set(&br->br_xino_running, 0);
 +	br->br_id = au_new_br_id(sb);
 +	AuDebugOn(br->br_id < 0);
 +
@@ -3558,11 +3555,13 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	}
 +
 +	if (au_opt_test(au_mntflags(sb), XINO)) {
++		brbase = au_sbr(sb, 0);
++		xf = au_xino_file(brbase);
++		AuDebugOn(!xf);
 +		h_inode = d_inode(add->path.dentry);
-+		err = au_xino_br(sb, br, h_inode->i_ino,
-+				 au_sbr(sb, 0)->br_xino.xi_file, /*do_test*/1);
++		err = au_xino_init_br(sb, br, h_inode->i_ino, &xf->f_path);
 +		if (unlikely(err)) {
-+			AuDebugOn(br->br_xino.xi_file);
++			AuDebugOn(au_xino_file(br));
 +			goto out_err;
 +		}
 +	}
@@ -3652,6 +3651,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	struct dentry *root, *h_dentry;
 +	struct inode *root_inode;
 +	struct au_branch *add_branch;
++	struct file *xf;
 +
 +	root = sb->s_root;
 +	root_inode = d_inode(root);
@@ -3678,13 +3678,10 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +	}
 +
 +	add_bindex = add->bindex;
-+	if (!remount)
-+		au_br_do_add(sb, add_branch, add_bindex);
-+	else {
-+		sysaufs_brs_del(sb, add_bindex);
-+		au_br_do_add(sb, add_branch, add_bindex);
-+		sysaufs_brs_add(sb, add_bindex);
-+	}
++	sysaufs_brs_del(sb, add_bindex);	/* remove successors */
++	au_br_do_add(sb, add_branch, add_bindex);
++	sysaufs_brs_add(sb, add_bindex);	/* append successors */
++	dbgaufs_brs_add(sb, add_bindex, /*topdown*/0);	/* rename successors */
 +
 +	h_dentry = add->path.dentry;
 +	if (!add_bindex) {
@@ -3694,16 +3691,17 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		au_add_nlink(root_inode, d_inode(h_dentry));
 +
 +	/*
-+	 * this test/set prevents aufs from handling unnecesary notify events
++	 * this test/set prevents aufs from handling unnecessary notify events
 +	 * of xino files, in case of re-adding a writable branch which was
 +	 * once detached from aufs.
 +	 */
 +	if (au_xino_brid(sb) < 0
 +	    && au_br_writable(add_branch->br_perm)
-+	    && !au_test_fs_bad_xino(h_dentry->d_sb)
-+	    && add_branch->br_xino.xi_file
-+	    && add_branch->br_xino.xi_file->f_path.dentry->d_parent == h_dentry)
-+		au_xino_brid_set(sb, add_branch->br_id);
++	    && !au_test_fs_bad_xino(h_dentry->d_sb)) {
++		xf = au_xino_file(add_branch);
++		if (xf && xf->f_path.dentry->d_parent == h_dentry)
++			au_xino_brid_set(sb, add_branch->br_id);
++	}
 +
 +out:
 +	return err;
@@ -4006,7 +4004,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +}
 +
 +static void br_del_file(struct file **to_free, unsigned long long opened,
-+			  aufs_bindex_t br_id)
++			aufs_bindex_t br_id)
 +{
 +	unsigned long long ull;
 +	aufs_bindex_t bindex, btop, bbot, bfound;
@@ -4233,13 +4231,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +		di_write_lock_child(root);
 +	}
 +
-+	if (!remount)
-+		au_br_do_del(sb, bindex, br);
-+	else {
-+		sysaufs_brs_del(sb, bindex);
-+		au_br_do_del(sb, bindex, br);
-+		sysaufs_brs_add(sb, bindex);
-+	}
++	sysaufs_brs_del(sb, bindex);	/* remove successors */
++	dbgaufs_xino_del(br);		/* remove one */
++	au_br_do_del(sb, bindex, br);
++	sysaufs_brs_add(sb, bindex);	/* append successors */
++	dbgaufs_brs_add(sb, bindex, /*topdown*/1);	/* rename successors */
 +
 +	if (!bindex) {
 +		au_cpup_attr_all(d_inode(root), /*force*/1);
@@ -4575,8 +4571,9 @@ 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	2018-06-04 09:08:09.181412645 +0200
-@@ -0,0 +1,333 @@
++++ linux/fs/aufs/branch.h	2018-07-19 09:46:13.053314374 +0200
+@@ -0,0 +1,374 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -4612,7 +4609,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +/* ---------------------------------------------------------------------- */
 +
 +/* a xino file */
-+struct au_xino_file {
++struct au_xino {
 +	struct file		*xi_file;
 +	struct {
 +		spinlock_t		spin;
@@ -4623,11 +4620,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +		wait_queue_head_t	wqh;
 +	} xi_nondir;
 +
-+	/* todo: make xino files an array to support huge inode number */
++	atomic_t		xi_truncating;
 +
-+#ifdef CONFIG_DEBUG_FS
-+	struct dentry		 *xi_dbgaufs;
-+#endif
++	struct kref		xi_kref;
++
++	/* todo: make xino files an array to support huge inode number */
 +};
 +
 +/* File-based Hierarchical Storage Management */
@@ -4678,7 +4675,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +
 +/* protected by superblock rwsem */
 +struct au_branch {
-+	struct au_xino_file	br_xino;
++	struct au_xino		*br_xino;
 +
 +	aufs_bindex_t		br_id;
 +
@@ -4691,9 +4688,6 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +	struct au_wbr		*br_wbr;
 +	struct au_br_fhsm	*br_fhsm;
 +
-+	/* xino truncation */
-+	atomic_t		br_xino_running;
-+
 +#ifdef CONFIG_AUFS_HFSNOTIFY
 +	struct au_br_hfsnotify	*br_hfsn;
 +#endif
@@ -4703,6 +4697,10 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +	struct au_brsysfs	br_sysfs[AuBrSysfs_Last];
 +#endif
 +
++#ifdef CONFIG_DEBUG_FS
++	struct dentry		 *br_dbgaufs; /* xino */
++#endif
++
 +	struct au_dr_br		br_dirren;
 +};
 +
@@ -4776,6 +4774,36 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +	return err;
 +}
 +
++static inline void au_xino_get(struct au_branch *br)
++{
++	struct au_xino *xi;
++
++	xi = br->br_xino;
++	if (xi)
++		kref_get(&xi->xi_kref);
++}
++
++static inline int au_xino_count(struct au_branch *br)
++{
++	int v;
++	struct au_xino *xi;
++
++	v = 0;
++	xi = br->br_xino;
++	if (xi)
++		v = kref_read(&xi->xi_kref);
++
++	return v;
++}
++
++static inline struct file *au_xino_file(struct au_branch *br)
++{
++	struct au_xino *xi;
++
++	xi = br->br_xino;
++	return xi ? xi->xi_file : NULL;
++}
++
 +/* ---------------------------------------------------------------------- */
 +
 +/* branch.c */
@@ -4799,34 +4827,43 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +/* xino.c */
 +static const loff_t au_loff_max = LLONG_MAX;
 +
-+int au_xib_trunc(struct super_block *sb);
++struct file *au_xino_create(struct super_block *sb, char *fpath, int silent);
++struct file *au_xino_create2(struct super_block *sb, struct path *base,
++			     struct file *copy_src);
++
++int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
++		 ino_t *ino);
++int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
++		  ino_t ino);
 +ssize_t xino_fread(vfs_readf_t func, struct file *file, void *buf, size_t size,
 +		   loff_t *pos);
 +ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf,
 +		    size_t size, loff_t *pos);
-+struct file *au_xino_create2(struct file *base_file, struct file *copy_src);
-+struct file *au_xino_create(struct super_block *sb, char *fname, int silent);
-+ino_t au_xino_new_ino(struct super_block *sb);
-+void au_xino_delete_inode(struct inode *inode, const int unlinked);
-+int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
-+		  ino_t ino);
-+int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
-+		 ino_t *ino);
-+int au_xino_br(struct super_block *sb, struct au_branch *br, ino_t hino,
-+	       struct file *base_file, int do_test);
++
++int au_xib_trunc(struct super_block *sb);
 +int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex);
 +
++struct au_xino *au_xino_alloc(void);
++int au_xino_put(struct au_branch *br);
++void au_xino_file_set(struct au_branch *br, struct file *file);
++
 +struct au_opt_xino;
-+int au_xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount);
 +void au_xino_clr(struct super_block *sb);
++int au_xino_set(struct super_block *sb, struct au_opt_xino *xiopt, int remount);
 +struct file *au_xino_def(struct super_block *sb);
-+int au_xino_path(struct seq_file *seq, struct file *file);
++int au_xino_init_br(struct super_block *sb, struct au_branch *br, ino_t hino,
++		    struct path *base);
++
++ino_t au_xino_new_ino(struct super_block *sb);
++void au_xino_delete_inode(struct inode *inode, const int unlinked);
 +
 +void au_xinondir_leave(struct super_block *sb, aufs_bindex_t bindex,
 +		       ino_t h_ino, int idx);
 +int au_xinondir_enter(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
 +		      int *idx);
 +
++int au_xino_path(struct seq_file *seq, struct file *file);
++
 +/* ---------------------------------------------------------------------- */
 +
 +/* Superblock to branch */
@@ -4956,8 +4993,9 @@ 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	2018-06-04 09:08:09.181412645 +0200
-@@ -0,0 +1,1441 @@
++++ linux/fs/aufs/cpup.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,1442 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -5433,7 +5471,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	if (tsk->flags & PF_KTHREAD)
 +		__fput_sync(file[DST].file);
 +	else {
-+		/* it happend actually */
++		/* it happened actually */
 +		fput(file[DST].file);
 +		/*
 +		 * too bad.
@@ -6401,8 +6439,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,99 @@
++++ linux/fs/aufs/cpup.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,100 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -6504,8 +6543,9 @@ 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	2018-06-04 09:08:09.181412645 +0200
-@@ -0,0 +1,437 @@
++++ linux/fs/aufs/dbgaufs.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,478 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -6553,7 +6593,8 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	return 0;
 +}
 +
-+static int dbgaufs_xi_open(struct file *xf, struct file *file, int do_fcnt)
++static int dbgaufs_xi_open(struct file *xf, struct file *file, int do_fcnt,
++			   int cnt)
 +{
 +	int err;
 +	struct kstat st;
@@ -6574,8 +6615,8 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	if (!err) {
 +		if (do_fcnt)
 +			p->n = snprintf
-+				(p->a, sizeof(p->a), "%ld, %llux%u %lld\n",
-+				 (long)file_count(xf), st.blocks, st.blksize,
++				(p->a, sizeof(p->a), "%d, %llux%u %lld\n",
++				 cnt, st.blocks, st.blksize,
 +				 (long long)st.size);
 +		else
 +			p->n = snprintf(p->a, sizeof(p->a), "%llux%u %lld\n",
@@ -6706,7 +6747,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	sbinfo = inode->i_private;
 +	sb = sbinfo->si_sb;
 +	si_noflush_read_lock(sb);
-+	err = dbgaufs_xi_open(sbinfo->si_xib, file, /*do_fcnt*/0);
++	err = dbgaufs_xi_open(sbinfo->si_xib, file, /*do_fcnt*/0, /*cnt*/0);
 +	si_read_unlock(sb);
 +	return err;
 +}
@@ -6730,6 +6771,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	struct super_block *sb;
 +	struct file *xf;
 +	struct qstr *name;
++	struct au_branch *br;
 +
 +	err = -ENOENT;
 +	xf = NULL;
@@ -6746,8 +6788,10 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	sb = sbinfo->si_sb;
 +	si_noflush_read_lock(sb);
 +	if (l <= au_sbbot(sb)) {
-+		xf = au_sbr(sb, (aufs_bindex_t)l)->br_xino.xi_file;
-+		err = dbgaufs_xi_open(xf, file, /*do_fcnt*/1);
++		br = au_sbr(sb, (aufs_bindex_t)l);
++		xf = au_xino_file(br);
++		err = dbgaufs_xi_open(xf, file, /*do_fcnt*/1,
++				      au_xino_count(br));
 +	} else
 +		err = -ENOENT;
 +	si_read_unlock(sb);
@@ -6763,11 +6807,25 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	.read		= dbgaufs_xi_read
 +};
 +
++void dbgaufs_xino_del(struct au_branch *br)
++{
++	struct dentry *dbgaufs;
++
++	dbgaufs = br->br_dbgaufs;
++	if (!dbgaufs)
++		return;
++
++	br->br_dbgaufs = NULL;
++	/* debugfs acquires the parent i_mutex */
++	lockdep_off();
++	debugfs_remove(dbgaufs);
++	lockdep_on();
++}
++
 +void dbgaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex)
 +{
 +	aufs_bindex_t bbot;
 +	struct au_branch *br;
-+	struct au_xino_file *xi;
 +
 +	if (!au_sbi(sb)->si_dbgaufs)
 +		return;
@@ -6775,23 +6833,51 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	bbot = au_sbbot(sb);
 +	for (; bindex <= bbot; bindex++) {
 +		br = au_sbr(sb, bindex);
-+		xi = &br->br_xino;
-+		/* debugfs acquires the parent i_mutex */
++		dbgaufs_xino_del(br);
++	}
++}
++
++static void dbgaufs_br_add(struct super_block *sb, aufs_bindex_t bindex,
++			   struct dentry *parent, struct au_sbinfo *sbinfo)
++{
++	struct au_branch *br;
++	struct dentry *d;
++	char name[sizeof(DbgaufsXi_PREFIX) + 5]; /* "xi" bindex NULL */
++
++	snprintf(name, sizeof(name), DbgaufsXi_PREFIX "%d", bindex);
++	br = au_sbr(sb, bindex);
++	if (br->br_dbgaufs) {
++		struct qstr qstr = QSTR_INIT(name, strlen(name));
++
++		if (!au_qstreq(&br->br_dbgaufs->d_name, &qstr)) {
++			/* debugfs acquires the parent i_mutex */
++			lockdep_off();
++			d = debugfs_rename(parent, br->br_dbgaufs, parent,
++					   name);
++			lockdep_on();
++			if (unlikely(!d))
++				pr_warn("failed renaming %pd/%s, ignored.\n",
++					parent, name);
++		}
++	} else {
 +		lockdep_off();
-+		debugfs_remove(xi->xi_dbgaufs);
++		br->br_dbgaufs = debugfs_create_file(name, dbgaufs_mode, parent,
++						     sbinfo, &dbgaufs_xino_fop);
 +		lockdep_on();
-+		xi->xi_dbgaufs = NULL;
++		if (unlikely(!br->br_dbgaufs))
++			pr_warn("failed creaiting %pd/%s, ignored.\n",
++				parent, name);
 +	}
 +}
 +
-+void dbgaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex)
++void dbgaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex, int topdown)
 +{
 +	struct au_sbinfo *sbinfo;
 +	struct dentry *parent;
-+	struct au_branch *br;
-+	struct au_xino_file *xi;
 +	aufs_bindex_t bbot;
-+	char name[sizeof(DbgaufsXi_PREFIX) + 5]; /* "xi" bindex NULL */
++
++	if (!au_opt_test(au_mntflags(sb), XINO))
++		return;
 +
 +	sbinfo = au_sbi(sb);
 +	parent = sbinfo->si_dbgaufs;
@@ -6799,20 +6885,12 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +		return;
 +
 +	bbot = au_sbbot(sb);
-+	for (; bindex <= bbot; bindex++) {
-+		snprintf(name, sizeof(name), DbgaufsXi_PREFIX "%d", bindex);
-+		br = au_sbr(sb, bindex);
-+		xi = &br->br_xino;
-+		AuDebugOn(xi->xi_dbgaufs);
-+		/* debugfs acquires the parent i_mutex */
-+		lockdep_off();
-+		xi->xi_dbgaufs = debugfs_create_file(name, dbgaufs_mode, parent,
-+						     sbinfo, &dbgaufs_xino_fop);
-+		lockdep_on();
-+		/* ignore an error */
-+		if (unlikely(!xi->xi_dbgaufs))
-+			AuWarn1("failed %s under debugfs\n", name);
-+	}
++	if (topdown)
++		for (; bindex <= bbot; bindex++)
++			dbgaufs_br_add(sb, bindex, parent, sbinfo);
++	else
++		for (; bbot >= bindex; bbot--)
++			dbgaufs_br_add(sb, bbot, parent, sbinfo);
 +}
 +
 +/* ---------------------------------------------------------------------- */
@@ -6827,7 +6905,7 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	sbinfo = inode->i_private;
 +	sb = sbinfo->si_sb;
 +	si_noflush_read_lock(sb);
-+	err = dbgaufs_xi_open(sbinfo->si_xigen, file, /*do_fcnt*/0);
++	err = dbgaufs_xi_open(sbinfo->si_xigen, file, /*do_fcnt*/0, /*cnt*/0);
 +	si_read_unlock(sb);
 +	return err;
 +}
@@ -6877,7 +6955,6 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +
 +	debugfs_remove_recursive(sbinfo->si_dbgaufs);
 +	sbinfo->si_dbgaufs = NULL;
-+	kobject_put(&sbinfo->si_kobj);
 +}
 +
 +int dbgaufs_si_init(struct au_sbinfo *sbinfo)
@@ -6902,20 +6979,21 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +	sbinfo->si_dbgaufs = debugfs_create_dir(name, dbgaufs);
 +	if (unlikely(!sbinfo->si_dbgaufs))
 +		goto out;
-+	kobject_get(&sbinfo->si_kobj);
-+
-+	sbinfo->si_dbgaufs_xib = debugfs_create_file
-+		("xib", dbgaufs_mode, sbinfo->si_dbgaufs, sbinfo,
-+		 &dbgaufs_xib_fop);
-+	if (unlikely(!sbinfo->si_dbgaufs_xib))
-+		goto out_dir;
 +
++	/* regardless plink/noplink option */
 +	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;
 +
++	/* regardless xino/noxino option */
++	sbinfo->si_dbgaufs_xib = debugfs_create_file
++		("xib", dbgaufs_mode, sbinfo->si_dbgaufs, sbinfo,
++		 &dbgaufs_xib_fop);
++	if (unlikely(!sbinfo->si_dbgaufs_xib))
++		goto out_dir;
++
 +	err = dbgaufs_xigen_init(sbinfo);
 +	if (!err)
 +		goto out; /* success */
@@ -6923,6 +7001,8 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +out_dir:
 +	dbgaufs_si_fin(sbinfo);
 +out:
++	if (unlikely(err))
++		pr_err("debugfs/aufs failed\n");
 +	return err;
 +}
 +
@@ -6945,8 +7025,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,48 @@
++++ linux/fs/aufs/dbgaufs.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,53 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -6975,18 +7056,22 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 +
 +struct super_block;
 +struct au_sbinfo;
++struct au_branch;
 +
 +#ifdef CONFIG_DEBUG_FS
 +/* dbgaufs.c */
++void dbgaufs_xino_del(struct au_branch *br);
 +void dbgaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex);
-+void dbgaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex);
++void dbgaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex, int topdown);
 +void dbgaufs_si_fin(struct au_sbinfo *sbinfo);
 +int dbgaufs_si_init(struct au_sbinfo *sbinfo);
 +void dbgaufs_fin(void);
 +int __init dbgaufs_init(void);
 +#else
++AuStubVoid(dbgaufs_xino_del, struct au_branch *br)
 +AuStubVoid(dbgaufs_brs_del, struct super_block *sb, aufs_bindex_t bindex)
-+AuStubVoid(dbgaufs_brs_add, struct super_block *sb, aufs_bindex_t bindex)
++AuStubVoid(dbgaufs_brs_add, struct super_block *sb, aufs_bindex_t bindex,
++	   int topdown)
 +AuStubVoid(dbgaufs_si_fin, struct au_sbinfo *sbinfo)
 +AuStubInt0(dbgaufs_si_init, struct au_sbinfo *sbinfo)
 +AuStubVoid(dbgaufs_fin, void)
@@ -6997,8 +7082,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,225 @@
++++ linux/fs/aufs/dcsub.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,226 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -7226,8 +7312,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,136 @@
++++ linux/fs/aufs/dcsub.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,137 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -7366,8 +7453,9 @@ 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	2018-06-04 09:08:09.181412645 +0200
-@@ -0,0 +1,440 @@
++++ linux/fs/aufs/debug.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,441 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -7675,7 +7763,7 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +	     bindex, br->br_perm, br->br_id, au_br_count(br),
 +	     br->br_wbr, au_sbtype(sb), MAJOR(sb->s_dev), MINOR(sb->s_dev),
 +	     sb->s_flags, sb->s_count,
-+	     atomic_read(&sb->s_active), !!br->br_xino.xi_file);
++	     atomic_read(&sb->s_active), !!au_xino_file(br));
 +	return 0;
 +
 +out:
@@ -7810,8 +7898,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,225 @@
++++ linux/fs/aufs/debug.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,226 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -8039,8 +8128,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,1152 @@
++++ linux/fs/aufs/dentry.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,1153 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -9195,8 +9285,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,266 @@
++++ linux/fs/aufs/dentry.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,267 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -9465,8 +9556,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,553 @@
++++ linux/fs/aufs/dinfo.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,554 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -10022,8 +10114,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,759 @@
++++ linux/fs/aufs/dir.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,760 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -10502,7 +10595,7 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	struct inode *inode, *h_inode;
 +	struct super_block *sb;
 +
-+	AuDbg("%pD, ctx{%pf, %llu}\n", file, ctx->actor, ctx->pos);
++	AuDbg("%pD, ctx{%ps, %llu}\n", file, ctx->actor, ctx->pos);
 +
 +	dentry = file->f_path.dentry;
 +	inode = d_inode(dentry);
@@ -10785,8 +10878,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,131 @@
++++ linux/fs/aufs/dir.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,132 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -10920,8 +11014,9 @@ 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/dirren.c linux/fs/aufs/dirren.c
 --- /usr/share/empty/fs/aufs/dirren.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dirren.c	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,1315 @@
++++ linux/fs/aufs/dirren.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,1316 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2017-2018 Junjiro R. Okajima
 + *
@@ -12239,8 +12334,9 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c
 +}
 diff -urN /usr/share/empty/fs/aufs/dirren.h linux/fs/aufs/dirren.h
 --- /usr/share/empty/fs/aufs/dirren.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dirren.h	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,139 @@
++++ linux/fs/aufs/dirren.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,140 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2017-2018 Junjiro R. Okajima
 + *
@@ -12382,8 +12478,9 @@ diff -urN /usr/share/empty/fs/aufs/dirren.h linux/fs/aufs/dirren.h
 +#endif /* __AUFS_DIRREN_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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,369 @@
++++ linux/fs/aufs/dynop.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,370 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2010-2018 Junjiro R. Okajima
 + *
@@ -12755,8 +12852,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,74 @@
++++ linux/fs/aufs/dynop.h	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,75 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2010-2018 Junjiro R. Okajima
 + *
@@ -12833,8 +12931,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,836 @@
++++ linux/fs/aufs/export.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,838 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -13018,7 +13117,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	return err;
 +}
 +
-+int au_xigen_set(struct super_block *sb, struct file *base)
++int au_xigen_set(struct super_block *sb, struct path *path)
 +{
 +	int err;
 +	struct au_sbinfo *sbinfo;
@@ -13027,7 +13126,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	SiMustWriteLock(sb);
 +
 +	sbinfo = au_sbi(sb);
-+	file = au_xino_create2(base, sbinfo->si_xigen);
++	file = au_xino_create2(sb, path, sbinfo->si_xigen);
 +	err = PTR_ERR(file);
 +	if (IS_ERR(file))
 +		goto out;
@@ -13037,6 +13136,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +	sbinfo->si_xigen = file;
 +
 +out:
++	AuTraceErr(err);
 +	return err;
 +}
 +
@@ -13673,8 +13773,9 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
 +}
 diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c
 --- /usr/share/empty/fs/aufs/fhsm.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/fhsm.c	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,426 @@
++++ linux/fs/aufs/fhsm.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,427 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2011-2018 Junjiro R. Okajima
 + *
@@ -14103,8 +14204,9 @@ diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c
 +}
 diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
 --- /usr/share/empty/fs/aufs/file.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.c	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,856 @@
++++ linux/fs/aufs/file.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,857 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -14963,8 +15065,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,340 @@
++++ linux/fs/aufs/file.h	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,341 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -15307,8 +15410,9 @@ 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	2018-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,148 @@
++++ linux/fs/aufs/finfo.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,149 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -15459,8 +15563,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,817 @@
++++ linux/fs/aufs/f_op.c	2018-07-19 09:46:13.056647808 +0200
+@@ -0,0 +1,818 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -16280,8 +16385,9 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,400 @@
++++ linux/fs/aufs/fstype.h	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,401 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -16684,8 +16790,9 @@ 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/hbl.h linux/fs/aufs/hbl.h
 --- /usr/share/empty/fs/aufs/hbl.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hbl.h	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,64 @@
++++ linux/fs/aufs/hbl.h	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,65 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2017-2018 Junjiro R. Okajima
 + *
@@ -16752,8 +16859,9 @@ diff -urN /usr/share/empty/fs/aufs/hbl.h linux/fs/aufs/hbl.h
 +#endif /* __AUFS_HBL_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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,289 @@
++++ linux/fs/aufs/hfsnotify.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,290 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -17045,8 +17153,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,56 @@
++++ linux/fs/aufs/hfsplus.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,57 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2010-2018 Junjiro R. Okajima
 + *
@@ -17105,8 +17214,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,719 @@
++++ linux/fs/aufs/hnotify.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,720 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -17828,8 +17938,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,285 @@
++++ linux/fs/aufs/iinfo.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,286 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -18117,8 +18228,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,527 @@
++++ linux/fs/aufs/inode.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,528 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -18648,8 +18760,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,695 @@
++++ linux/fs/aufs/inode.h	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,696 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -19347,8 +19460,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,219 @@
++++ linux/fs/aufs/ioctl.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,220 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -19570,8 +19684,9 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c
 +#endif
 diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
 --- /usr/share/empty/fs/aufs/i_op_add.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_add.c	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,920 @@
++++ linux/fs/aufs/i_op_add.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,921 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -20494,8 +20609,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,1459 @@
++++ linux/fs/aufs/i_op.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,1460 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -20552,7 +20668,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +		&& write_mask && !(mask & MAY_READ))
 +	    || !h_inode->i_op->permission) {
 +		/* AuLabel(generic_permission); */
-+		/* AuDbg("get_acl %pf\n", h_inode->i_op->get_acl); */
++		/* AuDbg("get_acl %ps\n", h_inode->i_op->get_acl); */
 +		err = generic_permission(h_inode, mask);
 +		if (err == -EOPNOTSUPP && au_test_nfs_noacl(h_inode))
 +			err = h_inode->i_op->permission(h_inode, mask);
@@ -21809,7 +21925,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
 +		goto out_unlock;
 +
 +	err = 0;
-+	AuDbg("%pf\n", h_inode->i_op->get_link);
++	AuDbg("%ps\n", h_inode->i_op->get_link);
 +	AuDbgDentry(h_dentry);
 +	ret = vfs_get_link(h_dentry, done);
 +	dput(h_dentry);
@@ -21957,8 +22073,9 @@ 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	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,511 @@
++++ linux/fs/aufs/i_op_del.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,512 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -22472,8 +22589,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
 +}
 diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
 --- /usr/share/empty/fs/aufs/i_op_ren.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_ren.c	2018-06-04 09:08:09.184746078 +0200
-@@ -0,0 +1,1246 @@
++++ linux/fs/aufs/i_op_ren.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,1247 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -23925,8 +24043,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,147 @@
++++ linux/fs/aufs/loop.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,148 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -24076,8 +24195,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,52 @@
++++ linux/fs/aufs/loop.h	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,53 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -24217,8 +24337,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,266 @@
++++ linux/fs/aufs/module.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,273 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -24423,9 +24544,12 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 +	err = sysaufs_init();
 +	if (unlikely(err))
 +		goto out;
-+	err = au_procfs_init();
++	err = dbgaufs_init();
 +	if (unlikely(err))
 +		goto out_sysaufs;
++	err = au_procfs_init();
++	if (unlikely(err))
++		goto out_dbgaufs;
 +	err = au_wkq_init();
 +	if (unlikely(err))
 +		goto out_procfs;
@@ -24463,6 +24587,8 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 +	au_wkq_fin();
 +out_procfs:
 +	au_procfs_fin();
++out_dbgaufs:
++	dbgaufs_fin();
 +out_sysaufs:
 +	sysaufs_fin();
 +	au_dy_fin();
@@ -24479,6 +24605,7 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c
 +	au_loopback_fin();
 +	au_wkq_fin();
 +	au_procfs_fin();
++	dbgaufs_fin();
 +	sysaufs_fin();
 +	au_dy_fin();
 +}
@@ -24487,8 +24614,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,101 @@
++++ linux/fs/aufs/module.h	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,102 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -24592,8 +24720,9 @@ diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h
 +#endif /* __AUFS_MODULE_H__ */
 diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c
 --- /usr/share/empty/fs/aufs/mvdown.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/mvdown.c	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,704 @@
++++ linux/fs/aufs/mvdown.c	2018-07-19 09:46:13.059981241 +0200
+@@ -0,0 +1,705 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2011-2018 Junjiro R. Okajima
 + *
@@ -25300,8 +25429,9 @@ diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c
 +}
 diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 --- /usr/share/empty/fs/aufs/opts.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.c	2018-06-04 09:08:09.188079511 +0200
++++ linux/fs/aufs/opts.c	2018-07-19 09:46:13.059981241 +0200
 @@ -0,0 +1,1891 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -26862,14 +26992,7 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +	err = 0;
 +	switch (opt->type) {
 +	case Opt_xino:
-+		err = au_xino_set(sb, &opt->xino,
-+				  !!au_ftest_opts(opts->flags, REMOUNT));
-+		if (unlikely(err))
-+			break;
-+
-+		*opt_xino = &opt->xino;
 +		au_xino_brid_set(sb, -1);
-+
 +		/* safe d_parent access */
 +		parent = opt->xino.file->f_path.dentry->d_parent;
 +		root = sb->s_root;
@@ -26881,11 +27004,17 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c
 +				break;
 +			}
 +		}
++
++		err = au_xino_set(sb, &opt->xino,
++				  !!au_ftest_opts(opts->flags, REMOUNT));
++		if (unlikely(err))
++			break;
++
++		*opt_xino = &opt->xino;
 +		break;
 +
 +	case Opt_noxino:
 +		au_xino_clr(sb);
-+		au_xino_brid_set(sb, -1);
 +		*opt_xino = (void *)-1;
 +		break;
 +	}
@@ -27195,8 +27324,9 @@ 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	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,224 @@
++++ linux/fs/aufs/opts.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,225 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -27423,8 +27553,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,515 @@
++++ linux/fs/aufs/plink.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,516 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -27942,8 +28073,9 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
 +}
 diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 --- /usr/share/empty/fs/aufs/poll.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/poll.c	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,53 @@
++++ linux/fs/aufs/poll.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,54 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -27971,7 +28103,6 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +__poll_t aufs_poll(struct file *file, poll_table *wait)
 +{
 +	__poll_t mask;
-+	int err;
 +	struct file *h_file;
 +	struct super_block *sb;
 +
@@ -27981,9 +28112,10 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
 +
 +	h_file = au_read_pre(file, /*keep_fi*/0, /*lsc*/0);
-+	err = PTR_ERR(h_file);
-+	if (IS_ERR(h_file))
++	if (IS_ERR(h_file)) {
++		AuDbg("h_file %ld\n", PTR_ERR(h_file));
 +		goto out;
++	}
 +
 +	/* it is not an error if h_file has no operation */
 +	mask = DEFAULT_POLLMASK;
@@ -27993,14 +28125,15 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c
 +
 +out:
 +	si_read_unlock(sb);
-+	if (mask & POLLERR)
++	if (mask & EPOLLERR)
 +		AuDbg("mask 0x%x\n", mask);
 +	return mask;
 +}
 diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c
 --- /usr/share/empty/fs/aufs/posix_acl.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/posix_acl.c	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,102 @@
++++ linux/fs/aufs/posix_acl.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,103 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2014-2018 Junjiro R. Okajima
 + *
@@ -28105,8 +28238,9 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c
 +}
 diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
 --- /usr/share/empty/fs/aufs/procfs.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/procfs.c	2018-04-15 08:49:13.401150731 +0200
-@@ -0,0 +1,170 @@
++++ linux/fs/aufs/procfs.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,171 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2010-2018 Junjiro R. Okajima
 + *
@@ -28279,8 +28413,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,381 @@
++++ linux/fs/aufs/rdu.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,382 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -28664,8 +28799,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,72 @@
++++ linux/fs/aufs/rwsem.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,73 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -28740,8 +28876,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,304 @@
++++ linux/fs/aufs/sbinfo.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,312 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -28784,6 +28921,7 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +	AuDebugOn(percpu_counter_sum(&sbinfo->si_nfiles));
 +	percpu_counter_destroy(&sbinfo->si_nfiles);
 +
++	dbgaufs_si_fin(sbinfo);
 +	au_rw_write_lock(&sbinfo->si_rwsem);
 +	au_br_free(sbinfo);
 +	au_rw_write_unlock(&sbinfo->si_rwsem);
@@ -28811,6 +28949,12 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +		goto out_sbinfo;
 +
 +	err = sysaufs_si_init(sbinfo);
++	if (!err) {
++		dbgaufs_si_null(sbinfo);
++		err = dbgaufs_si_init(sbinfo);
++		if (unlikely(err))
++			kobject_put(&sbinfo->si_kobj);
++	}
 +	if (unlikely(err))
 +		goto out_br;
 +
@@ -29048,8 +29192,9 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c
 +}
 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,1051 @@
++++ linux/fs/aufs/super.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,1043 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -29522,11 +29667,8 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +	struct au_sbinfo *sbinfo;
 +
 +	sbinfo = au_sbi(sb);
-+	if (!sbinfo)
-+		return;
-+
-+	dbgaufs_si_fin(sbinfo);
-+	kobject_put(&sbinfo->si_kobj);
++	if (sbinfo)
++		kobject_put(&sbinfo->si_kobj);
 +}
 +
 +/* ---------------------------------------------------------------------- */
@@ -29795,7 +29937,7 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +			AuDebugOn(sbi->si_iop_array == aufs_iop);
 +			sbi->si_iop_array = aufs_iop;
 +		}
-+		pr_info("reset to %pf and %pf\n",
++		pr_info("reset to %ps and %ps\n",
 +			sb->s_d_op, sbi->si_iop_array);
 +	}
 +
@@ -30015,7 +30157,7 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +	au_opts_free(&opts);
 +	if (!err && au_ftest_si(sbinfo, NO_DREVAL)) {
 +		sb->s_d_op = &aufs_dop_noreval;
-+		pr_info("%pf\n", sb->s_d_op);
++		pr_info("%ps\n", sb->s_d_op);
 +		au_refresh_dop(root, /*force_reval*/0);
 +		sbinfo->si_iop_array = aufs_iop_nogetattr;
 +		au_refresh_iop(inode, /*force_getattr*/0);
@@ -30029,7 +30171,6 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +	dput(root);
 +	sb->s_root = NULL;
 +out_info:
-+	dbgaufs_si_fin(sbinfo);
 +	kobject_put(&sbinfo->si_kobj);
 +	sb->s_fs_info = NULL;
 +out_opts:
@@ -30048,7 +30189,6 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +				 void *raw_data)
 +{
 +	struct dentry *root;
-+	struct super_block *sb;
 +
 +	/* all timestamps always follow the ones on the branch */
 +	/* mnt->mnt_flags |= MNT_NOATIME | MNT_NODIRATIME; */
@@ -30056,11 +30196,7 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c
 +	if (IS_ERR(root))
 +		goto out;
 +
-+	sb = root->d_sb;
-+	si_write_lock(sb, !AuLock_FLUSH);
-+	sysaufs_brs_add(sb, 0);
-+	si_write_unlock(sb);
-+	au_sbilist_add(sb);
++	au_sbilist_add(root->d_sb);
 +
 +out:
 +	return root;
@@ -30103,8 +30239,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,626 @@
++++ linux/fs/aufs/super.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,627 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -30311,7 +30448,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +/*
 + * set true when refresh_dirs() failed at remount time.
 + * then try refreshing dirs at access time again.
-+ * if it is false, refreshing dirs at access time is unnecesary
++ * if it is false, refreshing dirs at access time is unnecessary
 + */
 +#define AuSi_FAILED_REFRESH_DIR	1
 +#define AuSi_FHSM		(1 << 1)	/* fhsm is active now */
@@ -30452,7 +30589,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +void au_export_init(struct super_block *sb);
 +void au_xigen_inc(struct inode *inode);
 +int au_xigen_new(struct inode *inode);
-+int au_xigen_set(struct super_block *sb, struct file *base);
++int au_xigen_set(struct super_block *sb, struct path *path);
 +void au_xigen_clr(struct super_block *sb);
 +
 +static inline int au_busy_or_stale(void)
@@ -30466,7 +30603,7 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h
 +AuStubVoid(au_export_init, struct super_block *sb)
 +AuStubVoid(au_xigen_inc, struct inode *inode)
 +AuStubInt0(au_xigen_new, struct inode *inode)
-+AuStubInt0(au_xigen_set, struct super_block *sb, struct file *base)
++AuStubInt0(au_xigen_set, struct super_block *sb, struct path *path)
 +AuStubVoid(au_xigen_clr, struct super_block *sb)
 +AuStub(int, au_busy_or_stale, return -EBUSY, void)
 +#endif /* CONFIG_AUFS_EXPORT */
@@ -30733,8 +30870,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,104 @@
++++ linux/fs/aufs/sysaufs.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,93 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -30796,18 +30934,11 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 +		(&sbinfo->si_kobj, &au_sbi_ktype, /*&sysaufs_kset->kobj*/NULL,
 +		 SysaufsSiNamePrefix "%lx", sysaufs_si_id(sbinfo));
 +
-+	dbgaufs_si_null(sbinfo);
-+	if (!err) {
-+		err = dbgaufs_si_init(sbinfo);
-+		if (unlikely(err))
-+			kobject_put(&sbinfo->si_kobj);
-+	}
 +	return err;
 +}
 +
 +void sysaufs_fin(void)
 +{
-+	dbgaufs_fin();
 +	sysfs_remove_group(&sysaufs_kset->kobj, sysaufs_attr_group);
 +	kset_unregister(sysaufs_kset);
 +}
@@ -30828,21 +30959,17 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c
 +	if (IS_ERR(sysaufs_kset))
 +		goto out;
 +	err = sysfs_create_group(&sysaufs_kset->kobj, sysaufs_attr_group);
-+	if (unlikely(err)) {
++	if (unlikely(err))
 +		kset_unregister(sysaufs_kset);
-+		goto out;
-+	}
 +
-+	err = dbgaufs_init();
-+	if (unlikely(err))
-+		sysaufs_fin();
 +out:
 +	return err;
 +}
 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,101 @@
++++ linux/fs/aufs/sysaufs.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,102 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -30946,8 +31073,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,376 @@
++++ linux/fs/aufs/sysfs.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,373 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -31276,8 +31404,6 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 +	int i;
 +	aufs_bindex_t bbot;
 +
-+	dbgaufs_brs_del(sb, bindex);
-+
 +	if (!sysaufs_brs)
 +		return;
 +
@@ -31301,8 +31427,6 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c
 +	struct au_branch *br;
 +	struct au_brsysfs *br_sysfs;
 +
-+	dbgaufs_brs_add(sb, bindex);
-+
 +	if (!sysaufs_brs)
 +		return;
 +
@@ -31326,8 +31450,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,159 @@
++++ linux/fs/aufs/sysrq.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,160 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -31489,8 +31614,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,893 @@
++++ linux/fs/aufs/vdir.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,894 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -32386,8 +32512,9 @@ 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	2018-06-15 11:15:15.400449109 +0200
-@@ -0,0 +1,894 @@
++++ linux/fs/aufs/vfsub.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,895 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -32975,7 +33102,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c
 +{
 +	int err;
 +
-+	AuDbg("%pD, ctx{%pf, %llu}\n", file, ctx->actor, ctx->pos);
++	AuDbg("%pD, ctx{%ps, %llu}\n", file, ctx->actor, ctx->pos);
 +
 +	lockdep_off();
 +	err = iterate_dir(file, ctx);
@@ -33284,8 +33411,9 @@ 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	2018-06-15 11:15:15.400449109 +0200
-@@ -0,0 +1,354 @@
++++ linux/fs/aufs/vfsub.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,355 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -33642,8 +33770,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,830 @@
++++ linux/fs/aufs/wbr_policy.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,831 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -34476,8 +34605,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,1061 @@
++++ linux/fs/aufs/whout.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,1062 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -35541,8 +35671,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,85 @@
++++ linux/fs/aufs/whout.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,86 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -35630,8 +35761,9 @@ 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	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,390 @@
++++ linux/fs/aufs/wkq.c	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,391 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -36024,8 +36156,9 @@ 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	2018-04-15 08:49:13.404484168 +0200
-@@ -0,0 +1,93 @@
++++ linux/fs/aufs/wkq.h	2018-07-19 09:46:13.063314675 +0200
+@@ -0,0 +1,94 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -36121,8 +36254,9 @@ diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h
 +#endif /* __AUFS_WKQ_H__ */
 diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c
 --- /usr/share/empty/fs/aufs/xattr.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xattr.c	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,355 @@
++++ linux/fs/aufs/xattr.c	2018-07-19 09:46:13.066648108 +0200
+@@ -0,0 +1,356 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2014-2018 Junjiro R. Okajima
 + *
@@ -36480,8 +36614,9 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c
 +}
 diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 --- /usr/share/empty/fs/aufs/xino.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xino.c	2018-06-04 09:08:09.188079511 +0200
-@@ -0,0 +1,1469 @@
++++ linux/fs/aufs/xino.c	2018-07-19 09:46:13.066648108 +0200
+@@ -0,0 +1,1593 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -36501,277 +36636,93 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +/*
 + * external inode number translation table and bitmap
++ *
++ * things to consider
++ * - the lifetime
++ *   + au_xino object
++ *   + XINO files (xino, xib, xigen)
++ *   + dynamic debugfs entries (xiN)
++ *   + static debugfs entries (xib, xigen)
++ *   + static sysfs entry (xi_path)
++ * - several entry points to handle them.
++ *   + mount(2) without xino option (default)
++ *   + mount(2) with xino option
++ *   + mount(2) with noxino option
++ *   + umount(2)
++ *   + remount with add/del branches
++ *   + remount with xino/noxino options
 + */
 +
 +#include <linux/seq_file.h>
 +#include <linux/statfs.h>
 +#include "aufs.h"
 +
-+static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
-+			      size_t size, loff_t *pos);
-+
-+/* todo: unnecessary to support mmap_sem since kernel-space? */
-+ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size,
-+		   loff_t *pos)
++static aufs_bindex_t sbr_find_shared(struct super_block *sb, aufs_bindex_t btop,
++				     aufs_bindex_t bbot,
++				     struct super_block *h_sb)
 +{
-+	ssize_t err;
-+	mm_segment_t oldfs;
-+	union {
-+		void *k;
-+		char __user *u;
-+	} buf;
-+	int i;
-+	const int prevent_endless = 10;
-+
-+	i = 0;
-+	buf.k = kbuf;
-+	oldfs = get_fs();
-+	set_fs(KERNEL_DS);
-+	do {
-+		err = func(file, buf.u, size, pos);
-+		if (err == -EINTR
-+		    && !au_wkq_test()
-+		    && fatal_signal_pending(current)) {
-+			set_fs(oldfs);
-+			err = xino_fread_wkq(func, file, kbuf, size, pos);
-+			BUG_ON(err == -EINTR);
-+			oldfs = get_fs();
-+			set_fs(KERNEL_DS);
-+		}
-+	} while (i++ < prevent_endless
-+		 && (err == -EAGAIN || err == -EINTR));
-+	set_fs(oldfs);
-+
-+#if 0 /* reserved for future use */
-+	if (err > 0)
-+		fsnotify_access(file->f_path.dentry);
-+#endif
-+
-+	return err;
-+}
-+
-+struct xino_fread_args {
-+	ssize_t *errp;
-+	vfs_readf_t func;
-+	struct file *file;
-+	void *buf;
-+	size_t size;
-+	loff_t *pos;
-+};
-+
-+static void call_xino_fread(void *args)
-+{
-+	struct xino_fread_args *a = args;
-+	*a->errp = xino_fread(a->func, a->file, a->buf, a->size, a->pos);
-+}
-+
-+static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
-+			       size_t size, loff_t *pos)
-+{
-+	ssize_t err;
-+	int wkq_err;
-+	struct xino_fread_args args = {
-+		.errp	= &err,
-+		.func	= func,
-+		.file	= file,
-+		.buf	= buf,
-+		.size	= size,
-+		.pos	= pos
-+	};
-+
-+	wkq_err = au_wkq_wait(call_xino_fread, &args);
-+	if (unlikely(wkq_err))
-+		err = wkq_err;
-+
-+	return err;
-+}
-+
-+/* ---------------------------------------------------------------------- */
-+
-+static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
-+			       size_t size, loff_t *pos);
-+
-+static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf,
-+			      size_t size, loff_t *pos)
-+{
-+	ssize_t err;
-+	mm_segment_t oldfs;
-+	union {
-+		void *k;
-+		const char __user *u;
-+	} buf;
-+	int i;
-+	const int prevent_endless = 10;
-+
-+	i = 0;
-+	buf.k = kbuf;
-+	oldfs = get_fs();
-+	set_fs(KERNEL_DS);
-+	do {
-+		err = func(file, buf.u, size, pos);
-+		if (err == -EINTR
-+		    && !au_wkq_test()
-+		    && fatal_signal_pending(current)) {
-+			set_fs(oldfs);
-+			err = xino_fwrite_wkq(func, file, kbuf, size, pos);
-+			BUG_ON(err == -EINTR);
-+			oldfs = get_fs();
-+			set_fs(KERNEL_DS);
-+		}
-+	} while (i++ < prevent_endless
-+		 && (err == -EAGAIN || err == -EINTR));
-+	set_fs(oldfs);
-+
-+#if 0 /* reserved for future use */
-+	if (err > 0)
-+		fsnotify_modify(file->f_path.dentry);
-+#endif
-+
-+	return err;
-+}
-+
-+struct do_xino_fwrite_args {
-+	ssize_t *errp;
-+	vfs_writef_t func;
-+	struct file *file;
-+	void *buf;
-+	size_t size;
-+	loff_t *pos;
-+};
-+
-+static void call_do_xino_fwrite(void *args)
-+{
-+	struct do_xino_fwrite_args *a = args;
-+	*a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos);
-+}
-+
-+static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
-+			       size_t size, loff_t *pos)
-+{
-+	ssize_t err;
-+	int wkq_err;
-+	struct do_xino_fwrite_args args = {
-+		.errp	= &err,
-+		.func	= func,
-+		.file	= file,
-+		.buf	= buf,
-+		.size	= size,
-+		.pos	= pos
-+	};
-+
-+	/*
-+	 * it breaks RLIMIT_FSIZE and normal user's limit,
-+	 * users should care about quota and real 'filesystem full.'
-+	 */
-+	wkq_err = au_wkq_wait(call_do_xino_fwrite, &args);
-+	if (unlikely(wkq_err))
-+		err = wkq_err;
-+
-+	return err;
++	/* todo: try binary-search if the branches are many */
++	for (; btop <= bbot; btop++)
++		if (h_sb == au_sbr_sb(sb, btop))
++			return btop;
++	return -1;
 +}
 +
-+ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf,
-+		    size_t size, loff_t *pos)
++/*
++ * find another branch who is on the same filesystem of the specified
++ * branch{@btgt}. search until @bbot.
++ */
++static aufs_bindex_t is_sb_shared(struct super_block *sb, aufs_bindex_t btgt,
++				  aufs_bindex_t bbot)
 +{
-+	ssize_t err;
++	aufs_bindex_t bindex;
++	struct super_block *tgt_sb;
 +
-+	if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) {
-+		lockdep_off();
-+		err = do_xino_fwrite(func, file, buf, size, pos);
-+		lockdep_on();
-+	} else {
-+		lockdep_off();
-+		err = xino_fwrite_wkq(func, file, buf, size, pos);
-+		lockdep_on();
-+	}
++	tgt_sb = au_sbr_sb(sb, btgt);
++	bindex = sbr_find_shared(sb, /*btop*/0, btgt - 1, tgt_sb);
++	if (bindex < 0)
++		bindex = sbr_find_shared(sb, btgt + 1, bbot, tgt_sb);
 +
-+	return err;
++	return bindex;
 +}
 +
 +/* ---------------------------------------------------------------------- */
 +
 +/*
-+ * create a new xinofile at the same place/path as @base_file.
++ * stop unnecessary notify events at creating xino files
 + */
-+struct file *au_xino_create2(struct file *base_file, struct file *copy_src)
++struct au_xino_lock_dir {
++	struct au_hinode *hdir;
++	struct dentry *parent;
++	struct inode *dir;
++};
++
++static struct dentry *au_dget_parent_lock(struct dentry *dentry,
++					  unsigned int lsc)
 +{
-+	struct file *file;
-+	struct dentry *base, *parent;
-+	struct inode *dir, *delegated;
-+	struct qstr *name;
-+	struct path path;
-+	int err;
++	struct dentry *parent;
++	struct inode *dir;
 +
-+	base = base_file->f_path.dentry;
-+	parent = base->d_parent; /* dir inode is locked */
++	parent = dget_parent(dentry);
 +	dir = d_inode(parent);
-+	IMustLock(dir);
-+
-+	file = ERR_PTR(-EINVAL);
-+	name = &base->d_name;
-+	path.dentry = vfsub_lookup_one_len(name->name, parent, name->len);
-+	if (IS_ERR(path.dentry)) {
-+		file = (void *)path.dentry;
-+		pr_err("%pd lookup err %ld\n",
-+		       base, PTR_ERR(path.dentry));
++	inode_lock_nested(dir, lsc);
++#if 0 /* it should not happen */
++	spin_lock(&dentry->d_lock);
++	if (unlikely(dentry->d_parent != parent)) {
++		spin_unlock(&dentry->d_lock);
++		inode_unlock(dir);
++		dput(parent);
++		parent = NULL;
 +		goto out;
 +	}
++	spin_unlock(&dentry->d_lock);
 +
-+	/* no need to mnt_want_write() since we call dentry_open() later */
-+	err = vfs_create(dir, path.dentry, S_IRUGO | S_IWUGO, NULL);
-+	if (unlikely(err)) {
-+		file = ERR_PTR(err);
-+		pr_err("%pd create err %d\n", base, err);
-+		goto out_dput;
-+	}
-+
-+	path.mnt = base_file->f_path.mnt;
-+	file = vfsub_dentry_open(&path,
-+				 O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE
-+				 /* | __FMODE_NONOTIFY */);
-+	if (IS_ERR(file)) {
-+		pr_err("%pd open err %ld\n", base, PTR_ERR(file));
-+		goto out_dput;
-+	}
-+
-+	delegated = NULL;
-+	err = vfsub_unlink(dir, &file->f_path, &delegated, /*force*/0);
-+	if (unlikely(err == -EWOULDBLOCK)) {
-+		pr_warn("cannot retry for NFSv4 delegation"
-+			" for an internal unlink\n");
-+		iput(delegated);
-+	}
-+	if (unlikely(err)) {
-+		pr_err("%pd unlink err %d\n", base, err);
-+		goto out_fput;
-+	}
-+
-+	if (copy_src) {
-+		/* no one can touch copy_src xino */
-+		err = au_copy_file(file, copy_src, vfsub_f_size_read(copy_src));
-+		if (unlikely(err)) {
-+			pr_err("%pd copy err %d\n", base, err);
-+			goto out_fput;
-+		}
-+	}
-+	goto out_dput; /* success */
-+
-+out_fput:
-+	fput(file);
-+	file = ERR_PTR(err);
-+out_dput:
-+	dput(path.dentry);
 +out:
-+	return file;
++#endif
++	return parent;
 +}
 +
-+struct au_xino_lock_dir {
-+	struct au_hinode *hdir;
-+	struct dentry *parent;
-+	struct inode *dir;
-+};
-+
-+static void au_xino_lock_dir(struct super_block *sb, struct file *xino,
++static void au_xino_lock_dir(struct super_block *sb, struct path *xipath,
 +			     struct au_xino_lock_dir *ldir)
 +{
 +	aufs_bindex_t brid, bindex;
@@ -36782,12 +36733,14 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	if (brid >= 0)
 +		bindex = au_br_index(sb, brid);
 +	if (bindex >= 0) {
++		/* rw branch root */
 +		ldir->hdir = au_hi(d_inode(sb->s_root), bindex);
 +		au_hn_inode_lock_nested(ldir->hdir, AuLsc_I_PARENT);
 +	} else {
-+		ldir->parent = dget_parent(xino->f_path.dentry);
++		/* other */
++		ldir->parent = au_dget_parent_lock(xipath->dentry,
++						   AuLsc_I_PARENT);
 +		ldir->dir = d_inode(ldir->parent);
-+		inode_lock_nested(ldir->dir, AuLsc_I_PARENT);
 +	}
 +}
 +
@@ -36803,19 +36756,165 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +/* ---------------------------------------------------------------------- */
 +
-+/* trucate xino files asynchronously */
++/*
++ * create and set a new xino file
++ */
++struct file *au_xino_create(struct super_block *sb, char *fpath, int silent)
++{
++	struct file *file;
++	struct dentry *h_parent, *d;
++	struct inode *h_dir, *inode;
++	int err;
++
++	/*
++	 * at mount-time, and the xino file is the default path,
++	 * hnotify is disabled so we have no notify events to ignore.
++	 * when a user specified the xino, we cannot get au_hdir to be ignored.
++	 */
++	file = vfsub_filp_open(fpath, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE
++			       /* | __FMODE_NONOTIFY */,
++			       S_IRUGO | S_IWUGO);
++	if (IS_ERR(file)) {
++		if (!silent)
++			pr_err("open %s(%ld)\n", fpath, PTR_ERR(file));
++		return file;
++	}
++
++	/* keep file count */
++	err = 0;
++	d = file->f_path.dentry;
++	h_parent = au_dget_parent_lock(d, AuLsc_I_PARENT);
++	/* mnt_want_write() is unnecessary here */
++	h_dir = d_inode(h_parent);
++	inode = file_inode(file);
++	/* no delegation since it is just created */
++	if (inode->i_nlink)
++		err = vfsub_unlink(h_dir, &file->f_path, /*delegated*/NULL,
++				   /*force*/0);
++	inode_unlock(h_dir);
++	dput(h_parent);
++	if (unlikely(err)) {
++		if (!silent)
++			pr_err("unlink %s(%d)\n", fpath, err);
++		goto out;
++	}
++
++	err = -EINVAL;
++	if (unlikely(sb == d->d_sb)) {
++		if (!silent)
++			pr_err("%s must be outside\n", fpath);
++		goto out;
++	}
++	if (unlikely(au_test_fs_bad_xino(d->d_sb))) {
++		if (!silent)
++			pr_err("xino doesn't support %s(%s)\n",
++			       fpath, au_sbtype(d->d_sb));
++		goto out;
++	}
++	return file; /* success */
++
++out:
++	fput(file);
++	file = ERR_PTR(err);
++	return file;
++}
++
++/*
++ * create a new xinofile at the same place/path as @base.
++ */
++struct file *au_xino_create2(struct super_block *sb, struct path *base,
++			     struct file *copy_src)
++{
++	struct file *file;
++	struct dentry *dentry, *parent;
++	struct inode *dir, *delegated;
++	struct qstr *name;
++	struct path path;
++	int err, do_unlock;
++	struct au_xino_lock_dir ldir;
++
++	do_unlock = 1;
++	au_xino_lock_dir(sb, base, &ldir);
++	dentry = base->dentry;
++	parent = dentry->d_parent; /* dir inode is locked */
++	dir = d_inode(parent);
++	IMustLock(dir);
++
++	name = &dentry->d_name;
++	path.dentry = vfsub_lookup_one_len(name->name, parent, name->len);
++	if (IS_ERR(path.dentry)) {
++		file = (void *)path.dentry;
++		pr_err("%pd lookup err %ld\n", dentry, PTR_ERR(path.dentry));
++		goto out;
++	}
++
++	/* no need to mnt_want_write() since we call dentry_open() later */
++	err = vfs_create(dir, path.dentry, S_IRUGO | S_IWUGO, NULL);
++	if (unlikely(err)) {
++		file = ERR_PTR(err);
++		pr_err("%pd create err %d\n", dentry, err);
++		goto out_dput;
++	}
++
++	path.mnt = base->mnt;
++	file = vfsub_dentry_open(&path,
++				 O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE
++				 /* | __FMODE_NONOTIFY */);
++	if (IS_ERR(file)) {
++		pr_err("%pd open err %ld\n", dentry, PTR_ERR(file));
++		goto out_dput;
++	}
++
++	delegated = NULL;
++	err = vfsub_unlink(dir, &file->f_path, &delegated, /*force*/0);
++	au_xino_unlock_dir(&ldir);
++	do_unlock = 0;
++	if (unlikely(err == -EWOULDBLOCK)) {
++		pr_warn("cannot retry for NFSv4 delegation"
++			" for an internal unlink\n");
++		iput(delegated);
++	}
++	if (unlikely(err)) {
++		pr_err("%pd unlink err %d\n", dentry, err);
++		goto out_fput;
++	}
++
++	if (copy_src) {
++		/* no one can touch copy_src xino */
++		err = au_copy_file(file, copy_src, vfsub_f_size_read(copy_src));
++		if (unlikely(err)) {
++			pr_err("%pd copy err %d\n", dentry, err);
++			goto out_fput;
++		}
++	}
++	goto out_dput; /* success */
 +
++out_fput:
++	fput(file);
++	file = ERR_PTR(err);
++out_dput:
++	dput(path.dentry);
++out:
++	if (do_unlock)
++		au_xino_unlock_dir(&ldir);
++	return file;
++}
++
++/* ---------------------------------------------------------------------- */
++
++/*
++ * truncate xino files
++ */
 +int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex)
 +{
 +	int err;
 +	unsigned long jiffy;
 +	blkcnt_t blocks;
-+	aufs_bindex_t bi, bbot;
++	aufs_bindex_t bbot;
 +	struct kstatfs *st;
 +	struct au_branch *br;
 +	struct file *new_xino, *file;
-+	struct super_block *h_sb;
-+	struct au_xino_lock_dir ldir;
++	struct path *path;
 +
 +	err = -ENOMEM;
 +	st = kmalloc(sizeof(*st), GFP_NOFS);
@@ -36827,11 +36926,12 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	if (unlikely(bindex < 0 || bbot < bindex))
 +		goto out_st;
 +	br = au_sbr(sb, bindex);
-+	file = br->br_xino.xi_file;
++	file = au_xino_file(br);
 +	if (!file)
 +		goto out_st;
 +
-+	err = vfs_statfs(&file->f_path, st);
++	path = &file->f_path;
++	err = vfs_statfs(path, st);
 +	if (unlikely(err))
 +		AuErr1("statfs err %d, ignored\n", err);
 +	jiffy = jiffies;
@@ -36839,31 +36939,14 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	pr_info("begin truncating xino(b%d), ib%llu, %llu/%llu free blks\n",
 +		bindex, (u64)blocks, st->f_bfree, st->f_blocks);
 +
-+	au_xino_lock_dir(sb, file, &ldir);
-+	/* mnt_want_write() is unnecessary here */
-+	new_xino = au_xino_create2(file, file);
-+	au_xino_unlock_dir(&ldir);
++	new_xino = au_xino_create2(sb, path, file);
 +	err = PTR_ERR(new_xino);
 +	if (IS_ERR(new_xino)) {
 +		pr_err("err %d, ignored\n", err);
 +		goto out_st;
 +	}
 +	err = 0;
-+	fput(file);
-+	br->br_xino.xi_file = new_xino;
-+
-+	h_sb = au_br_sb(br);
-+	for (bi = 0; bi <= bbot; bi++) {
-+		if (unlikely(bi == bindex))
-+			continue;
-+		br = au_sbr(sb, bi);
-+		if (au_br_sb(br) != h_sb)
-+			continue;
-+
-+		fput(br->br_xino.xi_file);
-+		br->br_xino.xi_file = new_xino;
-+		get_file(new_xino);
-+	}
++	au_xino_file_set(br, new_xino);
 +
 +	err = vfs_statfs(&new_xino->f_path, st);
 +	if (!err) {
@@ -36874,6 +36957,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +			au_sbi(sb)->si_xino_jiffy = jiffy;
 +	} else
 +		AuErr1("statfs err %d, ignored\n", err);
++	fput(new_xino);
 +
 +out_st:
 +	kfree(st);
@@ -36907,7 +36991,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	ii_read_unlock(dir);
 +	if (unlikely(err))
 +		pr_warn("err b%d, (%d)\n", bindex, err);
-+	atomic_dec(&br->br_xino_running);
++	atomic_dec(&br->br_xino->xi_truncating);
 +	au_br_put(br);
 +	si_write_unlock(sb);
 +	au_nwt_done(&au_sbi(sb)->si_nowait);
@@ -36919,6 +37003,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	int err;
 +	struct kstatfs st;
 +	struct au_sbinfo *sbinfo;
++	struct file *file;
 +
 +	/* todo: si_xino_expire and the ratio should be customizable */
 +	sbinfo = au_sbi(sb);
@@ -36927,7 +37012,9 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		return 0;
 +
 +	/* truncation border */
-+	err = vfs_statfs(&br->br_xino.xi_file->f_path, &st);
++	file = au_xino_file(br);
++	AuDebugOn(!file);
++	err = vfs_statfs(&file->f_path, &st);
 +	if (unlikely(err)) {
 +		AuErr1("statfs err %d, ignored\n", err);
 +		return 0;
@@ -36946,7 +37033,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	if (!xino_trunc_test(sb, br))
 +		return;
 +
-+	if (atomic_inc_return(&br->br_xino_running) > 1)
++	if (atomic_inc_return(&br->br_xino->xi_truncating) > 1)
 +		goto out;
 +
 +	/* lock and kfree() will be called in trunc_xino() */
@@ -36968,11 +37055,56 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	kfree(args);
 +
 +out:
-+	atomic_dec(&br->br_xino_running);
++	atomic_dec(&br->br_xino->xi_truncating);
 +}
 +
 +/* ---------------------------------------------------------------------- */
 +
++/*
++ * read @ino from xinofile for the specified branch{@sb, @bindex}
++ * at the position of @h_ino.
++ */
++int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
++		 ino_t *ino)
++{
++	int err;
++	ssize_t sz;
++	loff_t pos;
++	struct au_branch *br;
++	struct file *file;
++	struct au_sbinfo *sbinfo;
++
++	*ino = 0;
++	if (!au_opt_test(au_mntflags(sb), XINO))
++		return 0; /* no xino */
++
++	err = 0;
++	sbinfo = au_sbi(sb);
++	pos = h_ino;
++	if (unlikely(au_loff_max / sizeof(*ino) - 1 < pos)) {
++		AuIOErr1("too large hi%lu\n", (unsigned long)h_ino);
++		return -EFBIG;
++	}
++	pos *= sizeof(*ino);
++
++	br = au_sbr(sb, bindex);
++	file = au_xino_file(br);
++	if (vfsub_f_size_read(file) < pos + sizeof(*ino))
++		return 0; /* no ino */
++
++	sz = xino_fread(sbinfo->si_xread, file, ino, sizeof(*ino), &pos);
++	if (sz == sizeof(*ino))
++		return 0; /* success */
++
++	err = sz;
++	if (unlikely(sz >= 0)) {
++		err = -EIO;
++		AuIOErr("xino read error (%zd)\n", sz);
++	}
++
++	return err;
++}
++
 +static int au_xino_do_write(vfs_writef_t write, struct file *file,
 +			    ino_t h_ino, ino_t ino)
 +{
@@ -37016,8 +37148,8 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +		return 0;
 +
 +	br = au_sbr(sb, bindex);
-+	err = au_xino_do_write(au_sbi(sb)->si_xwrite, br->br_xino.xi_file,
-+			       h_ino, ino);
++	err = au_xino_do_write(au_sbi(sb)->si_xwrite, au_xino_file(br), h_ino,
++			       ino);
 +	if (!err) {
 +		if (au_opt_test(mnt_flags, TRUNC_XINO)
 +		    && au_test_fs_trunc_xino(au_br_sb(br)))
@@ -37029,10 +37161,190 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return -EIO;
 +}
 +
-+/* ---------------------------------------------------------------------- */
++static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
++			      size_t size, loff_t *pos);
 +
-+/* aufs inode number bitmap */
++/* todo: unnecessary to support mmap_sem since kernel-space? */
++ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size,
++		   loff_t *pos)
++{
++	ssize_t err;
++	mm_segment_t oldfs;
++	union {
++		void *k;
++		char __user *u;
++	} buf;
++	int i;
++	const int prevent_endless = 10;
 +
++	i = 0;
++	buf.k = kbuf;
++	oldfs = get_fs();
++	set_fs(KERNEL_DS);
++	do {
++		err = func(file, buf.u, size, pos);
++		if (err == -EINTR
++		    && !au_wkq_test()
++		    && fatal_signal_pending(current)) {
++			set_fs(oldfs);
++			err = xino_fread_wkq(func, file, kbuf, size, pos);
++			BUG_ON(err == -EINTR);
++			oldfs = get_fs();
++			set_fs(KERNEL_DS);
++		}
++	} while (i++ < prevent_endless
++		 && (err == -EAGAIN || err == -EINTR));
++	set_fs(oldfs);
++
++#if 0 /* reserved for future use */
++	if (err > 0)
++		fsnotify_access(file->f_path.dentry);
++#endif
++
++	return err;
++}
++
++struct xino_fread_args {
++	ssize_t *errp;
++	vfs_readf_t func;
++	struct file *file;
++	void *buf;
++	size_t size;
++	loff_t *pos;
++};
++
++static void call_xino_fread(void *args)
++{
++	struct xino_fread_args *a = args;
++	*a->errp = xino_fread(a->func, a->file, a->buf, a->size, a->pos);
++}
++
++static ssize_t xino_fread_wkq(vfs_readf_t func, struct file *file, void *buf,
++			      size_t size, loff_t *pos)
++{
++	ssize_t err;
++	int wkq_err;
++	struct xino_fread_args args = {
++		.errp	= &err,
++		.func	= func,
++		.file	= file,
++		.buf	= buf,
++		.size	= size,
++		.pos	= pos
++	};
++
++	wkq_err = au_wkq_wait(call_xino_fread, &args);
++	if (unlikely(wkq_err))
++		err = wkq_err;
++
++	return err;
++}
++
++static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
++			       size_t size, loff_t *pos);
++
++static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf,
++			      size_t size, loff_t *pos)
++{
++	ssize_t err;
++	mm_segment_t oldfs;
++	union {
++		void *k;
++		const char __user *u;
++	} buf;
++	int i;
++	const int prevent_endless = 10;
++
++	i = 0;
++	buf.k = kbuf;
++	oldfs = get_fs();
++	set_fs(KERNEL_DS);
++	do {
++		err = func(file, buf.u, size, pos);
++		if (err == -EINTR
++		    && !au_wkq_test()
++		    && fatal_signal_pending(current)) {
++			set_fs(oldfs);
++			err = xino_fwrite_wkq(func, file, kbuf, size, pos);
++			BUG_ON(err == -EINTR);
++			oldfs = get_fs();
++			set_fs(KERNEL_DS);
++		}
++	} while (i++ < prevent_endless
++		 && (err == -EAGAIN || err == -EINTR));
++	set_fs(oldfs);
++
++#if 0 /* reserved for future use */
++	if (err > 0)
++		fsnotify_modify(file->f_path.dentry);
++#endif
++
++	return err;
++}
++
++struct do_xino_fwrite_args {
++	ssize_t *errp;
++	vfs_writef_t func;
++	struct file *file;
++	void *buf;
++	size_t size;
++	loff_t *pos;
++};
++
++static void call_do_xino_fwrite(void *args)
++{
++	struct do_xino_fwrite_args *a = args;
++	*a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos);
++}
++
++static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf,
++			       size_t size, loff_t *pos)
++{
++	ssize_t err;
++	int wkq_err;
++	struct do_xino_fwrite_args args = {
++		.errp	= &err,
++		.func	= func,
++		.file	= file,
++		.buf	= buf,
++		.size	= size,
++		.pos	= pos
++	};
++
++	/*
++	 * it breaks RLIMIT_FSIZE and normal user's limit,
++	 * users should care about quota and real 'filesystem full.'
++	 */
++	wkq_err = au_wkq_wait(call_do_xino_fwrite, &args);
++	if (unlikely(wkq_err))
++		err = wkq_err;
++
++	return err;
++}
++
++ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf,
++		    size_t size, loff_t *pos)
++{
++	ssize_t err;
++
++	if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) {
++		lockdep_off();
++		err = do_xino_fwrite(func, file, buf, size, pos);
++		lockdep_on();
++	} else {
++		lockdep_off();
++		err = xino_fwrite_wkq(func, file, buf, size, pos);
++		lockdep_on();
++	}
++
++	return err;
++}
++
++/* ---------------------------------------------------------------------- */
++
++/*
++ * inode number bitmap
++ */
 +static const int page_bits = (int)PAGE_SIZE * BITS_PER_BYTE;
 +static ino_t xib_calc_ino(unsigned long pindex, int bit)
 +{
@@ -37097,8 +37409,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return err;
 +}
 +
-+/* ---------------------------------------------------------------------- */
-+
 +static void au_xib_clear_bit(struct inode *inode)
 +{
 +	int err, bit;
@@ -37121,310 +37431,11 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	mutex_unlock(&sbinfo->si_xib_mtx);
 +}
 +
-+/* for s_op->delete_inode() */
-+void au_xino_delete_inode(struct inode *inode, const int unlinked)
-+{
-+	int err;
-+	unsigned int mnt_flags;
-+	aufs_bindex_t bindex, bbot, bi;
-+	unsigned char try_trunc;
-+	struct au_iinfo *iinfo;
-+	struct super_block *sb;
-+	struct au_hinode *hi;
-+	struct inode *h_inode;
-+	struct au_branch *br;
-+	vfs_writef_t xwrite;
-+
-+	AuDebugOn(au_is_bad_inode(inode));
-+
-+	sb = inode->i_sb;
-+	mnt_flags = au_mntflags(sb);
-+	if (!au_opt_test(mnt_flags, XINO)
-+	    || inode->i_ino == AUFS_ROOT_INO)
-+		return;
-+
-+	if (unlinked) {
-+		au_xigen_inc(inode);
-+		au_xib_clear_bit(inode);
-+	}
-+
-+	iinfo = au_ii(inode);
-+	bindex = iinfo->ii_btop;
-+	if (bindex < 0)
-+		return;
-+
-+	xwrite = au_sbi(sb)->si_xwrite;
-+	try_trunc = !!au_opt_test(mnt_flags, TRUNC_XINO);
-+	hi = au_hinode(iinfo, bindex);
-+	bbot = iinfo->ii_bbot;
-+	for (; bindex <= bbot; bindex++, hi++) {
-+		h_inode = hi->hi_inode;
-+		if (!h_inode
-+		    || (!unlinked && h_inode->i_nlink))
-+			continue;
-+
-+		/* inode may not be revalidated */
-+		bi = au_br_index(sb, hi->hi_id);
-+		if (bi < 0)
-+			continue;
-+
-+		br = au_sbr(sb, bi);
-+		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(au_br_sb(br)))
-+			xino_try_trunc(sb, br);
-+	}
-+}
-+
-+/* get an unused inode number from bitmap */
-+ino_t au_xino_new_ino(struct super_block *sb)
-+{
-+	ino_t ino;
-+	unsigned long *p, pindex, ul, pend;
-+	struct au_sbinfo *sbinfo;
-+	struct file *file;
-+	int free_bit, err;
-+
-+	if (!au_opt_test(au_mntflags(sb), XINO))
-+		return iunique(sb, AUFS_FIRST_INO);
-+
-+	sbinfo = au_sbi(sb);
-+	mutex_lock(&sbinfo->si_xib_mtx);
-+	p = sbinfo->si_xib_buf;
-+	free_bit = sbinfo->si_xib_next_bit;
-+	if (free_bit < page_bits && !test_bit(free_bit, p))
-+		goto out; /* success */
-+	free_bit = find_first_zero_bit(p, page_bits);
-+	if (free_bit < page_bits)
-+		goto out; /* success */
-+
-+	pindex = sbinfo->si_xib_last_pindex;
-+	for (ul = pindex - 1; ul < ULONG_MAX; ul--) {
-+		err = xib_pindex(sb, ul);
-+		if (unlikely(err))
-+			goto out_err;
-+		free_bit = find_first_zero_bit(p, page_bits);
-+		if (free_bit < page_bits)
-+			goto out; /* success */
-+	}
-+
-+	file = sbinfo->si_xib;
-+	pend = vfsub_f_size_read(file) / PAGE_SIZE;
-+	for (ul = pindex + 1; ul <= pend; ul++) {
-+		err = xib_pindex(sb, ul);
-+		if (unlikely(err))
-+			goto out_err;
-+		free_bit = find_first_zero_bit(p, page_bits);
-+		if (free_bit < page_bits)
-+			goto out; /* success */
-+	}
-+	BUG();
-+
-+out:
-+	set_bit(free_bit, p);
-+	sbinfo->si_xib_next_bit = free_bit + 1;
-+	pindex = sbinfo->si_xib_last_pindex;
-+	mutex_unlock(&sbinfo->si_xib_mtx);
-+	ino = xib_calc_ino(pindex, free_bit);
-+	AuDbg("i%lu\n", (unsigned long)ino);
-+	return ino;
-+out_err:
-+	mutex_unlock(&sbinfo->si_xib_mtx);
-+	AuDbg("i0\n");
-+	return 0;
-+}
-+
-+/*
-+ * read @ino from xinofile for the specified branch{@sb, @bindex}
-+ * at the position of @h_ino.
-+ * if @ino does not exist and @do_new is true, get new one.
-+ */
-+int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
-+		 ino_t *ino)
-+{
-+	int err;
-+	ssize_t sz;
-+	loff_t pos;
-+	struct file *file;
-+	struct au_sbinfo *sbinfo;
-+
-+	*ino = 0;
-+	if (!au_opt_test(au_mntflags(sb), XINO))
-+		return 0; /* no xino */
-+
-+	err = 0;
-+	sbinfo = au_sbi(sb);
-+	pos = h_ino;
-+	if (unlikely(au_loff_max / sizeof(*ino) - 1 < pos)) {
-+		AuIOErr1("too large hi%lu\n", (unsigned long)h_ino);
-+		return -EFBIG;
-+	}
-+	pos *= sizeof(*ino);
-+
-+	file = au_sbr(sb, bindex)->br_xino.xi_file;
-+	if (vfsub_f_size_read(file) < pos + sizeof(*ino))
-+		return 0; /* no ino */
-+
-+	sz = xino_fread(sbinfo->si_xread, file, ino, sizeof(*ino), &pos);
-+	if (sz == sizeof(*ino))
-+		return 0; /* success */
-+
-+	err = sz;
-+	if (unlikely(sz >= 0)) {
-+		err = -EIO;
-+		AuIOErr("xino read error (%zd)\n", sz);
-+	}
-+
-+	return err;
-+}
-+
 +/* ---------------------------------------------------------------------- */
 +
-+/* create and set a new xino file */
-+
-+struct file *au_xino_create(struct super_block *sb, char *fname, int silent)
-+{
-+	struct file *file;
-+	struct dentry *h_parent, *d;
-+	struct inode *h_dir, *inode;
-+	int err;
-+
-+	/*
-+	 * at mount-time, and the xino file is the default path,
-+	 * hnotify is disabled so we have no notify events to ignore.
-+	 * when a user specified the xino, we cannot get au_hdir to be ignored.
-+	 */
-+	file = vfsub_filp_open(fname, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE
-+			       /* | __FMODE_NONOTIFY */,
-+			       S_IRUGO | S_IWUGO);
-+	if (IS_ERR(file)) {
-+		if (!silent)
-+			pr_err("open %s(%ld)\n", fname, PTR_ERR(file));
-+		return file;
-+	}
-+
-+	/* keep file count */
-+	err = 0;
-+	inode = file_inode(file);
-+	h_parent = dget_parent(file->f_path.dentry);
-+	h_dir = d_inode(h_parent);
-+	inode_lock_nested(h_dir, AuLsc_I_PARENT);
-+	/* mnt_want_write() is unnecessary here */
-+	/* no delegation since it is just created */
-+	if (inode->i_nlink)
-+		err = vfsub_unlink(h_dir, &file->f_path, /*delegated*/NULL,
-+				   /*force*/0);
-+	inode_unlock(h_dir);
-+	dput(h_parent);
-+	if (unlikely(err)) {
-+		if (!silent)
-+			pr_err("unlink %s(%d)\n", fname, err);
-+		goto out;
-+	}
-+
-+	err = -EINVAL;
-+	d = file->f_path.dentry;
-+	if (unlikely(sb == d->d_sb)) {
-+		if (!silent)
-+			pr_err("%s must be outside\n", fname);
-+		goto out;
-+	}
-+	if (unlikely(au_test_fs_bad_xino(d->d_sb))) {
-+		if (!silent)
-+			pr_err("xino doesn't support %s(%s)\n",
-+			       fname, au_sbtype(d->d_sb));
-+		goto out;
-+	}
-+	return file; /* success */
-+
-+out:
-+	fput(file);
-+	file = ERR_PTR(err);
-+	return file;
-+}
-+
 +/*
-+ * find another branch who is on the same filesystem of the specified
-+ * branch{@btgt}. search until @bbot.
-+ */
-+static int is_sb_shared(struct super_block *sb, aufs_bindex_t btgt,
-+			aufs_bindex_t bbot)
-+{
-+	aufs_bindex_t bindex;
-+	struct super_block *tgt_sb = au_sbr_sb(sb, btgt);
-+
-+	for (bindex = 0; bindex < btgt; bindex++)
-+		if (unlikely(tgt_sb == au_sbr_sb(sb, bindex)))
-+			return bindex;
-+	for (bindex++; bindex <= bbot; bindex++)
-+		if (unlikely(tgt_sb == au_sbr_sb(sb, bindex)))
-+			return bindex;
-+	return -1;
-+}
-+
-+/* ---------------------------------------------------------------------- */
-+
-+/*
-+ * initialize the xinofile for the specified branch @br
-+ * at the place/path where @base_file indicates.
-+ * test whether another branch is on the same filesystem or not,
-+ * if @do_test is true.
++ * truncate a xino bitmap file
 + */
-+int au_xino_br(struct super_block *sb, struct au_branch *br, ino_t h_ino,
-+	       struct file *base_file, int do_test)
-+{
-+	int err;
-+	ino_t ino;
-+	aufs_bindex_t bbot, bindex;
-+	struct au_branch *shared_br, *b;
-+	struct file *file;
-+	struct super_block *tgt_sb;
-+
-+	shared_br = NULL;
-+	bbot = au_sbbot(sb);
-+	if (do_test) {
-+		tgt_sb = au_br_sb(br);
-+		for (bindex = 0; bindex <= bbot; bindex++) {
-+			b = au_sbr(sb, bindex);
-+			if (tgt_sb == au_br_sb(b)) {
-+				shared_br = b;
-+				break;
-+			}
-+		}
-+	}
-+
-+	if (!shared_br || !shared_br->br_xino.xi_file) {
-+		struct au_xino_lock_dir ldir;
-+
-+		au_xino_lock_dir(sb, base_file, &ldir);
-+		/* mnt_want_write() is unnecessary here */
-+		file = au_xino_create2(base_file, NULL);
-+		au_xino_unlock_dir(&ldir);
-+		err = PTR_ERR(file);
-+		if (IS_ERR(file))
-+			goto out;
-+		br->br_xino.xi_file = file;
-+	} else {
-+		br->br_xino.xi_file = shared_br->br_xino.xi_file;
-+		get_file(br->br_xino.xi_file);
-+	}
-+
-+	ino = AUFS_ROOT_INO;
-+	err = au_xino_do_write(au_sbi(sb)->si_xwrite, br->br_xino.xi_file,
-+			       h_ino, ino);
-+	if (unlikely(err)) {
-+		fput(br->br_xino.xi_file);
-+		br->br_xino.xi_file = NULL;
-+	}
-+
-+out:
-+	return err;
-+}
-+
-+/* ---------------------------------------------------------------------- */
-+
-+/* trucate a xino bitmap file */
 +
 +/* todo: slow */
 +static int do_xib_restore(struct super_block *sb, struct file *file, void *page)
@@ -37475,6 +37486,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	int err;
 +	aufs_bindex_t bindex, bbot;
 +	void *page;
++	struct au_branch *br;
 +
 +	err = -ENOMEM;
 +	page = (void *)__get_free_page(GFP_NOFS);
@@ -37484,11 +37496,11 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	err = 0;
 +	bbot = au_sbbot(sb);
 +	for (bindex = 0; !err && bindex <= bbot; bindex++)
-+		if (!bindex || is_sb_shared(sb, bindex, bindex - 1) < 0)
-+			err = do_xib_restore
-+				(sb, au_sbr(sb, bindex)->br_xino.xi_file, page);
-+		else
-+			AuDbg("b%d\n", bindex);
++		if (!bindex || is_sb_shared(sb, bindex, bindex - 1) < 0) {
++			br = au_sbr(sb, bindex);
++			err = do_xib_restore(sb, au_xino_file(br), page);
++		} else
++			AuDbg("skip shared b%d\n", bindex);
 +	free_page((unsigned long)page);
 +
 +out:
@@ -37500,7 +37512,6 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	int err;
 +	ssize_t sz;
 +	loff_t pos;
-+	struct au_xino_lock_dir ldir;
 +	struct au_sbinfo *sbinfo;
 +	unsigned long *p;
 +	struct file *file;
@@ -37516,10 +37527,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	if (vfsub_f_size_read(file) <= PAGE_SIZE)
 +		goto out;
 +
-+	au_xino_lock_dir(sb, file, &ldir);
-+	/* mnt_want_write() is unnecessary here */
-+	file = au_xino_create2(sbinfo->si_xib, NULL);
-+	au_xino_unlock_dir(&ldir);
++	file = au_xino_create2(sb, &sbinfo->si_xib->f_path, NULL);
 +	err = PTR_ERR(file);
 +	if (IS_ERR(file))
 +		goto out;
@@ -37549,6 +37557,100 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +/* ---------------------------------------------------------------------- */
 +
++struct au_xino *au_xino_alloc(void)
++{
++	struct au_xino *xi;
++
++	xi = kzalloc(sizeof(*xi), GFP_NOFS);
++	if (unlikely(!xi))
++		goto out;
++
++	xi->xi_nondir.total = 8; /* initial size */
++	xi->xi_nondir.array = kcalloc(xi->xi_nondir.total, sizeof(ino_t),
++				      GFP_NOFS);
++	if (unlikely(!xi->xi_nondir.array))
++		goto out_free;
++
++	spin_lock_init(&xi->xi_nondir.spin);
++	init_waitqueue_head(&xi->xi_nondir.wqh);
++	atomic_set(&xi->xi_truncating, 0);
++	kref_init(&xi->xi_kref);
++	goto out; /* success */
++
++out_free:
++	kfree(xi);
++	xi = NULL;
++out:
++	return xi;
++}
++
++static int au_xino_init(struct au_branch *br, struct file *file)
++{
++	int err;
++	struct au_xino *xi;
++
++	err = 0;
++	xi = au_xino_alloc();
++	if (unlikely(!xi)) {
++		err = -ENOMEM;
++		goto out;
++	}
++
++	get_file(file);
++	xi->xi_file = file;
++	AuDebugOn(br->br_xino);
++	br->br_xino = xi;
++
++out:
++	return err;
++}
++
++static void au_xino_release(struct kref *kref)
++{
++	struct au_xino *xi;
++	int i;
++
++	xi = container_of(kref, struct au_xino, xi_kref);
++	if (xi->xi_file)
++		fput(xi->xi_file);
++	for (i = xi->xi_nondir.total - 1; i >= 0; i--)
++		AuDebugOn(xi->xi_nondir.array[i]);
++	kfree(xi->xi_nondir.array);
++	kfree(xi);
++}
++
++int au_xino_put(struct au_branch *br)
++{
++	int ret;
++	struct au_xino *xi;
++
++	ret = 0;
++	xi = br->br_xino;
++	if (xi) {
++		br->br_xino = NULL;
++		ret = kref_put(&xi->xi_kref, au_xino_release);
++	}
++
++	return ret;
++}
++
++void au_xino_file_set(struct au_branch *br, struct file *file)
++{
++	struct au_xino *xi;
++	struct file *f;
++
++	if (file)
++		get_file(file);
++	xi = br->br_xino;
++	AuDebugOn(!xi);
++	f = xi->xi_file;
++	if (f)
++		fput(f);
++	xi->xi_file = file;
++}
++
++/* ---------------------------------------------------------------------- */
++
 +/*
 + * xino mount option handlers
 + */
@@ -37561,8 +37663,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	SiMustWriteLock(sb);
 +
 +	sbinfo = au_sbi(sb);
-+	sbinfo->si_xread = NULL;
-+	sbinfo->si_xwrite = NULL;
++	/* unnecessary to clear sbinfo->si_xread and ->si_xwrite */
 +	if (sbinfo->si_xib)
 +		fput(sbinfo->si_xib);
 +	sbinfo->si_xib = NULL;
@@ -37571,7 +37672,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	sbinfo->si_xib_buf = NULL;
 +}
 +
-+static int au_xino_set_xib(struct super_block *sb, struct file *base)
++static int au_xino_set_xib(struct super_block *sb, struct path *path)
 +{
 +	int err;
 +	loff_t pos;
@@ -37581,7 +37682,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	SiMustWriteLock(sb);
 +
 +	sbinfo = au_sbi(sb);
-+	file = au_xino_create2(base, sbinfo->si_xib);
++	file = au_xino_create2(sb, path, sbinfo->si_xib);
 +	err = PTR_ERR(file);
 +	if (IS_ERR(file))
 +		goto out;
@@ -37618,9 +37719,8 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +out_unset:
 +	fput(sbinfo->si_xib);
 +	sbinfo->si_xib = NULL;
-+	sbinfo->si_xread = NULL;
-+	sbinfo->si_xwrite = NULL;
 +out:
++	AuTraceErr(err);
 +	return err;
 +}
 +
@@ -37633,79 +37733,90 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	bbot = au_sbbot(sb);
 +	for (bindex = 0; bindex <= bbot; bindex++) {
 +		br = au_sbr(sb, bindex);
-+		if (!br || !br->br_xino.xi_file)
-+			continue;
++		AuDebugOn(!br);
++		au_xino_put(br);
++	}
++}
++
++static void au_xino_set_br_shared(struct super_block *sb, struct au_branch *br,
++				  aufs_bindex_t bshared)
++{
++	struct au_branch *brshared;
 +
-+		fput(br->br_xino.xi_file);
-+		br->br_xino.xi_file = NULL;
++	brshared = au_sbr(sb, bshared);
++	AuDebugOn(!brshared->br_xino);
++	AuDebugOn(!brshared->br_xino->xi_file);
++	if (br->br_xino != brshared->br_xino) {
++		au_xino_get(brshared);
++		au_xino_put(br);
++		br->br_xino = brshared->br_xino;
 +	}
 +}
 +
-+static int au_xino_set_br(struct super_block *sb, struct file *base)
++struct au_xino_do_set_br {
++	vfs_writef_t writef;
++	struct au_branch *br;
++	ino_t h_ino;
++	aufs_bindex_t bshared;
++};
++
++static int au_xino_do_set_br(struct super_block *sb, struct path *path,
++			     struct au_xino_do_set_br *args)
 +{
 +	int err;
-+	ino_t ino;
-+	aufs_bindex_t bindex, bbot, bshared;
-+	struct {
-+		struct file *old, *new;
-+	} *fpair, *p;
-+	struct au_branch *br;
++	struct file *file;
++
++	if (args->bshared >= 0) {
++		/* shared xino */
++		au_xino_set_br_shared(sb, args->br, args->bshared);
++		file = au_xino_file(args->br);
++		goto out_ino; /* success */
++	}
++
++	/* new xino */
++	file = au_xino_create2(sb, path, au_xino_file(args->br));
++	err = PTR_ERR(file);
++	if (IS_ERR(file))
++		goto out;
++	if (!args->br->br_xino) {
++		err = au_xino_init(args->br, file);
++		fput(file);
++		if (unlikely(err))
++			goto out;
++	} else {
++		au_xino_file_set(args->br, file);
++		fput(file);
++	}
++
++out_ino:
++	err = au_xino_do_write(args->writef, file, args->h_ino, AUFS_ROOT_INO);
++out:
++	AuTraceErr(err);
++	return err;
++}
++
++static int au_xino_set_br(struct super_block *sb, struct path *path)
++{
++	int err;
++	aufs_bindex_t bindex, bbot;
++	struct au_xino_do_set_br args;
 +	struct inode *inode;
-+	vfs_writef_t writef;
 +
 +	SiMustWriteLock(sb);
 +
-+	err = -ENOMEM;
 +	bbot = au_sbbot(sb);
-+	fpair = kcalloc(bbot + 1, sizeof(*fpair), GFP_NOFS);
-+	if (unlikely(!fpair))
-+		goto out;
-+
 +	inode = d_inode(sb->s_root);
-+	ino = AUFS_ROOT_INO;
-+	writef = au_sbi(sb)->si_xwrite;
-+	for (bindex = 0, p = fpair; bindex <= bbot; bindex++, p++) {
-+		bshared = is_sb_shared(sb, bindex, bindex - 1);
-+		if (bshared >= 0) {
-+			/* shared xino */
-+			*p = fpair[bshared];
-+			get_file(p->new);
-+		}
-+
-+		if (!p->new) {
-+			/* new xino */
-+			br = au_sbr(sb, bindex);
-+			p->old = br->br_xino.xi_file;
-+			p->new = au_xino_create2(base, br->br_xino.xi_file);
-+			err = PTR_ERR(p->new);
-+			if (IS_ERR(p->new)) {
-+				p->new = NULL;
-+				goto out_pair;
-+			}
-+		}
-+
-+		err = au_xino_do_write(writef, p->new,
-+				       au_h_iptr(inode, bindex)->i_ino, ino);
++	args.writef = au_sbi(sb)->si_xwrite;
++	for (bindex = 0; bindex <= bbot; bindex++) {
++		args.h_ino = au_h_iptr(inode, bindex)->i_ino;
++		args.br = au_sbr(sb, bindex);
++		args.bshared = is_sb_shared(sb, bindex, bindex - 1);
++		err = au_xino_do_set_br(sb, path, &args);
 +		if (unlikely(err))
-+			goto out_pair;
-+	}
-+
-+	for (bindex = 0, p = fpair; bindex <= bbot; bindex++, p++) {
-+		br = au_sbr(sb, bindex);
-+		if (br->br_xino.xi_file)
-+			fput(br->br_xino.xi_file);
-+		get_file(p->new);
-+		br->br_xino.xi_file = p->new;
++			break;
 +	}
 +
-+out_pair:
-+	for (bindex = 0, p = fpair; bindex <= bbot; bindex++, p++)
-+		if (p->new)
-+			fput(p->new);
-+		else
-+			break;
-+	kfree(fpair);
-+out:
++	AuTraceErr(err);
 +	return err;
 +}
 +
@@ -37716,32 +37827,38 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	au_xigen_clr(sb);
 +	xino_clear_xib(sb);
 +	xino_clear_br(sb);
++	dbgaufs_brs_del(sb, 0);
++	au_xino_brid_set(sb, -1);
 +	sbinfo = au_sbi(sb);
 +	/* lvalue, do not call au_mntflags() */
 +	au_opt_clr(sbinfo->si_mntflags, XINO);
 +}
 +
-+int au_xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount)
++int au_xino_set(struct super_block *sb, struct au_opt_xino *xiopt, int remount)
 +{
 +	int err, skip;
-+	struct dentry *parent, *cur_parent;
++	struct dentry *dentry, *parent, *cur_dentry, *cur_parent;
 +	struct qstr *dname, *cur_name;
 +	struct file *cur_xino;
-+	struct inode *dir;
 +	struct au_sbinfo *sbinfo;
++	struct path *path, *cur_path;
 +
 +	SiMustWriteLock(sb);
 +
 +	err = 0;
 +	sbinfo = au_sbi(sb);
-+	parent = dget_parent(xino->file->f_path.dentry);
++	path = &xiopt->file->f_path;
++	dentry = path->dentry;
++	parent = dget_parent(dentry);
 +	if (remount) {
 +		skip = 0;
-+		dname = &xino->file->f_path.dentry->d_name;
 +		cur_xino = sbinfo->si_xib;
 +		if (cur_xino) {
-+			cur_parent = dget_parent(cur_xino->f_path.dentry);
-+			cur_name = &cur_xino->f_path.dentry->d_name;
++			cur_path = &cur_xino->f_path;
++			cur_dentry = cur_path->dentry;
++			cur_parent = dget_parent(cur_dentry);
++			cur_name = &cur_dentry->d_name;
++			dname = &dentry->d_name;
 +			skip = (cur_parent == parent
 +				&& au_qstreq(dname, cur_name));
 +			dput(cur_parent);
@@ -37751,30 +37868,26 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	}
 +
 +	au_opt_set(sbinfo->si_mntflags, XINO);
-+	dir = d_inode(parent);
-+	inode_lock_nested(dir, AuLsc_I_PARENT);
-+	/* mnt_want_write() is unnecessary here */
-+	err = au_xino_set_xib(sb, xino->file);
++	err = au_xino_set_xib(sb, path);
++	/* si_x{read,write} are set */
 +	if (!err)
-+		err = au_xigen_set(sb, xino->file);
-+	if (!err)
-+		err = au_xino_set_br(sb, xino->file);
-+	inode_unlock(dir);
++		err = au_xigen_set(sb, path);
 +	if (!err)
++		err = au_xino_set_br(sb, path);
++	if (!err) {
++		dbgaufs_brs_add(sb, 0, /*topdown*/1);
 +		goto out; /* success */
++	}
 +
 +	/* reset all */
-+	AuIOErr("failed creating xino(%d).\n", err);
-+	au_xigen_clr(sb);
-+	xino_clear_xib(sb);
++	AuIOErr("failed setting xino(%d).\n", err);
++	au_xino_clr(sb);
 +
 +out:
 +	dput(parent);
 +	return err;
 +}
 +
-+/* ---------------------------------------------------------------------- */
-+
 +/*
 + * create a xinofile at the default place/path.
 + */
@@ -37837,50 +37950,159 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +
 +/* ---------------------------------------------------------------------- */
 +
-+int au_xino_path(struct seq_file *seq, struct file *file)
++/*
++ * initialize the xinofile for the specified branch @br
++ * at the place/path where @base_file indicates.
++ * test whether another branch is on the same filesystem or not,
++ * if found then share the xinofile with another branch.
++ */
++int au_xino_init_br(struct super_block *sb, struct au_branch *br, ino_t h_ino,
++		    struct path *base)
 +{
 +	int err;
++	struct au_xino_do_set_br args = {
++		.h_ino	= h_ino,
++		.br	= br
++	};
 +
-+	err = au_seq_path(seq, &file->f_path);
++	args.writef = au_sbi(sb)->si_xwrite;
++	args.bshared = sbr_find_shared(sb, /*btop*/0, au_sbbot(sb),
++				       au_br_sb(br));
++	err = au_xino_do_set_br(sb, base, &args);
 +	if (unlikely(err))
-+		goto out;
-+
-+#define Deleted "\\040(deleted)"
-+	seq->count -= sizeof(Deleted) - 1;
-+	AuDebugOn(memcmp(seq->buf + seq->count, Deleted,
-+			 sizeof(Deleted) - 1));
-+#undef Deleted
++		au_xino_put(br);
 +
-+out:
 +	return err;
 +}
 +
 +/* ---------------------------------------------------------------------- */
 +
-+void au_xinondir_leave(struct super_block *sb, aufs_bindex_t bindex,
-+		       ino_t h_ino, int idx)
++/*
++ * get an unused inode number from bitmap
++ */
++ino_t au_xino_new_ino(struct super_block *sb)
++{
++	ino_t ino;
++	unsigned long *p, pindex, ul, pend;
++	struct au_sbinfo *sbinfo;
++	struct file *file;
++	int free_bit, err;
++
++	if (!au_opt_test(au_mntflags(sb), XINO))
++		return iunique(sb, AUFS_FIRST_INO);
++
++	sbinfo = au_sbi(sb);
++	mutex_lock(&sbinfo->si_xib_mtx);
++	p = sbinfo->si_xib_buf;
++	free_bit = sbinfo->si_xib_next_bit;
++	if (free_bit < page_bits && !test_bit(free_bit, p))
++		goto out; /* success */
++	free_bit = find_first_zero_bit(p, page_bits);
++	if (free_bit < page_bits)
++		goto out; /* success */
++
++	pindex = sbinfo->si_xib_last_pindex;
++	for (ul = pindex - 1; ul < ULONG_MAX; ul--) {
++		err = xib_pindex(sb, ul);
++		if (unlikely(err))
++			goto out_err;
++		free_bit = find_first_zero_bit(p, page_bits);
++		if (free_bit < page_bits)
++			goto out; /* success */
++	}
++
++	file = sbinfo->si_xib;
++	pend = vfsub_f_size_read(file) / PAGE_SIZE;
++	for (ul = pindex + 1; ul <= pend; ul++) {
++		err = xib_pindex(sb, ul);
++		if (unlikely(err))
++			goto out_err;
++		free_bit = find_first_zero_bit(p, page_bits);
++		if (free_bit < page_bits)
++			goto out; /* success */
++	}
++	BUG();
++
++out:
++	set_bit(free_bit, p);
++	sbinfo->si_xib_next_bit = free_bit + 1;
++	pindex = sbinfo->si_xib_last_pindex;
++	mutex_unlock(&sbinfo->si_xib_mtx);
++	ino = xib_calc_ino(pindex, free_bit);
++	AuDbg("i%lu\n", (unsigned long)ino);
++	return ino;
++out_err:
++	mutex_unlock(&sbinfo->si_xib_mtx);
++	AuDbg("i0\n");
++	return 0;
++}
++
++/* for s_op->delete_inode() */
++void au_xino_delete_inode(struct inode *inode, const int unlinked)
 +{
-+	struct au_xino_file *xino;
++	int err;
++	unsigned int mnt_flags;
++	aufs_bindex_t bindex, bbot, bi;
++	unsigned char try_trunc;
++	struct au_iinfo *iinfo;
++	struct super_block *sb;
++	struct au_hinode *hi;
++	struct inode *h_inode;
++	struct au_branch *br;
++	vfs_writef_t xwrite;
 +
-+	AuDebugOn(!au_opt_test(au_mntflags(sb), XINO));
-+	xino = &au_sbr(sb, bindex)->br_xino;
-+	AuDebugOn(idx < 0 || xino->xi_nondir.total <= idx);
++	AuDebugOn(au_is_bad_inode(inode));
 +
-+	spin_lock(&xino->xi_nondir.spin);
-+	AuDebugOn(xino->xi_nondir.array[idx] != h_ino);
-+	xino->xi_nondir.array[idx] = 0;
-+	spin_unlock(&xino->xi_nondir.spin);
-+	wake_up_all(&xino->xi_nondir.wqh);
++	sb = inode->i_sb;
++	mnt_flags = au_mntflags(sb);
++	if (!au_opt_test(mnt_flags, XINO)
++	    || inode->i_ino == AUFS_ROOT_INO)
++		return;
++
++	if (unlinked) {
++		au_xigen_inc(inode);
++		au_xib_clear_bit(inode);
++	}
++
++	iinfo = au_ii(inode);
++	bindex = iinfo->ii_btop;
++	if (bindex < 0)
++		return;
++
++	xwrite = au_sbi(sb)->si_xwrite;
++	try_trunc = !!au_opt_test(mnt_flags, TRUNC_XINO);
++	hi = au_hinode(iinfo, bindex);
++	bbot = iinfo->ii_bbot;
++	for (; bindex <= bbot; bindex++, hi++) {
++		h_inode = hi->hi_inode;
++		if (!h_inode
++		    || (!unlinked && h_inode->i_nlink))
++			continue;
++
++		/* inode may not be revalidated */
++		bi = au_br_index(sb, hi->hi_id);
++		if (bi < 0)
++			continue;
++
++		br = au_sbr(sb, bi);
++		err = au_xino_do_write(xwrite, au_xino_file(br),
++				       h_inode->i_ino, /*ino*/0);
++		if (!err && try_trunc
++		    && au_test_fs_trunc_xino(au_br_sb(br)))
++			xino_try_trunc(sb, br);
++	}
 +}
 +
-+static int au_xinondir_find(struct au_xino_file *xino, ino_t h_ino)
++/* ---------------------------------------------------------------------- */
++
++static int au_xinondir_find(struct au_xino *xi, ino_t h_ino)
 +{
 +	int found, total, i;
 +
 +	found = -1;
-+	total = xino->xi_nondir.total;
++	total = xi->xi_nondir.total;
 +	for (i = 0; i < total; i++) {
-+		if (xino->xi_nondir.array[i] != h_ino)
++		if (xi->xi_nondir.array[i] != h_ino)
 +			continue;
 +		found = i;
 +		break;
@@ -37889,7 +38111,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return found;
 +}
 +
-+static int au_xinondir_expand(struct au_xino_file *xino)
++static int au_xinondir_expand(struct au_xino *xi)
 +{
 +	int err, sz;
 +	ino_t *p;
@@ -37897,15 +38119,15 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	BUILD_BUG_ON(KMALLOC_MAX_SIZE > INT_MAX);
 +
 +	err = -ENOMEM;
-+	sz = xino->xi_nondir.total * sizeof(ino_t);
++	sz = xi->xi_nondir.total * sizeof(ino_t);
 +	if (unlikely(sz > KMALLOC_MAX_SIZE / 2))
 +		goto out;
-+	p = au_kzrealloc(xino->xi_nondir.array, sz, sz << 1, GFP_ATOMIC,
++	p = au_kzrealloc(xi->xi_nondir.array, sz, sz << 1, GFP_ATOMIC,
 +			 /*may_shrink*/0);
 +	if (p) {
-+		xino->xi_nondir.array = p;
-+		xino->xi_nondir.total <<= 1;
-+		AuDbg("xi_nondir.total %d\n", xino->xi_nondir.total);
++		xi->xi_nondir.array = p;
++		xi->xi_nondir.total <<= 1;
++		AuDbg("xi_nondir.total %d\n", xi->xi_nondir.total);
 +		err = 0;
 +	}
 +
@@ -37913,48 +38135,85 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
 +	return err;
 +}
 +
++void au_xinondir_leave(struct super_block *sb, aufs_bindex_t bindex,
++		       ino_t h_ino, int idx)
++{
++	struct au_xino *xi;
++
++	AuDebugOn(!au_opt_test(au_mntflags(sb), XINO));
++	xi = au_sbr(sb, bindex)->br_xino;
++	AuDebugOn(idx < 0 || xi->xi_nondir.total <= idx);
++
++	spin_lock(&xi->xi_nondir.spin);
++	AuDebugOn(xi->xi_nondir.array[idx] != h_ino);
++	xi->xi_nondir.array[idx] = 0;
++	spin_unlock(&xi->xi_nondir.spin);
++	wake_up_all(&xi->xi_nondir.wqh);
++}
++
 +int au_xinondir_enter(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
 +		      int *idx)
 +{
 +	int err, found, empty;
-+	struct au_xino_file *xino;
++	struct au_xino *xi;
 +
 +	err = 0;
 +	*idx = -1;
 +	if (!au_opt_test(au_mntflags(sb), XINO))
 +		goto out; /* no xino */
 +
-+	xino = &au_sbr(sb, bindex)->br_xino;
++	xi = au_sbr(sb, bindex)->br_xino;
 +
 +again:
-+	spin_lock(&xino->xi_nondir.spin);
-+	found = au_xinondir_find(xino, h_ino);
++	spin_lock(&xi->xi_nondir.spin);
++	found = au_xinondir_find(xi, h_ino);
 +	if (found == -1) {
-+		empty = au_xinondir_find(xino, /*h_ino*/0);
++		empty = au_xinondir_find(xi, /*h_ino*/0);
 +		if (empty == -1) {
-+			empty = xino->xi_nondir.total;
-+			err = au_xinondir_expand(xino);
++			empty = xi->xi_nondir.total;
++			err = au_xinondir_expand(xi);
 +			if (unlikely(err))
 +				goto out_unlock;
 +		}
-+		xino->xi_nondir.array[empty] = h_ino;
++		xi->xi_nondir.array[empty] = h_ino;
 +		*idx = empty;
 +	} else {
-+		spin_unlock(&xino->xi_nondir.spin);
-+		wait_event(xino->xi_nondir.wqh,
-+			   xino->xi_nondir.array[found] != h_ino);
++		spin_unlock(&xi->xi_nondir.spin);
++		wait_event(xi->xi_nondir.wqh,
++			   xi->xi_nondir.array[found] != h_ino);
 +		goto again;
 +	}
 +
 +out_unlock:
-+	spin_unlock(&xino->xi_nondir.spin);
++	spin_unlock(&xi->xi_nondir.spin);
++out:
++	return err;
++}
++
++/* ---------------------------------------------------------------------- */
++
++int au_xino_path(struct seq_file *seq, struct file *file)
++{
++	int err;
++
++	err = au_seq_path(seq, &file->f_path);
++	if (unlikely(err))
++		goto out;
++
++#define Deleted "\\040(deleted)"
++	seq->count -= sizeof(Deleted) - 1;
++	AuDebugOn(memcmp(seq->buf + seq->count, Deleted,
++			 sizeof(Deleted) - 1));
++#undef Deleted
++
 +out:
 +	return err;
 +}
 diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/linux/aufs_type.h
 --- /usr/share/empty/include/uapi/linux/aufs_type.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/uapi/linux/aufs_type.h	2018-06-15 11:15:32.107607516 +0200
-@@ -0,0 +1,447 @@
++++ linux/include/uapi/linux/aufs_type.h	2018-07-19 09:46:13.066648108 +0200
+@@ -0,0 +1,448 @@
++/* SPDX-License-Identifier: GPL-2.0 */
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
@@ -37996,7 +38255,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin
 +
 +#include <linux/limits.h>
 +
-+#define AUFS_VERSION	"4.17-20180611"
++#define AUFS_VERSION	"4.17-20180716"
 +
 +/* todo? move this to linux-2.6.19/include/magic.h */
 +#define AUFS_SUPER_MAGIC	('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
@@ -38434,9 +38693,9 @@ index bc965e5..852868a 100644
  	int		error;
  
 @@ -672,9 +682,16 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
- 	file = fget(arg);
- 	if (!file)
- 		goto out;
+ 	error = loop_validate_file(file, bdev);
+ 	if (error)
+ 		goto out_putf;
 +	f = loop_real_file(file);
 +	if (f) {
 +		virt_file = file;
@@ -38479,7 +38738,7 @@ index bc965e5..852868a 100644
  static int loop_set_fd(struct loop_device *lo, fmode_t mode,
  		       struct block_device *bdev, unsigned int arg)
  {
--	struct file	*file, *f;
+-	struct file	*file;
 +	struct file	*file, *f, *virt_file = NULL;
  	struct inode	*inode;
  	struct address_space *mapping;
@@ -38553,7 +38812,7 @@ index b78de98..2bbbd92 100644
  	void		*key_data; 
  
 diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c
-index ad30f42..5caf353 100644
+index 7ca7f67..3d4e90d 100644
 --- a/fs/aufs/f_op.c
 +++ b/fs/aufs/f_op.c
 @@ -358,7 +358,7 @@ static ssize_t aufs_read_iter(struct kiocb *kio, struct iov_iter *iov_iter)
@@ -38566,7 +38825,7 @@ index ad30f42..5caf353 100644
  		if (file->f_mapping != h_file->f_mapping) {
  			file->f_mapping = h_file->f_mapping;
 diff --git a/fs/aufs/loop.c b/fs/aufs/loop.c
-index 3e9d59a..42811d3 100644
+index 2d65b8f..5ed7903 100644
 --- a/fs/aufs/loop.c
 +++ b/fs/aufs/loop.c
 @@ -133,3 +133,19 @@ void au_loopback_fin(void)
@@ -38590,7 +38849,7 @@ index 3e9d59a..42811d3 100644
 +	return f;
 +}
 diff --git a/fs/aufs/loop.h b/fs/aufs/loop.h
-index dc3f3be..c33d060 100644
+index 05d703d..6bb23c8 100644
 --- a/fs/aufs/loop.h
 +++ b/fs/aufs/loop.h
 @@ -26,7 +26,11 @@ void au_warn_loopback(struct super_block *h_sb);
@@ -38615,10 +38874,10 @@ index dc3f3be..c33d060 100644
  
  #endif /* __KERNEL__ */
 diff --git a/fs/aufs/super.c b/fs/aufs/super.c
-index 80644ef..19cde48 100644
+index eed37ba..a3a5cd7 100644
 --- a/fs/aufs/super.c
 +++ b/fs/aufs/super.c
-@@ -843,7 +843,10 @@ static const struct super_operations aufs_sop = {
+@@ -840,7 +840,10 @@ static const struct super_operations aufs_sop = {
  	.statfs		= aufs_statfs,
  	.put_super	= aufs_put_super,
  	.sync_fs	= aufs_sync_fs,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/kernel.git/commitdiff/062440b31b215805734b824f7d36320744b6dda8



More information about the pld-cvs-commit mailing list