[packages/kernel/LINUX_4_9] - up to 4.9.258; rediff all patches that didn't apply with --fuzz=0

arekm arekm at pld-linux.org
Wed Feb 24 16:32:26 CET 2021


commit e8791d4f066627209238da607283bdd2b915ea33
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Feb 24 16:31:48 2021 +0100

    - up to 4.9.258; rediff all patches that didn't apply with --fuzz=0

 kernel-atm-vbr.patch              |    36 +-
 kernel-atmdd.patch                |    42 +-
 kernel-aufs4+vserver.patch        |    16 +-
 kernel-aufs4.patch                | 17357 ++++++++++++++++++------------------
 kernel-imq.patch                  |   208 +-
 kernel-layer7.patch               |  3591 ++++----
 kernel-libata-ahci-pm.patch       |   686 +-
 kernel-owner-xid.patch            |    18 +-
 kernel-pom-ng-IPV4OPTSSTRIP.patch |    29 +-
 kernel-rndis_host-wm5.patch       |    13 +-
 kernel-small_fixes.patch          |    91 +-
 kernel-vserver-2.3.patch          |  9104 +++++++++----------
 kernel.spec                       |     4 +-
 13 files changed, 15413 insertions(+), 15782 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index f64e724f..2e140127 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -73,7 +73,7 @@
 
 %define		rel		1
 %define		basever		4.9
-%define		postver		.257
+%define		postver		.258
 
 # define this to '-%{basever}' for longterm branch
 %define		versuffix	-%{basever}
@@ -125,7 +125,7 @@ Source0:	https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{basever}.tar.xz
 # Source0-md5:	0a68ef3615c64bd5ee54a3320e46667d
 %if "%{postver}" != ".0"
 Patch0:		https://www.kernel.org/pub/linux/kernel/v4.x/patch-%{version}.xz
-# Patch0-md5:	4dc24298b98c19fd51b596e0b80efc4b
+# Patch0-md5:	40cadabdcf54c16c87601c5542a71fce
 %endif
 Source1:	kernel.sysconfig
 
diff --git a/kernel-atm-vbr.patch b/kernel-atm-vbr.patch
index 28dc14b8..eb912ee8 100644
--- a/kernel-atm-vbr.patch
+++ b/kernel-atm-vbr.patch
@@ -1,11 +1,7 @@
-Index: linux/include/linux/atm.h
-===================================================================
-RCS file: /afs/cmf/project/cvsroot/linux/include/linux/atm.h,v
-retrieving revision 1.2
-diff -u -r1.2 atm.h
---- linux/include/uapi/linux/atm.h	12 Feb 2003 20:56:33 -0000	1.2
-+++ linux/include/uapi/linux/atm.h	9 Apr 2003 12:08:38 -0000
-@@ -72,7 +72,7 @@
+diff -urNp -x '*.orig' linux-4.9/include/uapi/linux/atm.h linux-4.9/include/uapi/linux/atm.h
+--- linux-4.9/include/uapi/linux/atm.h	2016-12-11 20:17:54.000000000 +0100
++++ linux-4.9/include/uapi/linux/atm.h	2021-02-24 15:38:08.999744543 +0100
+@@ -70,7 +70,7 @@
  			    /* connection identifier range; socket must be
  			       bound or connected */
  #define SO_ATMQOS	__SO_ENCODE(SOL_ATM,2,struct atm_qos)
@@ -14,7 +10,7 @@ diff -u -r1.2 atm.h
  #define SO_ATMSAP	__SO_ENCODE(SOL_ATM,3,struct atm_sap)
  			    /* Service Access Point */
  #define SO_ATMPVC	__SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
-@@ -127,9 +127,11 @@
+@@ -126,9 +126,11 @@
  #define ATM_NONE	0		/* no traffic */
  #define ATM_UBR		1
  #define ATM_CBR		2
@@ -27,7 +23,7 @@ diff -u -r1.2 atm.h
  
  #define ATM_MAX_PCR	-1		/* maximum available PCR */
  
-@@ -140,6 +142,11 @@
+@@ -139,6 +141,11 @@ struct atm_trafprm {
  	int		min_pcr;	/* minimum PCR in cells per second */
  	int		max_cdv;	/* maximum CDV in microseconds */
  	int		max_sdu;	/* maximum SDU in bytes */
@@ -39,8 +35,8 @@ diff -u -r1.2 atm.h
          /* extra params for ABR */
          unsigned int 	icr;         	/* Initial Cell Rate (24-bit) */
          unsigned int	tbe;		/* Transient Buffer Exposure (24-bit) */ 
-@@ -243,4 +251,37 @@
- };
+@@ -238,4 +245,37 @@ struct atmif_sioc {
+ 
  
  typedef unsigned short atm_backend_t;
 +struct atm_trafprm_compat {
@@ -77,14 +73,10 @@ diff -u -r1.2 atm.h
 +#define SO_ATMQOS_COMPAT __SO_ENCODE(SOL_ATM,2,struct atm_qos_compat)
 +			    /* Quality of Service setting (no vbr support) */
  #endif /* _UAPI_LINUX_ATM_H */
-Index: linux/net/atm/common.c
-===================================================================
-RCS file: /afs/cmf/project/cvsroot/linux/net/atm/common.c,v
-retrieving revision 1.13
-diff -u -r1.13 common.c
---- linux/net/atm/common.c	17 Mar 2003 16:13:12 -0000	1.13
-+++ linux/net/atm/common.c	9 Apr 2003 12:10:28 -0000
-@@ -1085,6 +1085,43 @@
+diff -urNp -x '*.orig' linux-4.9/net/atm/common.c linux-4.9/net/atm/common.c
+--- linux-4.9/net/atm/common.c	2016-12-11 20:17:54.000000000 +0100
++++ linux-4.9/net/atm/common.c	2021-02-24 15:38:08.999744543 +0100
+@@ -752,6 +752,43 @@ int vcc_setsockopt(struct socket *sock,
  
  	vcc = ATM_SD(sock);
  	switch (optname) {
@@ -128,7 +120,7 @@ diff -u -r1.13 common.c
  	case SO_ATMQOS:
  	{
  		struct atm_qos qos;
-@@ -1132,6 +1169,31 @@
+@@ -800,6 +837,31 @@ int vcc_getsockopt(struct socket *sock,
  
  	vcc = ATM_SD(sock);
  	switch (optname) {
@@ -158,5 +150,5 @@ diff -u -r1.13 common.c
 +				    -EFAULT : 0;
 +			}
  	case SO_ATMQOS:
- 		if (!test_bit(ATM_VF_HASQOS,&vcc->flags))
+ 		if (!test_bit(ATM_VF_HASQOS, &vcc->flags))
  			return -EINVAL;
diff --git a/kernel-atmdd.patch b/kernel-atmdd.patch
index a380fce1..7647ec69 100644
--- a/kernel-atmdd.patch
+++ b/kernel-atmdd.patch
@@ -1,22 +1,10 @@
-diff -urN linux-2.4.25/drivers/atm/Makefile linux-2.4.25-atmdd/drivers/atm/Makefile
---- linux-2.4.25/drivers/atm/Makefile	2004-02-23 15:18:29.000000000 +0100
-+++ linux-2.4.25-atmdd/drivers/atm/Makefile	2004-02-29 22:51:26.000000000 +0100
-@@ -31,6 +31,7 @@
- endif
- 
- obj-$(CONFIG_ATM_DUMMY)		+= adummy.o
-+obj-$(CONFIG_ATM_DD)		+= atmdd.o
- obj-$(CONFIG_ATM_TCP)		+= atmtcp.o
- obj-$(CONFIG_ATM_FIRESTREAM)	+= firestream.o
- obj-$(CONFIG_ATM_LANAI)		+= lanai.o
-diff -urN linux-2.4.25/drivers/atm/Kconfig linux-2.4.25-atmdd/drivers/atm/Kconfig
---- linux-2.4.25/drivers/atm/Kcnfig	2003-08-25 13:44:41.000000000 +0200
-+++ linux-2.4.25-atmdd/drivers/atm/Kconfig	2004-02-29 22:52:59.000000000 +0100
-@@ -4,6 +4,14 @@
- 	default y
+diff -urNp -x '*.orig' linux-4.9/drivers/atm/Kconfig linux-4.9/drivers/atm/Kconfig
+--- linux-4.9/drivers/atm/Kconfig	2021-02-24 15:42:15.767446799 +0100
++++ linux-4.9/drivers/atm/Kconfig	2021-02-24 15:42:29.767884184 +0100
+@@ -14,6 +14,14 @@ menuconfig ATM_DRIVERS
  
  if ATM_DRIVERS && NETDEVICES && ATM
-+
+ 
 +config ATM_DD
 +	tristate "ATM loopback"
 +	depends on INET && ATM
@@ -24,12 +12,24 @@ diff -urN linux-2.4.25/drivers/atm/Kconfig linux-2.4.25-atmdd/drivers/atm/Kconfi
 +	  This is an example atm driver.  It does not require any actual ATM
 +	  hardware.  It supports AAL5 and AAL0.  Frames are merely looped back
 +	  to the sender on the same VC they were sent.
- 
++
  config ATM_DUMMY
  	tristate "Dummy ATM driver"
-diff -urN linux-2.4.25/drivers/atm/atmdd.c linux-2.4.25-atmdd/drivers/atm/atmdd.c
---- linux-2.4.25/drivers/atm/atmdd.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.4.25-atmdd/drivers/atm/atmdd.c	2004-02-29 22:58:11.000000000 +0100
+ 	help
+diff -urNp -x '*.orig' linux-4.9/drivers/atm/Makefile linux-4.9/drivers/atm/Makefile
+--- linux-4.9/drivers/atm/Makefile	2016-12-11 20:17:54.000000000 +0100
++++ linux-4.9/drivers/atm/Makefile	2021-02-24 15:42:29.767884184 +0100
+@@ -25,6 +25,7 @@ ifeq ($(CONFIG_ATM_IDT77252_USE_SUNI),y)
+ endif
+ 
+ obj-$(CONFIG_ATM_DUMMY)		+= adummy.o
++obj-$(CONFIG_ATM_DD)		+= atmdd.o
+ obj-$(CONFIG_ATM_TCP)		+= atmtcp.o
+ obj-$(CONFIG_ATM_FIRESTREAM)	+= firestream.o
+ obj-$(CONFIG_ATM_LANAI)		+= lanai.o
+diff -urNp -x '*.orig' linux-4.9/drivers/atm/atmdd.c linux-4.9/drivers/atm/atmdd.c
+--- linux-4.9/drivers/atm/atmdd.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/drivers/atm/atmdd.c	2021-02-24 15:42:29.767884184 +0100
 @@ -0,0 +1,921 @@
 +/*
 +#######################################################################
diff --git a/kernel-aufs4+vserver.patch b/kernel-aufs4+vserver.patch
index 4aa67b00..c24e6adb 100644
--- a/kernel-aufs4+vserver.patch
+++ b/kernel-aufs4+vserver.patch
@@ -1,7 +1,8 @@
---- linux.aufs/fs/aufs/cpup.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.c	2013-08-23 23:59:39.631583456 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/cpup.c linux-4.9/fs/aufs/cpup.c
+--- linux-4.9/fs/aufs/cpup.c	2021-02-24 16:25:34.368384227 +0100
++++ linux-4.9/fs/aufs/cpup.c	2021-02-24 16:25:46.172095883 +0100
 @@ -24,9 +24,9 @@
- #include <linux/mm.h>
+ #include <linux/task_work.h>
  #include "aufs.h"
  
 -void au_cpup_attr_flags(struct inode *dst, unsigned int iflags)
@@ -12,7 +13,7 @@
  		| S_NOATIME | S_NOCMTIME | S_AUTOMOUNT;
  
  	BUILD_BUG_ON(sizeof(iflags) != sizeof(dst->i_flags));
-@@ -155,7 +155,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
+@@ -159,7 +159,7 @@ void au_dtime_revert(struct au_dtime *dt
  struct au_cpup_reg_attr {
  	int		valid;
  	struct kstat	st;
@@ -21,9 +22,10 @@
  };
  
  static noinline_for_stack
---- linux.aufs/fs/aufs/cpup.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.h	2013-08-23 23:59:39.634916914 +0200
-@@ -31,7 +31,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/cpup.h linux-4.9/fs/aufs/cpup.h
+--- linux-4.9/fs/aufs/cpup.h	2021-02-24 16:25:34.368384227 +0100
++++ linux-4.9/fs/aufs/cpup.h	2021-02-24 16:25:46.172095883 +0100
+@@ -30,7 +30,7 @@ struct inode;
  struct file;
  struct au_pin;
  
diff --git a/kernel-aufs4.patch b/kernel-aufs4.patch
index f409e974..1bb19e5c 100644
--- a/kernel-aufs4.patch
+++ b/kernel-aufs4.patch
@@ -1,1149 +1,6 @@
-aufs4.9 kbuild patch
-
-diff --git a/fs/Kconfig b/fs/Kconfig
-index 4bd03a2..620e01b 100644
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -249,6 +249,7 @@ source "fs/pstore/Kconfig"
- source "fs/sysv/Kconfig"
- source "fs/ufs/Kconfig"
- source "fs/exofs/Kconfig"
-+source "fs/aufs/Kconfig"
- 
- endif # MISC_FILESYSTEMS
- 
-diff --git a/fs/Makefile b/fs/Makefile
-index ed2b632..aa6d14b 100644
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -129,3 +129,4 @@ obj-y				+= exofs/ # Multiple modules
- obj-$(CONFIG_CEPH_FS)		+= ceph/
- obj-$(CONFIG_PSTORE)		+= pstore/
- obj-$(CONFIG_EFIVAR_FS)		+= efivarfs/
-+obj-$(CONFIG_AUFS_FS)           += aufs/
-diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
-index cd2be1c..78f3c68 100644
---- a/include/uapi/linux/Kbuild
-+++ b/include/uapi/linux/Kbuild
-@@ -59,6 +59,7 @@ header-y += atmsvc.h
- header-y += atm_tcp.h
- header-y += atm_zatm.h
- header-y += audit.h
-+header-y += aufs_type.h
- header-y += auto_fs4.h
- header-y += auto_fs.h
- header-y += auxvec.h
-aufs4.9 base patch
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index 63cefa6..d78b954 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -2293,6 +2293,19 @@ F:	include/linux/audit.h
- F:	include/uapi/linux/audit.h
- F:	kernel/audit*
- 
-+AUFS (advanced multi layered unification filesystem) FILESYSTEM
-+M:	"J. R. Okajima" <hooanon05g at gmail.com>
-+L:	linux-unionfs at vger.kernel.org
-+L:	aufs-users at lists.sourceforge.net (members only)
-+W:	http://aufs.sourceforge.net
-+T:	git://github.com/sfjro/aufs4-linux.git
-+S:	Supported
-+F:	Documentation/filesystems/aufs/
-+F:	Documentation/ABI/testing/debugfs-aufs
-+F:	Documentation/ABI/testing/sysfs-aufs
-+F:	fs/aufs/
-+F:	include/uapi/linux/aufs_type.h
-+
- AUXILIARY DISPLAY DRIVERS
- M:	Miguel Ojeda Sandonis <miguel.ojeda.sandonis at gmail.com>
- W:	http://miguelojeda.es/auxdisplay.htm
-diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index fa1b7a9..6ee9235 100644
---- a/drivers/block/loop.c
-+++ b/drivers/block/loop.c
-@@ -701,6 +701,24 @@ static inline int is_loop_device(struct file *file)
- 	return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
- }
- 
-+/*
-+ * for AUFS
-+ * no get/put for file.
-+ */
-+struct file *loop_backing_file(struct super_block *sb)
-+{
-+	struct file *ret;
-+	struct loop_device *l;
-+
-+	ret = NULL;
-+	if (MAJOR(sb->s_dev) == LOOP_MAJOR) {
-+		l = sb->s_bdev->bd_disk->private_data;
-+		ret = l->lo_backing_file;
-+	}
-+	return ret;
-+}
-+EXPORT_SYMBOL_GPL(loop_backing_file);
-+
- /* loop sysfs attributes */
- 
- static ssize_t loop_attr_show(struct device *dev, char *page,
-diff --git a/fs/dcache.c b/fs/dcache.c
-index 5c7cc95..df0268c 100644
---- a/fs/dcache.c
-+++ b/fs/dcache.c
-@@ -1164,7 +1164,7 @@ enum d_walk_ret {
-  *
-  * The @enter() and @finish() callbacks are called with d_lock held.
-  */
--static void d_walk(struct dentry *parent, void *data,
-+void d_walk(struct dentry *parent, void *data,
- 		   enum d_walk_ret (*enter)(void *, struct dentry *),
- 		   void (*finish)(void *))
- {
-diff --git a/fs/fcntl.c b/fs/fcntl.c
-index 350a2c8..6f42279 100644
---- a/fs/fcntl.c
-+++ b/fs/fcntl.c
-@@ -29,7 +29,7 @@
- 
- #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
- 
--static int setfl(int fd, struct file * filp, unsigned long arg)
-+int setfl(int fd, struct file * filp, unsigned long arg)
- {
- 	struct inode * inode = file_inode(filp);
- 	int error = 0;
-@@ -60,6 +60,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
- 
- 	if (filp->f_op->check_flags)
- 		error = filp->f_op->check_flags(arg);
-+	if (!error && filp->f_op->setfl)
-+		error = filp->f_op->setfl(filp, arg);
- 	if (error)
- 		return error;
- 
-diff --git a/fs/inode.c b/fs/inode.c
-index 88110fd..9a9ba3a 100644
---- a/fs/inode.c
-+++ b/fs/inode.c
-@@ -1642,7 +1642,7 @@ EXPORT_SYMBOL(generic_update_time);
-  * This does the actual work of updating an inodes time or version.  Must have
-  * had called mnt_want_write() before calling this.
-  */
--static int update_time(struct inode *inode, struct timespec *time, int flags)
-+int update_time(struct inode *inode, struct timespec *time, int flags)
- {
- 	int (*update_time)(struct inode *, struct timespec *, int);
- 
-diff --git a/fs/namespace.c b/fs/namespace.c
-index e6c234b..db0b1ac 100644
---- a/fs/namespace.c
-+++ b/fs/namespace.c
-@@ -787,6 +787,12 @@ static inline int check_mnt(struct mount *mnt)
- 	return mnt->mnt_ns == current->nsproxy->mnt_ns;
- }
- 
-+/* for aufs, CONFIG_AUFS_BR_FUSE */
-+int is_current_mnt_ns(struct vfsmount *mnt)
-+{
-+	return check_mnt(real_mount(mnt));
-+}
-+
- /*
-  * vfsmount lock must be held for write
-  */
-diff --git a/fs/read_write.c b/fs/read_write.c
-index 190e0d36..4052813 100644
---- a/fs/read_write.c
-+++ b/fs/read_write.c
-@@ -515,6 +515,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
- }
- EXPORT_SYMBOL(__vfs_write);
- 
-+vfs_readf_t vfs_readf(struct file *file)
-+{
-+	const struct file_operations *fop = file->f_op;
-+
-+	if (fop->read)
-+		return fop->read;
-+	if (fop->read_iter)
-+		return new_sync_read;
-+	return ERR_PTR(-ENOSYS);
-+}
-+
-+vfs_writef_t vfs_writef(struct file *file)
-+{
-+	const struct file_operations *fop = file->f_op;
-+
-+	if (fop->write)
-+		return fop->write;
-+	if (fop->write_iter)
-+		return new_sync_write;
-+	return ERR_PTR(-ENOSYS);
-+}
-+
- ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
- {
- 	mm_segment_t old_fs;
-diff --git a/fs/splice.c b/fs/splice.c
-index 5a7750b..28160a7 100644
---- a/fs/splice.c
-+++ b/fs/splice.c
-@@ -855,8 +855,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
- /*
-  * Attempt to initiate a splice from pipe to file.
-  */
--static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
--			   loff_t *ppos, size_t len, unsigned int flags)
-+long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
-+		    loff_t *ppos, size_t len, unsigned int flags)
- {
- 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
- 				loff_t *, size_t, unsigned int);
-@@ -872,9 +872,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
- /*
-  * Attempt to initiate a splice from a file to a pipe.
-  */
--static long do_splice_to(struct file *in, loff_t *ppos,
--			 struct pipe_inode_info *pipe, size_t len,
--			 unsigned int flags)
-+long do_splice_to(struct file *in, loff_t *ppos,
-+		  struct pipe_inode_info *pipe, size_t len,
-+		  unsigned int flags)
- {
- 	ssize_t (*splice_read)(struct file *, loff_t *,
- 			       struct pipe_inode_info *, size_t, unsigned int);
-diff --git a/fs/sync.c b/fs/sync.c
-index 2a54c1f..7a5fa3f 100644
---- a/fs/sync.c
-+++ b/fs/sync.c
-@@ -27,7 +27,7 @@
-  * wait == 1 case since in that case write_inode() functions do
-  * sync_dirty_buffer() and thus effectively write one block at a time.
-  */
--static int __sync_filesystem(struct super_block *sb, int wait)
-+int __sync_filesystem(struct super_block *sb, int wait)
- {
- 	if (wait)
- 		sync_inodes_sb(sb);
-diff --git a/include/linux/file.h b/include/linux/file.h
-index 7444f5f..bdac0be 100644
---- a/include/linux/file.h
-+++ b/include/linux/file.h
-@@ -19,6 +19,7 @@ struct dentry;
- struct path;
- extern struct file *alloc_file(struct path *, fmode_t mode,
- 	const struct file_operations *fop);
-+extern struct file *get_empty_filp(void);
- 
- static inline void fput_light(struct file *file, int fput_needed)
- {
-diff --git a/include/linux/fs.h b/include/linux/fs.h
-index dc0478c..a02be40d 100644
---- a/include/linux/fs.h
-+++ b/include/linux/fs.h
-@@ -1291,6 +1291,7 @@ extern void fasync_free(struct fasync_struct *);
- /* can be called from interrupts */
- extern void kill_fasync(struct fasync_struct **, int, int);
- 
-+extern int setfl(int fd, struct file * filp, unsigned long arg);
- extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
- extern void f_setown(struct file *filp, unsigned long arg, int force);
- extern void f_delown(struct file *filp);
-@@ -1715,6 +1716,7 @@ struct file_operations {
- 	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
- 	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
- 	int (*check_flags)(int);
-+	int (*setfl)(struct file *, unsigned long);
- 	int (*flock) (struct file *, int, struct file_lock *);
- 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
- 	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
-@@ -1768,6 +1770,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
- 			      struct iovec *fast_pointer,
- 			      struct iovec **ret_pointer);
- 
-+typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
-+typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
-+				loff_t *);
-+vfs_readf_t vfs_readf(struct file *file);
-+vfs_writef_t vfs_writef(struct file *file);
-+
- extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
- extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *);
- extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
-@@ -2140,6 +2148,7 @@ extern int current_umask(void);
- extern void ihold(struct inode * inode);
- extern void iput(struct inode *);
- extern int generic_update_time(struct inode *, struct timespec *, int);
-+extern int update_time(struct inode *, struct timespec *, int);
- 
- /* /sys/fs */
- extern struct kobject *fs_kobj;
-@@ -2419,6 +2428,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
- 	return false;
- }
- #endif
-+extern int __sync_filesystem(struct super_block *, int);
- extern int sync_filesystem(struct super_block *);
- extern const struct file_operations def_blk_fops;
- extern const struct file_operations def_chr_fops;
-diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
-index 12b2ab5..8b810d1 100644
---- a/include/linux/mnt_namespace.h
-+++ b/include/linux/mnt_namespace.h
-@@ -5,11 +5,14 @@
- struct mnt_namespace;
- struct fs_struct;
- struct user_namespace;
-+struct vfsmount;
- 
- extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
- 		struct user_namespace *, struct fs_struct *);
- extern void put_mnt_ns(struct mnt_namespace *ns);
- 
-+extern int is_current_mnt_ns(struct vfsmount *mnt);
-+
- extern const struct file_operations proc_mounts_operations;
- extern const struct file_operations proc_mountinfo_operations;
- extern const struct file_operations proc_mountstats_operations;
-diff --git a/include/linux/splice.h b/include/linux/splice.h
-index 00a2116..1f0a4a2 100644
---- a/include/linux/splice.h
-+++ b/include/linux/splice.h
-@@ -86,4 +86,10 @@ extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
- 
- extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
- extern const struct pipe_buf_operations default_pipe_buf_ops;
-+
-+extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
-+			   loff_t *ppos, size_t len, unsigned int flags);
-+extern long do_splice_to(struct file *in, loff_t *ppos,
-+			 struct pipe_inode_info *pipe, size_t len,
-+			 unsigned int flags);
- #endif
-aufs4.9 mmap patch
-
-diff --git a/fs/proc/base.c b/fs/proc/base.c
-index ca651ac..0e8551a 100644
---- a/fs/proc/base.c
-+++ b/fs/proc/base.c
-@@ -1953,7 +1953,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path)
- 	down_read(&mm->mmap_sem);
- 	vma = find_exact_vma(mm, vm_start, vm_end);
- 	if (vma && vma->vm_file) {
--		*path = vma->vm_file->f_path;
-+		*path = vma_pr_or_file(vma)->f_path;
- 		path_get(path);
- 		rc = 0;
- 	}
-diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
-index f8595e8..cb8eda0 100644
---- a/fs/proc/nommu.c
-+++ b/fs/proc/nommu.c
-@@ -45,7 +45,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
- 	file = region->vm_file;
- 
- 	if (file) {
--		struct inode *inode = file_inode(region->vm_file);
-+		struct inode *inode;
-+
-+		file = vmr_pr_or_file(region);
-+		inode = file_inode(file);
- 		dev = inode->i_sb->s_dev;
- 		ino = inode->i_ino;
- 	}
-diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
-index 35b92d8..5b981db 100644
---- a/fs/proc/task_mmu.c
-+++ b/fs/proc/task_mmu.c
-@@ -291,7 +291,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
- 	const char *name = NULL;
- 
- 	if (file) {
--		struct inode *inode = file_inode(vma->vm_file);
-+		struct inode *inode;
-+
-+		file = vma_pr_or_file(vma);
-+		inode = file_inode(file);
- 		dev = inode->i_sb->s_dev;
- 		ino = inode->i_ino;
- 		pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
-@@ -1627,7 +1630,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
- 	struct proc_maps_private *proc_priv = &numa_priv->proc_maps;
- 	struct vm_area_struct *vma = v;
- 	struct numa_maps *md = &numa_priv->md;
--	struct file *file = vma->vm_file;
-+	struct file *file = vma_pr_or_file(vma);
- 	struct mm_struct *mm = vma->vm_mm;
- 	struct mm_walk walk = {
- 		.hugetlb_entry = gather_hugetlb_stats,
-diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
-index 3717562..6a328f1 100644
---- a/fs/proc/task_nommu.c
-+++ b/fs/proc/task_nommu.c
-@@ -155,7 +155,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
- 	file = vma->vm_file;
- 
- 	if (file) {
--		struct inode *inode = file_inode(vma->vm_file);
-+		struct inode *inode;
-+
-+		file = vma_pr_or_file(vma);
-+		inode = file_inode(file);
- 		dev = inode->i_sb->s_dev;
- 		ino = inode->i_ino;
- 		pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
-diff --git a/include/linux/mm.h b/include/linux/mm.h
-index a92c8d7..1d83a2a 100644
---- a/include/linux/mm.h
-+++ b/include/linux/mm.h
-@@ -1266,6 +1266,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
- }
- #endif
- 
-+extern void vma_do_file_update_time(struct vm_area_struct *, const char[], int);
-+extern struct file *vma_do_pr_or_file(struct vm_area_struct *, const char[],
-+				      int);
-+extern void vma_do_get_file(struct vm_area_struct *, const char[], int);
-+extern void vma_do_fput(struct vm_area_struct *, const char[], int);
-+
-+#define vma_file_update_time(vma)	vma_do_file_update_time(vma, __func__, \
-+								__LINE__)
-+#define vma_pr_or_file(vma)		vma_do_pr_or_file(vma, __func__, \
-+							  __LINE__)
-+#define vma_get_file(vma)		vma_do_get_file(vma, __func__, __LINE__)
-+#define vma_fput(vma)			vma_do_fput(vma, __func__, __LINE__)
-+
-+#ifndef CONFIG_MMU
-+extern struct file *vmr_do_pr_or_file(struct vm_region *, const char[], int);
-+extern void vmr_do_fput(struct vm_region *, const char[], int);
-+
-+#define vmr_pr_or_file(region)		vmr_do_pr_or_file(region, __func__, \
-+							  __LINE__)
-+#define vmr_fput(region)		vmr_do_fput(region, __func__, __LINE__)
-+#endif /* !CONFIG_MMU */
-+
- extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len,
- 		unsigned int gup_flags);
- extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
-diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
-index 4a8aced..badd16b 100644
---- a/include/linux/mm_types.h
-+++ b/include/linux/mm_types.h
-@@ -275,6 +275,7 @@ struct vm_region {
- 	unsigned long	vm_top;		/* region allocated to here */
- 	unsigned long	vm_pgoff;	/* the offset in vm_file corresponding to vm_start */
- 	struct file	*vm_file;	/* the backing file or NULL */
-+	struct file	*vm_prfile;	/* the virtual backing file or NULL */
- 
- 	int		vm_usage;	/* region usage count (access under nommu_region_sem) */
- 	bool		vm_icache_flushed : 1; /* true if the icache has been flushed for
-@@ -349,6 +350,7 @@ struct vm_area_struct {
- 	unsigned long vm_pgoff;		/* Offset (within vm_file) in PAGE_SIZE
- 					   units */
- 	struct file * vm_file;		/* File we map to (can be NULL). */
-+	struct file *vm_prfile;		/* shadow of vm_file */
- 	void * vm_private_data;		/* was vm_pte (shared mem) */
- 
- #ifndef CONFIG_MMU
-diff --git a/kernel/fork.c b/kernel/fork.c
-index 997ac1d..4d0131b 100644
---- a/kernel/fork.c
-+++ b/kernel/fork.c
-@@ -624,7 +624,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
- 			struct inode *inode = file_inode(file);
- 			struct address_space *mapping = file->f_mapping;
- 
--			get_file(file);
-+			vma_get_file(tmp);
- 			if (tmp->vm_flags & VM_DENYWRITE)
- 				atomic_dec(&inode->i_writecount);
- 			i_mmap_lock_write(mapping);
-diff --git a/mm/Makefile b/mm/Makefile
-index 295bd7a..14fa1c8 100644
---- a/mm/Makefile
-+++ b/mm/Makefile
-@@ -37,7 +37,7 @@ obj-y			:= filemap.o mempool.o oom_kill.o \
- 			   mm_init.o mmu_context.o percpu.o slab_common.o \
- 			   compaction.o vmacache.o \
- 			   interval_tree.o list_lru.o workingset.o \
--			   debug.o $(mmu-y)
-+			   prfile.o debug.o $(mmu-y)
- 
- obj-y += init-mm.o
- 
-diff --git a/mm/filemap.c b/mm/filemap.c
-index 50b52fe..9e607f9 100644
---- a/mm/filemap.c
-+++ b/mm/filemap.c
-@@ -2304,7 +2304,7 @@ int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
- 	int ret = VM_FAULT_LOCKED;
- 
- 	sb_start_pagefault(inode->i_sb);
--	file_update_time(vma->vm_file);
-+	vma_file_update_time(vma);
- 	lock_page(page);
- 	if (page->mapping != inode->i_mapping) {
- 		unlock_page(page);
-diff --git a/mm/memory.c b/mm/memory.c
-index e18c57b..7be4a39 100644
---- a/mm/memory.c
-+++ b/mm/memory.c
-@@ -2117,7 +2117,7 @@ static inline int wp_page_reuse(struct fault_env *fe, pte_t orig_pte,
- 		}
- 
- 		if (!page_mkwrite)
--			file_update_time(vma->vm_file);
-+			vma_file_update_time(vma);
- 	}
- 
- 	return VM_FAULT_WRITE;
-diff --git a/mm/mmap.c b/mm/mmap.c
-index 1af87c1..95b0ff4 100644
---- a/mm/mmap.c
-+++ b/mm/mmap.c
-@@ -170,7 +170,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
- 	if (vma->vm_ops && vma->vm_ops->close)
- 		vma->vm_ops->close(vma);
- 	if (vma->vm_file)
--		fput(vma->vm_file);
-+		vma_fput(vma);
- 	mpol_put(vma_policy(vma));
- 	kmem_cache_free(vm_area_cachep, vma);
- 	return next;
-@@ -879,7 +879,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
- 	if (remove_next) {
- 		if (file) {
- 			uprobe_munmap(next, next->vm_start, next->vm_end);
--			fput(file);
-+			vma_fput(vma);
- 		}
- 		if (next->anon_vma)
- 			anon_vma_merge(vma, next);
-@@ -1727,8 +1727,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
- 	return addr;
- 
- unmap_and_free_vma:
-+	vma_fput(vma);
- 	vma->vm_file = NULL;
--	fput(file);
- 
- 	/* Undo any partial mapping done by a device driver. */
- 	unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end);
-@@ -2533,7 +2533,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
- 		goto out_free_mpol;
- 
- 	if (new->vm_file)
--		get_file(new->vm_file);
-+		vma_get_file(new);
- 
- 	if (new->vm_ops && new->vm_ops->open)
- 		new->vm_ops->open(new);
-@@ -2552,7 +2552,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
- 	if (new->vm_ops && new->vm_ops->close)
- 		new->vm_ops->close(new);
- 	if (new->vm_file)
--		fput(new->vm_file);
-+		vma_fput(new);
- 	unlink_anon_vmas(new);
-  out_free_mpol:
- 	mpol_put(vma_policy(new));
-@@ -2703,7 +2703,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
- 	struct vm_area_struct *vma;
- 	unsigned long populate = 0;
- 	unsigned long ret = -EINVAL;
--	struct file *file;
-+	struct file *file, *prfile;
- 
- 	pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.\n",
- 		     current->comm, current->pid);
-@@ -2778,10 +2778,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
- 		}
- 	}
- 
--	file = get_file(vma->vm_file);
-+	vma_get_file(vma);
-+	file = vma->vm_file;
-+	prfile = vma->vm_prfile;
- 	ret = do_mmap_pgoff(vma->vm_file, start, size,
- 			prot, flags, pgoff, &populate);
-+	if (!IS_ERR_VALUE(ret) && file && prfile) {
-+		struct vm_area_struct *new_vma;
-+
-+		new_vma = find_vma(mm, ret);
-+		if (!new_vma->vm_prfile)
-+			new_vma->vm_prfile = prfile;
-+		if (new_vma != vma)
-+			get_file(prfile);
-+	}
-+	/*
-+	 * two fput()s instead of vma_fput(vma),
-+	 * coz vma may not be available anymore.
-+	 */
- 	fput(file);
-+	if (prfile)
-+		fput(prfile);
- out:
- 	up_write(&mm->mmap_sem);
- 	if (populate)
-@@ -3056,7 +3073,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
- 		if (anon_vma_clone(new_vma, vma))
- 			goto out_free_mempol;
- 		if (new_vma->vm_file)
--			get_file(new_vma->vm_file);
-+			vma_get_file(new_vma);
- 		if (new_vma->vm_ops && new_vma->vm_ops->open)
- 			new_vma->vm_ops->open(new_vma);
- 		vma_link(mm, new_vma, prev, rb_link, rb_parent);
-diff --git a/mm/nommu.c b/mm/nommu.c
-index 8b8faaf..5d26ed94 100644
---- a/mm/nommu.c
-+++ b/mm/nommu.c
-@@ -636,7 +636,7 @@ static void __put_nommu_region(struct vm_region *region)
- 		up_write(&nommu_region_sem);
- 
- 		if (region->vm_file)
--			fput(region->vm_file);
-+			vmr_fput(region);
- 
- 		/* IO memory and memory shared directly out of the pagecache
- 		 * from ramfs/tmpfs mustn't be released here */
-@@ -794,7 +794,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma)
- 	if (vma->vm_ops && vma->vm_ops->close)
- 		vma->vm_ops->close(vma);
- 	if (vma->vm_file)
--		fput(vma->vm_file);
-+		vma_fput(vma);
- 	put_nommu_region(vma->vm_region);
- 	kmem_cache_free(vm_area_cachep, vma);
- }
-@@ -1320,7 +1320,7 @@ unsigned long do_mmap(struct file *file,
- 					goto error_just_free;
- 				}
- 			}
--			fput(region->vm_file);
-+			vmr_fput(region);
- 			kmem_cache_free(vm_region_jar, region);
- 			region = pregion;
- 			result = start;
-@@ -1395,10 +1395,10 @@ unsigned long do_mmap(struct file *file,
- 	up_write(&nommu_region_sem);
- error:
- 	if (region->vm_file)
--		fput(region->vm_file);
-+		vmr_fput(region);
- 	kmem_cache_free(vm_region_jar, region);
- 	if (vma->vm_file)
--		fput(vma->vm_file);
-+		vma_fput(vma);
- 	kmem_cache_free(vm_area_cachep, vma);
- 	return ret;
- 
-diff --git a/mm/prfile.c b/mm/prfile.c
-new file mode 100644
-index 0000000..86e01bd
---- /dev/null
-+++ b/mm/prfile.c
-@@ -0,0 +1,85 @@
-+/*
-+ * 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.
-+ *
-+ * See Documentation/filesystems/aufs/design/06mmap.txt
-+ *
-+ * Copyright (c) 2014-2018 Junjro R. Okajima
-+ * Copyright (c) 2014 Ian Campbell
-+ */
-+
-+#include <linux/mm.h>
-+#include <linux/file.h>
-+#include <linux/fs.h>
-+
-+/* #define PRFILE_TRACE */
-+static inline void prfile_trace(struct file *f, struct file *pr,
-+			      const char func[], int line, const char func2[])
-+{
-+#ifdef PRFILE_TRACE
-+	if (pr)
-+		pr_info("%s:%d: %s, %pD2\n", func, line, func2, f);
-+#endif
-+}
-+
-+void vma_do_file_update_time(struct vm_area_struct *vma, const char func[],
-+			     int line)
-+{
-+	struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-+
-+	prfile_trace(f, pr, func, line, __func__);
-+	file_update_time(f);
-+	if (f && pr)
-+		file_update_time(pr);
-+}
-+
-+struct file *vma_do_pr_or_file(struct vm_area_struct *vma, const char func[],
-+			       int line)
-+{
-+	struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-+
-+	prfile_trace(f, pr, func, line, __func__);
-+	return (f && pr) ? pr : f;
-+}
-+
-+void vma_do_get_file(struct vm_area_struct *vma, const char func[], int line)
-+{
-+	struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-+
-+	prfile_trace(f, pr, func, line, __func__);
-+	get_file(f);
-+	if (f && pr)
-+		get_file(pr);
-+}
-+
-+void vma_do_fput(struct vm_area_struct *vma, const char func[], int line)
-+{
-+	struct file *f = vma->vm_file, *pr = vma->vm_prfile;
-+
-+	prfile_trace(f, pr, func, line, __func__);
-+	fput(f);
-+	if (f && pr)
-+		fput(pr);
-+}
-+
-+#ifndef CONFIG_MMU
-+struct file *vmr_do_pr_or_file(struct vm_region *region, const char func[],
-+			       int line)
-+{
-+	struct file *f = region->vm_file, *pr = region->vm_prfile;
-+
-+	prfile_trace(f, pr, func, line, __func__);
-+	return (f && pr) ? pr : f;
-+}
-+
-+void vmr_do_fput(struct vm_region *region, const char func[], int line)
-+{
-+	struct file *f = region->vm_file, *pr = region->vm_prfile;
-+
-+	prfile_trace(f, pr, func, line, __func__);
-+	fput(f);
-+	if (f && pr)
-+		fput(pr);
-+}
-+#endif /* !CONFIG_MMU */
-aufs4.9 standalone patch
-
-diff --git a/fs/dcache.c b/fs/dcache.c
-index df0268c..755fea1 100644
---- a/fs/dcache.c
-+++ b/fs/dcache.c
-@@ -1272,6 +1272,7 @@ void d_walk(struct dentry *parent, void *data,
- 	seq = 1;
- 	goto again;
- }
-+EXPORT_SYMBOL_GPL(d_walk);
- 
- /*
-  * Search for at least 1 mount point in the dentry's subdirs.
-@@ -2855,6 +2856,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2)
- 
- 	write_sequnlock(&rename_lock);
- }
-+EXPORT_SYMBOL_GPL(d_exchange);
- 
- /**
-  * d_ancestor - search for an ancestor
-diff --git a/fs/exec.c b/fs/exec.c
-index 4e497b9..e27d323 100644
---- a/fs/exec.c
-+++ b/fs/exec.c
-@@ -104,6 +104,7 @@ bool path_noexec(const struct path *path)
- 	return (path->mnt->mnt_flags & MNT_NOEXEC) ||
- 	       (path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC);
- }
-+EXPORT_SYMBOL_GPL(path_noexec);
- 
- #ifdef CONFIG_USELIB
- /*
-diff --git a/fs/fcntl.c b/fs/fcntl.c
-index 6f42279..04fd33c 100644
---- a/fs/fcntl.c
-+++ b/fs/fcntl.c
-@@ -82,6 +82,7 @@ int setfl(int fd, struct file * filp, unsigned long arg)
-  out:
- 	return error;
- }
-+EXPORT_SYMBOL_GPL(setfl);
- 
- static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
-                      int force)
-diff --git a/fs/file_table.c b/fs/file_table.c
-index ad17e05..ae9f267 100644
---- a/fs/file_table.c
-+++ b/fs/file_table.c
-@@ -147,6 +147,7 @@ struct file *get_empty_filp(void)
- 	}
- 	return ERR_PTR(-ENFILE);
- }
-+EXPORT_SYMBOL_GPL(get_empty_filp);
- 
- /**
-  * alloc_file - allocate and initialize a 'struct file'
-@@ -258,6 +259,7 @@ void flush_delayed_fput(void)
- {
- 	delayed_fput(NULL);
- }
-+EXPORT_SYMBOL_GPL(flush_delayed_fput);
- 
- static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);
- 
-@@ -300,6 +302,7 @@ void __fput_sync(struct file *file)
- }
- 
- EXPORT_SYMBOL(fput);
-+EXPORT_SYMBOL_GPL(__fput_sync);
- 
- void put_filp(struct file *file)
- {
-@@ -308,6 +311,7 @@ void put_filp(struct file *file)
- 		file_free(file);
- 	}
- }
-+EXPORT_SYMBOL_GPL(put_filp);
- 
- void __init files_init(void)
- { 
-diff --git a/fs/inode.c b/fs/inode.c
-index 9a9ba3a..a3a18d83 100644
---- a/fs/inode.c
-+++ b/fs/inode.c
-@@ -1651,6 +1651,7 @@ int update_time(struct inode *inode, struct timespec *time, int flags)
- 
- 	return update_time(inode, time, flags);
- }
-+EXPORT_SYMBOL_GPL(update_time);
- 
- /**
-  *	touch_atime	-	update the access time
-diff --git a/fs/namespace.c b/fs/namespace.c
-index db0b1ac..2d1e8ff 100644
---- a/fs/namespace.c
-+++ b/fs/namespace.c
-@@ -466,6 +466,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
- 	mnt_dec_writers(real_mount(mnt));
- 	preempt_enable();
- }
-+EXPORT_SYMBOL_GPL(__mnt_drop_write);
- 
- /**
-  * mnt_drop_write - give up write access to a mount
-@@ -792,6 +793,7 @@ int is_current_mnt_ns(struct vfsmount *mnt)
- {
- 	return check_mnt(real_mount(mnt));
- }
-+EXPORT_SYMBOL_GPL(is_current_mnt_ns);
- 
- /*
-  * vfsmount lock must be held for write
-@@ -1829,6 +1831,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
- 	}
- 	return 0;
- }
-+EXPORT_SYMBOL_GPL(iterate_mounts);
- 
- static void cleanup_group_ids(struct mount *mnt, struct mount *end)
- {
-diff --git a/fs/notify/group.c b/fs/notify/group.c
-index fbe3cbe..bdfc61e 100644
---- a/fs/notify/group.c
-+++ b/fs/notify/group.c
-@@ -22,6 +22,7 @@
- #include <linux/srcu.h>
- #include <linux/rculist.h>
- #include <linux/wait.h>
-+#include <linux/module.h>
- 
- #include <linux/fsnotify_backend.h>
- #include "fsnotify.h"
-@@ -100,6 +101,7 @@ void fsnotify_get_group(struct fsnotify_group *group)
- {
- 	atomic_inc(&group->refcnt);
- }
-+EXPORT_SYMBOL_GPL(fsnotify_get_group);
- 
- /*
-  * Drop a reference to a group.  Free it if it's through.
-@@ -109,6 +111,7 @@ void fsnotify_put_group(struct fsnotify_group *group)
- 	if (atomic_dec_and_test(&group->refcnt))
- 		fsnotify_final_destroy_group(group);
- }
-+EXPORT_SYMBOL_GPL(fsnotify_put_group);
- 
- /*
-  * Create a new fsnotify_group and hold a reference for the group returned.
-@@ -137,6 +140,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
- 
- 	return group;
- }
-+EXPORT_SYMBOL_GPL(fsnotify_alloc_group);
- 
- int fsnotify_fasync(int fd, struct file *file, int on)
- {
-diff --git a/fs/notify/mark.c b/fs/notify/mark.c
-index d3fea0b..5fc06ad 100644
---- a/fs/notify/mark.c
-+++ b/fs/notify/mark.c
-@@ -113,6 +113,7 @@ void fsnotify_put_mark(struct fsnotify_mark *mark)
- 		mark->free_mark(mark);
- 	}
- }
-+EXPORT_SYMBOL_GPL(fsnotify_put_mark);
- 
- /* Calculate mask of events for a list of marks */
- u32 fsnotify_recalc_mask(struct hlist_head *head)
-@@ -230,6 +231,7 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark,
- 	mutex_unlock(&group->mark_mutex);
- 	fsnotify_free_mark(mark);
- }
-+EXPORT_SYMBOL_GPL(fsnotify_destroy_mark);
- 
- void fsnotify_destroy_marks(struct hlist_head *head, spinlock_t *lock)
- {
-@@ -415,6 +417,7 @@ int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
- 
- 	return ret;
- }
-+EXPORT_SYMBOL_GPL(fsnotify_add_mark);
- 
- int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
- 		      struct inode *inode, struct vfsmount *mnt, int allow_dups)
-@@ -533,6 +536,7 @@ void fsnotify_init_mark(struct fsnotify_mark *mark,
- 	atomic_set(&mark->refcnt, 1);
- 	mark->free_mark = free_mark;
- }
-+EXPORT_SYMBOL_GPL(fsnotify_init_mark);
- 
- /*
-  * Destroy all marks in destroy_list, waits for SRCU period to finish before
-diff --git a/fs/open.c b/fs/open.c
-index d3ed817..20d2494 100644
---- a/fs/open.c
-+++ b/fs/open.c
-@@ -64,6 +64,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
- 	inode_unlock(dentry->d_inode);
- 	return ret;
- }
-+EXPORT_SYMBOL_GPL(do_truncate);
- 
- long vfs_truncate(const struct path *path, loff_t length)
- {
-@@ -695,6 +696,7 @@ int open_check_o_direct(struct file *f)
- 	}
- 	return 0;
- }
-+EXPORT_SYMBOL_GPL(open_check_o_direct);
- 
- static int do_dentry_open(struct file *f,
- 			  struct inode *inode,
-diff --git a/fs/read_write.c b/fs/read_write.c
-index 4052813..7dfd732 100644
---- a/fs/read_write.c
-+++ b/fs/read_write.c
-@@ -525,6 +525,7 @@ vfs_readf_t vfs_readf(struct file *file)
- 		return new_sync_read;
- 	return ERR_PTR(-ENOSYS);
- }
-+EXPORT_SYMBOL_GPL(vfs_readf);
- 
- vfs_writef_t vfs_writef(struct file *file)
- {
-@@ -536,6 +537,7 @@ vfs_writef_t vfs_writef(struct file *file)
- 		return new_sync_write;
- 	return ERR_PTR(-ENOSYS);
- }
-+EXPORT_SYMBOL_GPL(vfs_writef);
- 
- ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos)
- {
-diff --git a/fs/splice.c b/fs/splice.c
-index 28160a7..98c1902 100644
---- a/fs/splice.c
-+++ b/fs/splice.c
-@@ -868,6 +868,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
- 
- 	return splice_write(pipe, out, ppos, len, flags);
- }
-+EXPORT_SYMBOL_GPL(do_splice_from);
- 
- /*
-  * Attempt to initiate a splice from a file to a pipe.
-@@ -897,6 +898,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
- 
- 	return splice_read(in, ppos, pipe, len, flags);
- }
-+EXPORT_SYMBOL_GPL(do_splice_to);
- 
- /**
-  * splice_direct_to_actor - splices data directly between two non-pipes
-diff --git a/fs/sync.c b/fs/sync.c
-index 7a5fa3f..c9b9d46 100644
---- a/fs/sync.c
-+++ b/fs/sync.c
-@@ -38,6 +38,7 @@ int __sync_filesystem(struct super_block *sb, int wait)
- 		sb->s_op->sync_fs(sb, wait);
- 	return __sync_blockdev(sb->s_bdev, wait);
- }
-+EXPORT_SYMBOL_GPL(__sync_filesystem);
- 
- /*
-  * Write out and wait upon all dirty data associated with this
-diff --git a/fs/xattr.c b/fs/xattr.c
-index 2d13b4e..41c2bcd 100644
---- a/fs/xattr.c
-+++ b/fs/xattr.c
-@@ -296,6 +296,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
- 	*xattr_value = value;
- 	return error;
- }
-+EXPORT_SYMBOL_GPL(vfs_getxattr_alloc);
- 
- ssize_t
- __vfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name,
-diff --git a/kernel/task_work.c b/kernel/task_work.c
-index d513051..e056d54 100644
---- a/kernel/task_work.c
-+++ b/kernel/task_work.c
-@@ -119,3 +119,4 @@ void task_work_run(void)
- 		} while (work);
- 	}
- }
-+EXPORT_SYMBOL_GPL(task_work_run);
-diff --git a/security/commoncap.c b/security/commoncap.c
-index 8df676f..6b5cc07 100644
---- a/security/commoncap.c
-+++ b/security/commoncap.c
-@@ -1061,12 +1061,14 @@ int cap_mmap_addr(unsigned long addr)
- 	}
- 	return ret;
- }
-+EXPORT_SYMBOL_GPL(cap_mmap_addr);
- 
- int cap_mmap_file(struct file *file, unsigned long reqprot,
- 		  unsigned long prot, unsigned long flags)
- {
- 	return 0;
- }
-+EXPORT_SYMBOL_GPL(cap_mmap_file);
- 
- #ifdef CONFIG_SECURITY
- 
-diff --git a/security/device_cgroup.c b/security/device_cgroup.c
-index 03c1652..f88c84b 100644
---- a/security/device_cgroup.c
-+++ b/security/device_cgroup.c
-@@ -7,6 +7,7 @@
- #include <linux/device_cgroup.h>
- #include <linux/cgroup.h>
- #include <linux/ctype.h>
-+#include <linux/export.h>
- #include <linux/list.h>
- #include <linux/uaccess.h>
- #include <linux/seq_file.h>
-@@ -849,6 +850,7 @@ int __devcgroup_inode_permission(struct inode *inode, int mask)
- 	return __devcgroup_check_permission(type, imajor(inode), iminor(inode),
- 			access);
- }
-+EXPORT_SYMBOL_GPL(__devcgroup_inode_permission);
- 
- int devcgroup_inode_mknod(int mode, dev_t dev)
- {
-diff --git a/security/security.c b/security/security.c
-index f825304..8dd441d 100644
---- a/security/security.c
-+++ b/security/security.c
-@@ -443,6 +443,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
- 		return 0;
- 	return call_int_hook(path_rmdir, 0, dir, dentry);
- }
-+EXPORT_SYMBOL_GPL(security_path_rmdir);
- 
- int security_path_unlink(const struct path *dir, struct dentry *dentry)
- {
-@@ -459,6 +460,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry,
- 		return 0;
- 	return call_int_hook(path_symlink, 0, dir, dentry, old_name);
- }
-+EXPORT_SYMBOL_GPL(security_path_symlink);
- 
- int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
- 		       struct dentry *new_dentry)
-@@ -467,6 +469,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
- 		return 0;
- 	return call_int_hook(path_link, 0, old_dentry, new_dir, new_dentry);
- }
-+EXPORT_SYMBOL_GPL(security_path_link);
- 
- int security_path_rename(const struct path *old_dir, struct dentry *old_dentry,
- 			 const struct path *new_dir, struct dentry *new_dentry,
-@@ -494,6 +497,7 @@ int security_path_truncate(const struct path *path)
- 		return 0;
- 	return call_int_hook(path_truncate, 0, path);
- }
-+EXPORT_SYMBOL_GPL(security_path_truncate);
- 
- int security_path_chmod(const struct path *path, umode_t mode)
- {
-@@ -501,6 +505,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
- 		return 0;
- 	return call_int_hook(path_chmod, 0, path, mode);
- }
-+EXPORT_SYMBOL_GPL(security_path_chmod);
- 
- int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
- {
-@@ -508,6 +513,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
- 		return 0;
- 	return call_int_hook(path_chown, 0, path, uid, gid);
- }
-+EXPORT_SYMBOL_GPL(security_path_chown);
- 
- int security_path_chroot(const struct path *path)
- {
-@@ -593,6 +599,7 @@ int security_inode_readlink(struct dentry *dentry)
- 		return 0;
- 	return call_int_hook(inode_readlink, 0, dentry);
- }
-+EXPORT_SYMBOL_GPL(security_inode_readlink);
- 
- int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
- 			       bool rcu)
-@@ -608,6 +615,7 @@ int security_inode_permission(struct inode *inode, int mask)
- 		return 0;
- 	return call_int_hook(inode_permission, 0, inode, mask);
- }
-+EXPORT_SYMBOL_GPL(security_inode_permission);
- 
- int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
- {
-@@ -779,6 +787,7 @@ int security_file_permission(struct file *file, int mask)
- 
- 	return fsnotify_perm(file, mask);
- }
-+EXPORT_SYMBOL_GPL(security_file_permission);
- 
- int security_file_alloc(struct file *file)
- {
-@@ -838,6 +847,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
- 		return ret;
- 	return ima_file_mmap(file, prot);
- }
-+EXPORT_SYMBOL_GPL(security_mmap_file);
- 
- int security_mmap_addr(unsigned long addr)
- {
-diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Documentation/ABI/testing/debugfs-aufs
---- /usr/share/empty/Documentation/ABI/testing/debugfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/debugfs-aufs	2017-07-29 12:14:25.893041746 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/ABI/testing/debugfs-aufs linux-4.9/Documentation/ABI/testing/debugfs-aufs
+--- linux-4.9/Documentation/ABI/testing/debugfs-aufs	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/ABI/testing/debugfs-aufs	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,50 @@
 +What:		/debug/aufs/si_<id>/
 +Date:		March 2009
@@ -1195,9 +52,9 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document
 +		be created.
 +		When the aufs mount option 'noxino' is specified, it
 +		will be empty. About XINO files, see the aufs manual.
-diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentation/ABI/testing/sysfs-aufs
---- /usr/share/empty/Documentation/ABI/testing/sysfs-aufs	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/ABI/testing/sysfs-aufs	2017-07-29 12:14:25.893041746 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/ABI/testing/sysfs-aufs linux-4.9/Documentation/ABI/testing/sysfs-aufs
+--- linux-4.9/Documentation/ABI/testing/sysfs-aufs	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/ABI/testing/sysfs-aufs	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,31 @@
 +What:		/sys/fs/aufs/si_<id>/
 +Date:		March 2009
@@ -1230,9 +87,406 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentat
 +		even if it is the default path.
 +		When the aufs mount option 'noxino' is specified, it
 +		will be empty. About XINO files, see the aufs manual.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt linux/Documentation/filesystems/aufs/design/01intro.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/01intro.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/README linux-4.9/Documentation/filesystems/aufs/README
+--- linux-4.9/Documentation/filesystems/aufs/README	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/README	2021-02-24 16:15:09.521573529 +0100
+@@ -0,0 +1,393 @@
++
++Aufs4 -- advanced multi layered unification filesystem version 4.x
++http://aufs.sf.net
++Junjiro R. Okajima
++
++
++0. Introduction
++----------------------------------------
++In the early days, aufs was entirely re-designed and re-implemented
++Unionfs Version 1.x series. Adding many original ideas, approaches,
++improvements and implementations, it becomes totally different from
++Unionfs while keeping the basic features.
++Recently, Unionfs Version 2.x series begin taking some of the same
++approaches to aufs1's.
++Unionfs is being developed by Professor Erez Zadok at Stony Brook
++University and his team.
++
++Aufs4 supports linux-4.0 and later, and for linux-3.x series try aufs3.
++If you want older kernel version support, try aufs2-2.6.git or
++aufs2-standalone.git repository, aufs1 from CVS on SourceForge.
++
++Note: it becomes clear that "Aufs was rejected. Let's give it up."
++      According to Christoph Hellwig, linux rejects all union-type
++      filesystems but UnionMount.
++<http://marc.info/?l=linux-kernel&m=123938533724484&w=2>
++
++PS. Al Viro seems have a plan to merge aufs as well as overlayfs and
++    UnionMount, and he pointed out an issue around a directory mutex
++    lock and aufs addressed it. But it is still unsure whether aufs will
++    be merged (or any other union solution).
++<http://marc.info/?l=linux-kernel&m=136312705029295&w=1>
++
++
++1. Features
++----------------------------------------
++- unite several directories into a single virtual filesystem. The member
++  directory is called as a branch.
++- you can specify the permission flags to the branch, which are 'readonly',
++  'readwrite' and 'whiteout-able.'
++- by upper writable branch, internal copyup and whiteout, files/dirs on
++  readonly branch are modifiable logically.
++- dynamic branch manipulation, add, del.
++- etc...
++
++Also there are many enhancements in aufs, such as:
++- test only the highest one for the directory permission (dirperm1)
++- copyup on open (coo=)
++- 'move' policy for copy-up between two writable branches, after
++  checking free space.
++- xattr, acl
++- readdir(3) in userspace.
++- keep inode number by external inode number table
++- keep the timestamps of file/dir in internal copyup operation
++- seekable directory, supporting NFS readdir.
++- whiteout is hardlinked in order to reduce the consumption of inodes
++  on branch
++- do not copyup, nor create a whiteout when it is unnecessary
++- revert a single systemcall when an error occurs in aufs
++- remount interface instead of ioctl
++- maintain /etc/mtab by an external command, /sbin/mount.aufs.
++- loopback mounted filesystem as a branch
++- kernel thread for removing the dir who has a plenty of whiteouts
++- support copyup sparse file (a file which has a 'hole' in it)
++- default permission flags for branches
++- selectable permission flags for ro branch, whether whiteout can
++  exist or not
++- export via NFS.
++- support <sysfs>/fs/aufs and <debugfs>/aufs.
++- support multiple writable branches, some policies to select one
++  among multiple writable branches.
++- a new semantics for link(2) and rename(2) to support multiple
++  writable branches.
++- no glibc changes are required.
++- pseudo hardlink (hardlink over branches)
++- allow a direct access manually to a file on branch, e.g. bypassing aufs.
++  including NFS or remote filesystem branch.
++- userspace wrapper for pathconf(3)/fpathconf(3) with _PC_LINK_MAX.
++- and more...
++
++Currently these features are dropped temporary from aufs4.
++See design/08plan.txt in detail.
++- nested mount, i.e. aufs as readonly no-whiteout branch of another aufs
++  (robr)
++- statistics of aufs thread (/sys/fs/aufs/stat)
++
++Features or just an idea in the future (see also design/*.txt),
++- reorder the branch index without del/re-add.
++- permanent xino files for NFSD
++- an option for refreshing the opened files after add/del branches
++- light version, without branch manipulation. (unnecessary?)
++- copyup in userspace
++- inotify in userspace
++- readv/writev
++
++
++2. Download
++----------------------------------------
++There are three GIT trees for aufs4, aufs4-linux.git,
++aufs4-standalone.git, and aufs-util.git. Note that there is no "4" in
++"aufs-util.git."
++While the aufs-util is always necessary, you need either of aufs4-linux
++or aufs4-standalone.
++
++The aufs4-linux tree includes the whole linux mainline GIT tree,
++git://git.kernel.org/.../torvalds/linux.git.
++And you cannot select CONFIG_AUFS_FS=m for this version, eg. you cannot
++build aufs4 as an external kernel module.
++Several extra patches are not included in this tree. Only
++aufs4-standalone tree contains them. They are described in the later
++section "Configuration and Compilation."
++
++On the other hand, the aufs4-standalone tree has only aufs source files
++and necessary patches, and you can select CONFIG_AUFS_FS=m.
++But you need to apply all aufs patches manually.
++
++You will find GIT branches whose name is in form of "aufs4.x" where "x"
++represents the linux kernel version, "linux-4.x". For instance,
++"aufs4.0" is for linux-4.0. For latest "linux-4.x-rcN", use
++"aufs4.x-rcN" branch.
++
++o aufs4-linux tree
++$ git clone --reference /your/linux/git/tree \
++	git://github.com/sfjro/aufs4-linux.git aufs4-linux.git
++- if you don't have linux GIT tree, then remove "--reference ..."
++$ cd aufs4-linux.git
++$ git checkout origin/aufs4.0
++
++Or You may want to directly git-pull aufs into your linux GIT tree, and
++leave the patch-work to GIT.
++$ cd /your/linux/git/tree
++$ git remote add aufs4 git://github.com/sfjro/aufs4-linux.git
++$ git fetch aufs4
++$ git checkout -b my4.0 v4.0
++$ (add your local change...)
++$ git pull aufs4 aufs4.0
++- now you have v4.0 + your_changes + aufs4.0 in you my4.0 branch.
++- you may need to solve some conflicts between your_changes and
++  aufs4.0. in this case, git-rerere is recommended so that you can
++  solve the similar conflicts automatically when you upgrade to 4.1 or
++  later in the future.
++
++o aufs4-standalone tree
++$ git clone git://github.com/sfjro/aufs4-standalone.git aufs4-standalone.git
++$ cd aufs4-standalone.git
++$ git checkout origin/aufs4.0
++
++o aufs-util tree
++$ git clone git://git.code.sf.net/p/aufs/aufs-util aufs-util.git
++- note that the public aufs-util.git is on SourceForge instead of
++  GitHUB.
++$ cd aufs-util.git
++$ git checkout origin/aufs4.0
++
++Note: The 4.x-rcN branch is to be used with `rc' kernel versions ONLY.
++The minor version number, 'x' in '4.x', of aufs may not always
++follow the minor version number of the kernel.
++Because changes in the kernel that cause the use of a new
++minor version number do not always require changes to aufs-util.
++
++Since aufs-util has its own minor version number, you may not be
++able to find a GIT branch in aufs-util for your kernel's
++exact minor version number.
++In this case, you should git-checkout the branch for the
++nearest lower number.
++
++For (an unreleased) example:
++If you are using "linux-4.10" and the "aufs4.10" branch
++does not exist in aufs-util repository, then "aufs4.9", "aufs4.8"
++or something numerically smaller is the branch for your kernel.
++
++Also you can view all branches by
++	$ git branch -a
++
++
++3. Configuration and Compilation
++----------------------------------------
++Make sure you have git-checkout'ed the correct branch.
++
++For aufs4-linux tree,
++- enable CONFIG_AUFS_FS.
++- set other aufs configurations if necessary.
++
++For aufs4-standalone tree,
++There are several ways to build.
++
++1.
++- apply ./aufs4-kbuild.patch to your kernel source files.
++- apply ./aufs4-base.patch too.
++- apply ./aufs4-mmap.patch too.
++- apply ./aufs4-standalone.patch too, if you have a plan to set
++  CONFIG_AUFS_FS=m. otherwise you don't need ./aufs4-standalone.patch.
++- copy ./{Documentation,fs,include/uapi/linux/aufs_type.h} files to your
++  kernel source tree. Never copy $PWD/include/uapi/linux/Kbuild.
++- enable CONFIG_AUFS_FS, you can select either
++  =m or =y.
++- and build your kernel as usual.
++- install the built kernel.
++  Note: Since linux-3.9, every filesystem module requires an alias
++  "fs-<fsname>". You should make sure that "fs-aufs" is listed in your
++  modules.aliases file if you set CONFIG_AUFS_FS=m.
++- install the header files too by "make headers_install" to the
++  directory where you specify. By default, it is $PWD/usr.
++  "make help" shows a brief note for headers_install.
++- and reboot your system.
++
++2.
++- module only (CONFIG_AUFS_FS=m).
++- apply ./aufs4-base.patch to your kernel source files.
++- apply ./aufs4-mmap.patch too.
++- apply ./aufs4-standalone.patch too.
++- build your kernel, don't forget "make headers_install", and reboot.
++- edit ./config.mk and set other aufs configurations if necessary.
++  Note: You should read $PWD/fs/aufs/Kconfig carefully which describes
++  every aufs configurations.
++- build the module by simple "make".
++  Note: Since linux-3.9, every filesystem module requires an alias
++  "fs-<fsname>". You should make sure that "fs-aufs" is listed in your
++  modules.aliases file.
++- you can specify ${KDIR} make variable which points to your kernel
++  source tree.
++- install the files
++  + run "make install" to install the aufs module, or copy the built
++    $PWD/aufs.ko to /lib/modules/... and run depmod -a (or reboot simply).
++  + run "make install_headers" (instead of headers_install) to install
++    the modified aufs header file (you can specify DESTDIR which is
++    available in aufs standalone version's Makefile only), or copy
++    $PWD/usr/include/linux/aufs_type.h to /usr/include/linux or wherever
++    you like manually. By default, the target directory is $PWD/usr.
++- no need to apply aufs4-kbuild.patch, nor copying source files to your
++  kernel source tree.
++
++Note: The header file aufs_type.h is necessary to build aufs-util
++      as well as "make headers_install" in the kernel source tree.
++      headers_install is subject to be forgotten, but it is essentially
++      necessary, not only for building aufs-util.
++      You may not meet problems without headers_install in some older
++      version though.
++
++And then,
++- read README in aufs-util, build and install it
++- note that your distribution may contain an obsoleted version of
++  aufs_type.h in /usr/include/linux or something. When you build aufs
++  utilities, make sure that your compiler refers the correct aufs header
++  file which is built by "make headers_install."
++- if you want to use readdir(3) in userspace or pathconf(3) wrapper,
++  then run "make install_ulib" too. And refer to the aufs manual in
++  detail.
++
++There several other patches in aufs4-standalone.git. They are all
++optional. When you meet some problems, they will help you.
++- aufs4-loopback.patch
++  Supports a nested loopback mount in a branch-fs. This patch is
++  unnecessary until aufs produces a message like "you may want to try
++  another patch for loopback file".
++- vfs-ino.patch
++  Modifies a system global kernel internal function get_next_ino() in
++  order to stop assigning 0 for an inode-number. Not directly related to
++  aufs, but recommended generally.
++- tmpfs-idr.patch
++  Keeps the tmpfs inode number as the lowest value. Effective to reduce
++  the size of aufs XINO files for tmpfs branch. Also it prevents the
++  duplication of inode number, which is important for backup tools and
++  other utilities. When you find aufs XINO files for tmpfs branch
++  growing too much, try this patch.
++- lockdep-debug.patch
++  Because aufs is not only an ordinary filesystem (callee of VFS), but
++  also a caller of VFS functions for branch filesystems, subclassing of
++  the internal locks for LOCKDEP is necessary. LOCKDEP is a debugging
++  feature of linux kernel. If you enable CONFIG_LOCKDEP, then you will
++  need to apply this debug patch to expand several constant values.
++  If don't know what LOCKDEP, then you don't have apply this patch.
++
++
++4. Usage
++----------------------------------------
++At first, make sure aufs-util are installed, and please read the aufs
++manual, aufs.5 in aufs-util.git tree.
++$ man -l aufs.5
++
++And then,
++$ mkdir /tmp/rw /tmp/aufs
++# mount -t aufs -o br=/tmp/rw:${HOME} none /tmp/aufs
++
++Here is another example. The result is equivalent.
++# mount -t aufs -o br=/tmp/rw=rw:${HOME}=ro none /tmp/aufs
++  Or
++# mount -t aufs -o br:/tmp/rw none /tmp/aufs
++# mount -o remount,append:${HOME} /tmp/aufs
++
++Then, you can see whole tree of your home dir through /tmp/aufs. If
++you modify a file under /tmp/aufs, the one on your home directory is
++not affected, instead the same named file will be newly created under
++/tmp/rw. And all of your modification to a file will be applied to
++the one under /tmp/rw. This is called the file based Copy on Write
++(COW) method.
++Aufs mount options are described in aufs.5.
++If you run chroot or something and make your aufs as a root directory,
++then you need to customize the shutdown script. See the aufs manual in
++detail.
++
++Additionally, there are some sample usages of aufs which are a
++diskless system with network booting, and LiveCD over NFS.
++See sample dir in CVS tree on SourceForge.
++
++
++5. Contact
++----------------------------------------
++When you have any problems or strange behaviour in aufs, please let me
++know with:
++- /proc/mounts (instead of the output of mount(8))
++- /sys/module/aufs/*
++- /sys/fs/aufs/* (if you have them)
++- /debug/aufs/* (if you have them)
++- linux kernel version
++  if your kernel is not plain, for example modified by distributor,
++  the url where i can download its source is necessary too.
++- aufs version which was printed at loading the module or booting the
++  system, instead of the date you downloaded.
++- configuration (define/undefine CONFIG_AUFS_xxx)
++- kernel configuration or /proc/config.gz (if you have it)
++- behaviour which you think to be incorrect
++- actual operation, reproducible one is better
++- mailto: aufs-users at lists.sourceforge.net
++
++Usually, I don't watch the Public Areas(Bugs, Support Requests, Patches,
++and Feature Requests) on SourceForge. Please join and write to
++aufs-users ML.
++
++
++6. Acknowledgements
++----------------------------------------
++Thanks to everyone who have tried and are using aufs, whoever
++have reported a bug or any feedback.
++
++Especially donators:
++Tomas Matejicek(slax.org) made a donation (much more than once).
++	Since Apr 2010, Tomas M (the author of Slax and Linux Live
++	scripts) is making "doubling" donations.
++	Unfortunately I cannot list all of the donators, but I really
++	appreciate.
++	It ends Aug 2010, but the ordinary donation URL is still available.
++	<http://sourceforge.net/donate/index.php?group_id=167503>
++Dai Itasaka made a donation (2007/8).
++Chuck Smith made a donation (2008/4, 10 and 12).
++Henk Schoneveld made a donation (2008/9).
++Chih-Wei Huang, ASUS, CTC donated Eee PC 4G (2008/10).
++Francois Dupoux made a donation (2008/11).
++Bruno Cesar Ribas and Luis Carlos Erpen de Bona, C3SL serves public
++	aufs2 GIT tree (2009/2).
++William Grant made a donation (2009/3).
++Patrick Lane made a donation (2009/4).
++The Mail Archive (mail-archive.com) made donations (2009/5).
++Nippy Networks (Ed Wildgoose) made a donation (2009/7).
++New Dream Network, LLC (www.dreamhost.com) made a donation (2009/11).
++Pavel Pronskiy made a donation (2011/2).
++Iridium and Inmarsat satellite phone retailer (www.mailasail.com), Nippy
++	Networks (Ed Wildgoose) made a donation for hardware (2011/3).
++Max Lekomcev (DOM-TV project) made a donation (2011/7, 12, 2012/3, 6 and
++11).
++Sam Liddicott made a donation (2011/9).
++Era Scarecrow made a donation (2013/4).
++Bor Ratajc made a donation (2013/4).
++Alessandro Gorreta made a donation (2013/4).
++POIRETTE Marc made a donation (2013/4).
++Alessandro Gorreta made a donation (2013/4).
++lauri kasvandik made a donation (2013/5).
++"pemasu from Finland" made a donation (2013/7).
++The Parted Magic Project made a donation (2013/9 and 11).
++Pavel Barta made a donation (2013/10).
++Nikolay Pertsev made a donation (2014/5).
++James B made a donation (2014/7 and 2015/7).
++Stefano Di Biase made a donation (2014/8).
++Daniel Epellei made a donation (2015/1).
++OmegaPhil made a donation (2016/1).
++Tomasz Szewczyk made a donation (2016/4).
++James Burry made a donation (2016/12).
++
++Thank you very much.
++Donations are always, including future donations, very important and
++helpful for me to keep on developing aufs.
++
++
++7.
++----------------------------------------
++If you are an experienced user, no explanation is needed. Aufs is
++just a linux filesystem.
++
++
++Enjoy!
++
++# Local variables: ;
++# mode: text;
++# End: ;
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/01intro.txt linux-4.9/Documentation/filesystems/aufs/design/01intro.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/01intro.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/01intro.txt	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,171 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -1405,9 +659,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt lin
 +Some people may think it is better to pass such work to user space
 +helper, instead of doing in kernel space. Actually I am still thinking
 +about it. But currently I have implemented it in kernel space.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt linux/Documentation/filesystems/aufs/design/02struct.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/02struct.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/02struct.txt linux-4.9/Documentation/filesystems/aufs/design/02struct.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/02struct.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/02struct.txt	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,258 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -1667,9 +921,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt li
 +- etc.
 +
 +For this purpose, use "aumvdown" command in aufs-util.git.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.txt linux/Documentation/filesystems/aufs/design/03atomic_open.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/03atomic_open.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/03atomic_open.txt linux-4.9/Documentation/filesystems/aufs/design/03atomic_open.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/03atomic_open.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/03atomic_open.txt	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,85 @@
 +
 +# Copyright (C) 2015-2018 Junjiro R. Okajima
@@ -1756,9 +1010,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.t
 +       ->atomic_open() are lost. in the ordinary case, the checks are
 +       done by VFS:do_last(), lookup_open() and atomic_open(). some can
 +       be implemented in aufs, but not all I am afraid.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt linux/Documentation/filesystems/aufs/design/03lookup.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/03lookup.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/03lookup.txt linux-4.9/Documentation/filesystems/aufs/design/03lookup.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/03lookup.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/03lookup.txt	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,113 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -1873,9 +1127,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt li
 +   test, and skip the revalidation in step 4. It is useful and improves
 +   aufs performance when system surely hide the aufs branches from user,
 +   by over-mounting something (or another method).
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt linux/Documentation/filesystems/aufs/design/04branch.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/04branch.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/04branch.txt linux-4.9/Documentation/filesystems/aufs/design/04branch.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/04branch.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/04branch.txt	2021-02-24 16:15:09.518240088 +0100
 @@ -0,0 +1,74 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -1951,9 +1205,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt li
 +  - a file on the branch is mmap-ed.
 +  - a regular file on the branch is opened for write and there is no
 +    same named entry on the upper branch.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt linux/Documentation/filesystems/aufs/design/05wbr_policy.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/05wbr_policy.txt linux-4.9/Documentation/filesystems/aufs/design/05wbr_policy.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/05wbr_policy.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/05wbr_policy.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,64 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -2019,9 +1273,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.tx
 +  where the source and the target exists and selects the higher
 +  one. If the selected branch is readonly, then aufs follows the
 +  copyup policy.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.dot linux/Documentation/filesystems/aufs/design/06dirren.dot
---- /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.dot	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06dirren.dot	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/06dirren.dot linux-4.9/Documentation/filesystems/aufs/design/06dirren.dot
+--- linux-4.9/Documentation/filesystems/aufs/design/06dirren.dot	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/06dirren.dot	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,31 @@
 +
 +// to view this graph, run dot(1) command in GRAPHVIZ.
@@ -2054,9 +1308,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.dot li
 +
 +aufs_lookup -> whinfo [label="load/remove"];
 +}
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.txt linux/Documentation/filesystems/aufs/design/06dirren.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06dirren.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/06dirren.txt linux-4.9/Documentation/filesystems/aufs/design/06dirren.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/06dirren.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/06dirren.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,102 @@
 +
 +# Copyright (C) 2017-2018 Junjiro R. Okajima
@@ -2160,9 +1414,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.txt li
 +contains two names, before- and after-rename, the name comparision in
 +UDBA handler may not work correctly. In this case, the behaviour will be
 +equivalen to udba=reval case.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt linux/Documentation/filesystems/aufs/design/06fhsm.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06fhsm.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/06fhsm.txt linux-4.9/Documentation/filesystems/aufs/design/06fhsm.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/06fhsm.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/06fhsm.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,120 @@
 +
 +# Copyright (C) 2011-2018 Junjiro R. Okajima
@@ -2284,9 +1538,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt linu
 +
 +And of course, in every step, an error may happen. So the operation
 +should restore the original file state after an error happens.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linux/Documentation/filesystems/aufs/design/06mmap.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06mmap.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/06mmap.txt linux-4.9/Documentation/filesystems/aufs/design/06mmap.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/06mmap.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/06mmap.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,72 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -2360,9 +1614,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linu
 +  equivalent to vm_prfile described above.
 +
 +I have to give up this "looks-smater" approach.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt linux/Documentation/filesystems/aufs/design/06xattr.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/06xattr.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/06xattr.txt linux-4.9/Documentation/filesystems/aufs/design/06xattr.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/06xattr.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/06xattr.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,96 @@
 +
 +# Copyright (C) 2014-2018 Junjiro R. Okajima
@@ -2460,9 +1714,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt lin
 +Some contradiction may happen I am afraid.
 +Do we need another attribute to stop copying XATTR? I am unsure. For
 +now, aufs implements the branch attributes to ignore the error.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt linux/Documentation/filesystems/aufs/design/07export.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/07export.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/07export.txt linux-4.9/Documentation/filesystems/aufs/design/07export.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/07export.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/07export.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,58 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -2522,9 +1776,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt li
 +  convert it into ESTALE for NFSD.
 +- readdir(): call lockdep_on/off() because filldir in NFSD calls
 +  lookup_one_len(), vfs_getattr(), encode_fh() and others.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linux/Documentation/filesystems/aufs/design/08shwh.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/08shwh.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/08shwh.txt linux-4.9/Documentation/filesystems/aufs/design/08shwh.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/08shwh.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/08shwh.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,52 @@
 +
 +# Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -2578,9 +1832,9 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linu
 +
 +This new squashfs archive can be stored on the boot device and the
 +initramfs will use it to replace the old one at the next boot.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt linux/Documentation/filesystems/aufs/design/10dynop.txt
---- /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/10dynop.txt	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/Documentation/filesystems/aufs/design/10dynop.txt linux-4.9/Documentation/filesystems/aufs/design/10dynop.txt
+--- linux-4.9/Documentation/filesystems/aufs/design/10dynop.txt	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/Documentation/filesystems/aufs/design/10dynop.txt	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,47 @@
 +
 +# Copyright (C) 2010-2018 Junjiro R. Okajima
@@ -2629,406 +1883,505 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt lin
 +XIP (DAX) mainly.
 +Currently this approach is applied to address_space_operations for
 +regular files only.
-diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documentation/filesystems/aufs/README
---- /usr/share/empty/Documentation/filesystems/aufs/README	1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/README	2017-07-29 12:14:25.893041746 +0200
-@@ -0,0 +1,393 @@
-+
-+Aufs4 -- advanced multi layered unification filesystem version 4.x
-+http://aufs.sf.net
-+Junjiro R. Okajima
-+
-+
-+0. Introduction
-+----------------------------------------
-+In the early days, aufs was entirely re-designed and re-implemented
-+Unionfs Version 1.x series. Adding many original ideas, approaches,
-+improvements and implementations, it becomes totally different from
-+Unionfs while keeping the basic features.
-+Recently, Unionfs Version 2.x series begin taking some of the same
-+approaches to aufs1's.
-+Unionfs is being developed by Professor Erez Zadok at Stony Brook
-+University and his team.
-+
-+Aufs4 supports linux-4.0 and later, and for linux-3.x series try aufs3.
-+If you want older kernel version support, try aufs2-2.6.git or
-+aufs2-standalone.git repository, aufs1 from CVS on SourceForge.
-+
-+Note: it becomes clear that "Aufs was rejected. Let's give it up."
-+      According to Christoph Hellwig, linux rejects all union-type
-+      filesystems but UnionMount.
-+<http://marc.info/?l=linux-kernel&m=123938533724484&w=2>
-+
-+PS. Al Viro seems have a plan to merge aufs as well as overlayfs and
-+    UnionMount, and he pointed out an issue around a directory mutex
-+    lock and aufs addressed it. But it is still unsure whether aufs will
-+    be merged (or any other union solution).
-+<http://marc.info/?l=linux-kernel&m=136312705029295&w=1>
-+
-+
-+1. Features
-+----------------------------------------
-+- unite several directories into a single virtual filesystem. The member
-+  directory is called as a branch.
-+- you can specify the permission flags to the branch, which are 'readonly',
-+  'readwrite' and 'whiteout-able.'
-+- by upper writable branch, internal copyup and whiteout, files/dirs on
-+  readonly branch are modifiable logically.
-+- dynamic branch manipulation, add, del.
-+- etc...
-+
-+Also there are many enhancements in aufs, such as:
-+- test only the highest one for the directory permission (dirperm1)
-+- copyup on open (coo=)
-+- 'move' policy for copy-up between two writable branches, after
-+  checking free space.
-+- xattr, acl
-+- readdir(3) in userspace.
-+- keep inode number by external inode number table
-+- keep the timestamps of file/dir in internal copyup operation
-+- seekable directory, supporting NFS readdir.
-+- whiteout is hardlinked in order to reduce the consumption of inodes
-+  on branch
-+- do not copyup, nor create a whiteout when it is unnecessary
-+- revert a single systemcall when an error occurs in aufs
-+- remount interface instead of ioctl
-+- maintain /etc/mtab by an external command, /sbin/mount.aufs.
-+- loopback mounted filesystem as a branch
-+- kernel thread for removing the dir who has a plenty of whiteouts
-+- support copyup sparse file (a file which has a 'hole' in it)
-+- default permission flags for branches
-+- selectable permission flags for ro branch, whether whiteout can
-+  exist or not
-+- export via NFS.
-+- support <sysfs>/fs/aufs and <debugfs>/aufs.
-+- support multiple writable branches, some policies to select one
-+  among multiple writable branches.
-+- a new semantics for link(2) and rename(2) to support multiple
-+  writable branches.
-+- no glibc changes are required.
-+- pseudo hardlink (hardlink over branches)
-+- allow a direct access manually to a file on branch, e.g. bypassing aufs.
-+  including NFS or remote filesystem branch.
-+- userspace wrapper for pathconf(3)/fpathconf(3) with _PC_LINK_MAX.
-+- and more...
-+
-+Currently these features are dropped temporary from aufs4.
-+See design/08plan.txt in detail.
-+- nested mount, i.e. aufs as readonly no-whiteout branch of another aufs
-+  (robr)
-+- statistics of aufs thread (/sys/fs/aufs/stat)
-+
-+Features or just an idea in the future (see also design/*.txt),
-+- reorder the branch index without del/re-add.
-+- permanent xino files for NFSD
-+- an option for refreshing the opened files after add/del branches
-+- light version, without branch manipulation. (unnecessary?)
-+- copyup in userspace
-+- inotify in userspace
-+- readv/writev
-+
-+
-+2. Download
-+----------------------------------------
-+There are three GIT trees for aufs4, aufs4-linux.git,
-+aufs4-standalone.git, and aufs-util.git. Note that there is no "4" in
-+"aufs-util.git."
-+While the aufs-util is always necessary, you need either of aufs4-linux
-+or aufs4-standalone.
-+
-+The aufs4-linux tree includes the whole linux mainline GIT tree,
-+git://git.kernel.org/.../torvalds/linux.git.
-+And you cannot select CONFIG_AUFS_FS=m for this version, eg. you cannot
-+build aufs4 as an external kernel module.
-+Several extra patches are not included in this tree. Only
-+aufs4-standalone tree contains them. They are described in the later
-+section "Configuration and Compilation."
-+
-+On the other hand, the aufs4-standalone tree has only aufs source files
-+and necessary patches, and you can select CONFIG_AUFS_FS=m.
-+But you need to apply all aufs patches manually.
-+
-+You will find GIT branches whose name is in form of "aufs4.x" where "x"
-+represents the linux kernel version, "linux-4.x". For instance,
-+"aufs4.0" is for linux-4.0. For latest "linux-4.x-rcN", use
-+"aufs4.x-rcN" branch.
-+
-+o aufs4-linux tree
-+$ git clone --reference /your/linux/git/tree \
-+	git://github.com/sfjro/aufs4-linux.git aufs4-linux.git
-+- if you don't have linux GIT tree, then remove "--reference ..."
-+$ cd aufs4-linux.git
-+$ git checkout origin/aufs4.0
-+
-+Or You may want to directly git-pull aufs into your linux GIT tree, and
-+leave the patch-work to GIT.
-+$ cd /your/linux/git/tree
-+$ git remote add aufs4 git://github.com/sfjro/aufs4-linux.git
-+$ git fetch aufs4
-+$ git checkout -b my4.0 v4.0
-+$ (add your local change...)
-+$ git pull aufs4 aufs4.0
-+- now you have v4.0 + your_changes + aufs4.0 in you my4.0 branch.
-+- you may need to solve some conflicts between your_changes and
-+  aufs4.0. in this case, git-rerere is recommended so that you can
-+  solve the similar conflicts automatically when you upgrade to 4.1 or
-+  later in the future.
-+
-+o aufs4-standalone tree
-+$ git clone git://github.com/sfjro/aufs4-standalone.git aufs4-standalone.git
-+$ cd aufs4-standalone.git
-+$ git checkout origin/aufs4.0
-+
-+o aufs-util tree
-+$ git clone git://git.code.sf.net/p/aufs/aufs-util aufs-util.git
-+- note that the public aufs-util.git is on SourceForge instead of
-+  GitHUB.
-+$ cd aufs-util.git
-+$ git checkout origin/aufs4.0
-+
-+Note: The 4.x-rcN branch is to be used with `rc' kernel versions ONLY.
-+The minor version number, 'x' in '4.x', of aufs may not always
-+follow the minor version number of the kernel.
-+Because changes in the kernel that cause the use of a new
-+minor version number do not always require changes to aufs-util.
-+
-+Since aufs-util has its own minor version number, you may not be
-+able to find a GIT branch in aufs-util for your kernel's
-+exact minor version number.
-+In this case, you should git-checkout the branch for the
-+nearest lower number.
-+
-+For (an unreleased) example:
-+If you are using "linux-4.10" and the "aufs4.10" branch
-+does not exist in aufs-util repository, then "aufs4.9", "aufs4.8"
-+or something numerically smaller is the branch for your kernel.
-+
-+Also you can view all branches by
-+	$ git branch -a
+diff -urNp -x '*.orig' linux-4.9/MAINTAINERS linux-4.9/MAINTAINERS
+--- linux-4.9/MAINTAINERS	2021-02-24 16:14:54.924432098 +0100
++++ linux-4.9/MAINTAINERS	2021-02-24 16:15:09.504906321 +0100
+@@ -2293,6 +2293,19 @@ F:	include/linux/audit.h
+ F:	include/uapi/linux/audit.h
+ F:	kernel/audit*
+ 
++AUFS (advanced multi layered unification filesystem) FILESYSTEM
++M:	"J. R. Okajima" <hooanon05g at gmail.com>
++L:	linux-unionfs at vger.kernel.org
++L:	aufs-users at lists.sourceforge.net (members only)
++W:	http://aufs.sourceforge.net
++T:	git://github.com/sfjro/aufs4-linux.git
++S:	Supported
++F:	Documentation/filesystems/aufs/
++F:	Documentation/ABI/testing/debugfs-aufs
++F:	Documentation/ABI/testing/sysfs-aufs
++F:	fs/aufs/
++F:	include/uapi/linux/aufs_type.h
 +
+ AUXILIARY DISPLAY DRIVERS
+ M:	Miguel Ojeda Sandonis <miguel.ojeda.sandonis at gmail.com>
+ W:	http://miguelojeda.es/auxdisplay.htm
+diff -urNp -x '*.orig' linux-4.9/drivers/block/loop.c linux-4.9/drivers/block/loop.c
+--- linux-4.9/drivers/block/loop.c	2021-02-24 16:14:57.284508877 +0100
++++ linux-4.9/drivers/block/loop.c	2021-02-24 16:15:09.538240738 +0100
+@@ -552,7 +552,7 @@ static int do_req_filebacked(struct loop
+ }
+ 
+ struct switch_request {
+-	struct file *file;
++	struct file *file, *virt_file;
+ 	struct completion wait;
+ };
+ 
+@@ -578,6 +578,7 @@ static void do_loop_switch(struct loop_d
+ 	mapping = file->f_mapping;
+ 	mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
+ 	lo->lo_backing_file = file;
++	lo->lo_backing_virt_file = p->virt_file;
+ 	lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ?
+ 		mapping->host->i_bdev->bd_block_size : PAGE_SIZE;
+ 	lo->old_gfp_mask = mapping_gfp_mask(mapping);
+@@ -590,11 +591,13 @@ static void do_loop_switch(struct loop_d
+  * First it needs to flush existing IO, it does this by sending a magic
+  * BIO down the pipe. The completion of this BIO does the actual switch.
+  */
+-static int loop_switch(struct loop_device *lo, struct file *file)
++static int loop_switch(struct loop_device *lo, struct file *file,
++		       struct file *virt_file)
+ {
+ 	struct switch_request w;
+ 
+ 	w.file = file;
++	w.virt_file = virt_file;
+ 
+ 	/* freeze queue and wait for completion of scheduled requests */
+ 	blk_mq_freeze_queue(lo->lo_queue);
+@@ -616,7 +619,16 @@ static int loop_flush(struct loop_device
+ 	/* loop not yet configured, no running thread, nothing to flush */
+ 	if (lo->lo_state != Lo_bound)
+ 		return 0;
+-	return loop_switch(lo, NULL);
++	return loop_switch(lo, NULL, NULL);
++}
 +
-+3. Configuration and Compilation
-+----------------------------------------
-+Make sure you have git-checkout'ed the correct branch.
++static struct file *loop_real_file(struct file *file)
++{
++	struct file *f = NULL;
 +
-+For aufs4-linux tree,
-+- enable CONFIG_AUFS_FS.
-+- set other aufs configurations if necessary.
++	if (file->f_path.dentry->d_sb->s_op->real_loop)
++		f = file->f_path.dentry->d_sb->s_op->real_loop(file);
++	return f;
+ }
+ 
+ static void loop_reread_partitions(struct loop_device *lo,
+@@ -683,6 +695,7 @@ static int loop_change_fd(struct loop_de
+ 			  unsigned int arg)
+ {
+ 	struct file	*file, *old_file;
++	struct file	*f, *virt_file = NULL, *old_virt_file;
+ 	struct inode	*inode;
+ 	int		error;
+ 
+@@ -699,6 +712,12 @@ static int loop_change_fd(struct loop_de
+ 	file = fget(arg);
+ 	if (!file)
+ 		goto out;
++	f = loop_real_file(file);
++	if (f) {
++		virt_file = file;
++		file = f;
++		get_file(file);
++	}
+ 
+ 	error = loop_validate_file(file, bdev);
+ 	if (error)
+@@ -706,6 +725,7 @@ static int loop_change_fd(struct loop_de
+ 
+ 	inode = file->f_mapping->host;
+ 	old_file = lo->lo_backing_file;
++	old_virt_file = lo->lo_backing_virt_file;
+ 
+ 	error = -EINVAL;
+ 
+@@ -714,21 +734,43 @@ static int loop_change_fd(struct loop_de
+ 		goto out_putf;
+ 
+ 	/* and ... switch */
+-	error = loop_switch(lo, file);
++	error = loop_switch(lo, file, virt_file);
+ 	if (error)
+ 		goto out_putf;
+ 
+ 	fput(old_file);
++	if (old_virt_file)
++		fput(old_virt_file);
+ 	if (lo->lo_flags & LO_FLAGS_PARTSCAN)
+ 		loop_reread_partitions(lo, bdev);
+ 	return 0;
+ 
+  out_putf:
+ 	fput(file);
++	if (virt_file)
++		fput(virt_file);
+  out:
+ 	return error;
+ }
+ 
++/*
++ * for AUFS
++ * no get/put for file.
++ */
++struct file *loop_backing_file(struct super_block *sb)
++{
++	struct file *ret;
++	struct loop_device *l;
 +
-+For aufs4-standalone tree,
-+There are several ways to build.
++	ret = NULL;
++	if (MAJOR(sb->s_dev) == LOOP_MAJOR) {
++		l = sb->s_bdev->bd_disk->private_data;
++		ret = l->lo_backing_file;
++	}
++	return ret;
++}
++EXPORT_SYMBOL_GPL(loop_backing_file);
 +
-+1.
-+- apply ./aufs4-kbuild.patch to your kernel source files.
-+- apply ./aufs4-base.patch too.
-+- apply ./aufs4-mmap.patch too.
-+- apply ./aufs4-standalone.patch too, if you have a plan to set
-+  CONFIG_AUFS_FS=m. otherwise you don't need ./aufs4-standalone.patch.
-+- copy ./{Documentation,fs,include/uapi/linux/aufs_type.h} files to your
-+  kernel source tree. Never copy $PWD/include/uapi/linux/Kbuild.
-+- enable CONFIG_AUFS_FS, you can select either
-+  =m or =y.
-+- and build your kernel as usual.
-+- install the built kernel.
-+  Note: Since linux-3.9, every filesystem module requires an alias
-+  "fs-<fsname>". You should make sure that "fs-aufs" is listed in your
-+  modules.aliases file if you set CONFIG_AUFS_FS=m.
-+- install the header files too by "make headers_install" to the
-+  directory where you specify. By default, it is $PWD/usr.
-+  "make help" shows a brief note for headers_install.
-+- and reboot your system.
+ /* loop sysfs attributes */
+ 
+ static ssize_t loop_attr_show(struct device *dev, char *page,
+@@ -887,7 +929,7 @@ static int loop_prepare_queue(struct loo
+ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
+ 		       struct block_device *bdev, unsigned int arg)
+ {
+-	struct file	*file;
++	struct file	*file, *f, *virt_file = NULL;
+ 	struct inode	*inode;
+ 	struct address_space *mapping;
+ 	unsigned lo_blocksize;
+@@ -902,6 +944,12 @@ static int loop_set_fd(struct loop_devic
+ 	file = fget(arg);
+ 	if (!file)
+ 		goto out;
++	f = loop_real_file(file);
++	if (f) {
++		virt_file = file;
++		file = f;
++		get_file(file);
++	}
+ 
+ 	error = -EBUSY;
+ 	if (lo->lo_state != Lo_unbound)
+@@ -939,6 +987,7 @@ static int loop_set_fd(struct loop_devic
+ 	lo->lo_flags = lo_flags;
+ 	lo->lo_xid = vx_current_xid();
+ 	lo->lo_backing_file = file;
++	lo->lo_backing_virt_file = virt_file;
+ 	lo->transfer = NULL;
+ 	lo->ioctl = NULL;
+ 	lo->lo_sizelimit = 0;
+@@ -971,6 +1020,8 @@ static int loop_set_fd(struct loop_devic
+ 
+  out_putf:
+ 	fput(file);
++	if (virt_file)
++		fput(virt_file);
+  out:
+ 	/* This is safe: open() is still holding a reference. */
+ 	module_put(THIS_MODULE);
+@@ -1017,6 +1068,7 @@ loop_init_xfer(struct loop_device *lo, s
+ static int loop_clr_fd(struct loop_device *lo)
+ {
+ 	struct file *filp = lo->lo_backing_file;
++	struct file *virt_filp = lo->lo_backing_virt_file;
+ 	gfp_t gfp = lo->old_gfp_mask;
+ 	struct block_device *bdev = lo->lo_device;
+ 
+@@ -1048,6 +1100,7 @@ static int loop_clr_fd(struct loop_devic
+ 	spin_lock_irq(&lo->lo_lock);
+ 	lo->lo_state = Lo_rundown;
+ 	lo->lo_backing_file = NULL;
++	lo->lo_backing_virt_file = NULL;
+ 	spin_unlock_irq(&lo->lo_lock);
+ 
+ 	loop_release_xfer(lo);
+@@ -1093,6 +1146,8 @@ static int loop_clr_fd(struct loop_devic
+ 	 * bd_mutex which is usually taken before lo_ctl_mutex.
+ 	 */
+ 	fput(filp);
++	if (virt_filp)
++		fput(virt_filp);
+ 	return 0;
+ }
+ 
+diff -urNp -x '*.orig' linux-4.9/drivers/block/loop.h linux-4.9/drivers/block/loop.h
+--- linux-4.9/drivers/block/loop.h	2021-02-24 16:14:57.284508877 +0100
++++ linux-4.9/drivers/block/loop.h	2021-02-24 16:15:09.538240738 +0100
+@@ -47,7 +47,7 @@ struct loop_device {
+ 	int		(*ioctl)(struct loop_device *, int cmd, 
+ 				 unsigned long arg); 
+ 
+-	struct file *	lo_backing_file;
++	struct file *	lo_backing_file, *lo_backing_virt_file;
+ 	struct block_device *lo_device;
+ 	unsigned	lo_blocksize;
+ 	void		*key_data; 
+diff -urNp -x '*.orig' linux-4.9/fs/Kconfig linux-4.9/fs/Kconfig
+--- linux-4.9/fs/Kconfig	2016-12-11 20:17:54.000000000 +0100
++++ linux-4.9/fs/Kconfig	2021-02-24 16:15:09.501572879 +0100
+@@ -249,6 +249,7 @@ source "fs/pstore/Kconfig"
+ source "fs/sysv/Kconfig"
+ source "fs/ufs/Kconfig"
+ source "fs/exofs/Kconfig"
++source "fs/aufs/Kconfig"
+ 
+ endif # MISC_FILESYSTEMS
+ 
+diff -urNp -x '*.orig' linux-4.9/fs/Makefile linux-4.9/fs/Makefile
+--- linux-4.9/fs/Makefile	2016-12-11 20:17:54.000000000 +0100
++++ linux-4.9/fs/Makefile	2021-02-24 16:15:09.501572879 +0100
+@@ -129,3 +129,4 @@ obj-y				+= exofs/ # Multiple modules
+ obj-$(CONFIG_CEPH_FS)		+= ceph/
+ obj-$(CONFIG_PSTORE)		+= pstore/
+ obj-$(CONFIG_EFIVAR_FS)		+= efivarfs/
++obj-$(CONFIG_AUFS_FS)           += aufs/
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/Kconfig linux-4.9/fs/aufs/Kconfig
+--- linux-4.9/fs/aufs/Kconfig	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/Kconfig	2021-02-24 16:15:09.531573855 +0100
+@@ -0,0 +1,198 @@
++config AUFS_FS
++	tristate "Aufs (Advanced multi layered unification filesystem) support"
++	help
++	Aufs is a stackable unification filesystem such as Unionfs,
++	which unifies several directories and provides a merged single
++	directory.
++	In the early days, aufs was entirely re-designed and
++	re-implemented Unionfs Version 1.x series. Introducing many
++	original ideas, approaches and improvements, it becomes totally
++	different from Unionfs while keeping the basic features.
 +
-+2.
-+- module only (CONFIG_AUFS_FS=m).
-+- apply ./aufs4-base.patch to your kernel source files.
-+- apply ./aufs4-mmap.patch too.
-+- apply ./aufs4-standalone.patch too.
-+- build your kernel, don't forget "make headers_install", and reboot.
-+- edit ./config.mk and set other aufs configurations if necessary.
-+  Note: You should read $PWD/fs/aufs/Kconfig carefully which describes
-+  every aufs configurations.
-+- build the module by simple "make".
-+  Note: Since linux-3.9, every filesystem module requires an alias
-+  "fs-<fsname>". You should make sure that "fs-aufs" is listed in your
-+  modules.aliases file.
-+- you can specify ${KDIR} make variable which points to your kernel
-+  source tree.
-+- install the files
-+  + run "make install" to install the aufs module, or copy the built
-+    $PWD/aufs.ko to /lib/modules/... and run depmod -a (or reboot simply).
-+  + run "make install_headers" (instead of headers_install) to install
-+    the modified aufs header file (you can specify DESTDIR which is
-+    available in aufs standalone version's Makefile only), or copy
-+    $PWD/usr/include/linux/aufs_type.h to /usr/include/linux or wherever
-+    you like manually. By default, the target directory is $PWD/usr.
-+- no need to apply aufs4-kbuild.patch, nor copying source files to your
-+  kernel source tree.
++if AUFS_FS
++choice
++	prompt "Maximum number of branches"
++	default AUFS_BRANCH_MAX_127
++	help
++	Specifies the maximum number of branches (or member directories)
++	in a single aufs. The larger value consumes more system
++	resources and has a minor impact to performance.
++config AUFS_BRANCH_MAX_127
++	bool "127"
++	help
++	Specifies the maximum number of branches (or member directories)
++	in a single aufs. The larger value consumes more system
++	resources and has a minor impact to performance.
++config AUFS_BRANCH_MAX_511
++	bool "511"
++	help
++	Specifies the maximum number of branches (or member directories)
++	in a single aufs. The larger value consumes more system
++	resources and has a minor impact to performance.
++config AUFS_BRANCH_MAX_1023
++	bool "1023"
++	help
++	Specifies the maximum number of branches (or member directories)
++	in a single aufs. The larger value consumes more system
++	resources and has a minor impact to performance.
++config AUFS_BRANCH_MAX_32767
++	bool "32767"
++	help
++	Specifies the maximum number of branches (or member directories)
++	in a single aufs. The larger value consumes more system
++	resources and has a minor impact to performance.
++endchoice
 +
-+Note: The header file aufs_type.h is necessary to build aufs-util
-+      as well as "make headers_install" in the kernel source tree.
-+      headers_install is subject to be forgotten, but it is essentially
-+      necessary, not only for building aufs-util.
-+      You may not meet problems without headers_install in some older
-+      version though.
++config AUFS_SBILIST
++	bool
++	depends on AUFS_MAGIC_SYSRQ || PROC_FS
++	default y
++	help
++	Automatic configuration for internal use.
++	When aufs supports Magic SysRq or /proc, enabled automatically.
 +
-+And then,
-+- read README in aufs-util, build and install it
-+- note that your distribution may contain an obsoleted version of
-+  aufs_type.h in /usr/include/linux or something. When you build aufs
-+  utilities, make sure that your compiler refers the correct aufs header
-+  file which is built by "make headers_install."
-+- if you want to use readdir(3) in userspace or pathconf(3) wrapper,
-+  then run "make install_ulib" too. And refer to the aufs manual in
-+  detail.
++config AUFS_HNOTIFY
++	bool "Detect direct branch access (bypassing aufs)"
++	help
++	If you want to modify files on branches directly, eg. bypassing aufs,
++	and want aufs to detect the changes of them fully, then enable this
++	option and use 'udba=notify' mount option.
++	Currently there is only one available configuration, "fsnotify".
++	It will have a negative impact to the performance.
++	See detail in aufs.5.
 +
-+There several other patches in aufs4-standalone.git. They are all
-+optional. When you meet some problems, they will help you.
-+- aufs4-loopback.patch
-+  Supports a nested loopback mount in a branch-fs. This patch is
-+  unnecessary until aufs produces a message like "you may want to try
-+  another patch for loopback file".
-+- vfs-ino.patch
-+  Modifies a system global kernel internal function get_next_ino() in
-+  order to stop assigning 0 for an inode-number. Not directly related to
-+  aufs, but recommended generally.
-+- tmpfs-idr.patch
-+  Keeps the tmpfs inode number as the lowest value. Effective to reduce
-+  the size of aufs XINO files for tmpfs branch. Also it prevents the
-+  duplication of inode number, which is important for backup tools and
-+  other utilities. When you find aufs XINO files for tmpfs branch
-+  growing too much, try this patch.
-+- lockdep-debug.patch
-+  Because aufs is not only an ordinary filesystem (callee of VFS), but
-+  also a caller of VFS functions for branch filesystems, subclassing of
-+  the internal locks for LOCKDEP is necessary. LOCKDEP is a debugging
-+  feature of linux kernel. If you enable CONFIG_LOCKDEP, then you will
-+  need to apply this debug patch to expand several constant values.
-+  If don't know what LOCKDEP, then you don't have apply this patch.
++choice
++	prompt "method" if AUFS_HNOTIFY
++	default AUFS_HFSNOTIFY
++config AUFS_HFSNOTIFY
++	bool "fsnotify"
++	select FSNOTIFY
++endchoice
 +
++config AUFS_EXPORT
++	bool "NFS-exportable aufs"
++	depends on EXPORTFS
++	help
++	If you want to export your mounted aufs via NFS, then enable this
++	option. There are several requirements for this configuration.
++	See detail in aufs.5.
 +
-+4. Usage
-+----------------------------------------
-+At first, make sure aufs-util are installed, and please read the aufs
-+manual, aufs.5 in aufs-util.git tree.
-+$ man -l aufs.5
++config AUFS_INO_T_64
++	bool
++	depends on AUFS_EXPORT
++	depends on 64BIT && !(ALPHA || S390)
++	default y
++	help
++	Automatic configuration for internal use.
++	/* typedef unsigned long/int __kernel_ino_t */
++	/* alpha and s390x are int */
 +
-+And then,
-+$ mkdir /tmp/rw /tmp/aufs
-+# mount -t aufs -o br=/tmp/rw:${HOME} none /tmp/aufs
++config AUFS_XATTR
++	bool "support for XATTR/EA (including Security Labels)"
++	help
++	If your branch fs supports XATTR/EA and you want to make them
++	available in aufs too, then enable this opsion and specify the
++	branch attributes for EA.
++	See detail in aufs.5.
 +
-+Here is another example. The result is equivalent.
-+# mount -t aufs -o br=/tmp/rw=rw:${HOME}=ro none /tmp/aufs
-+  Or
-+# mount -t aufs -o br:/tmp/rw none /tmp/aufs
-+# mount -o remount,append:${HOME} /tmp/aufs
++config AUFS_FHSM
++	bool "File-based Hierarchical Storage Management"
++	help
++	Hierarchical Storage Management (or HSM) is a well-known feature
++	in the storage world. Aufs provides this feature as file-based.
++	with multiple branches.
++	These multiple branches are prioritized, ie. the topmost one
++	should be the fastest drive and be used heavily.
 +
-+Then, you can see whole tree of your home dir through /tmp/aufs. If
-+you modify a file under /tmp/aufs, the one on your home directory is
-+not affected, instead the same named file will be newly created under
-+/tmp/rw. And all of your modification to a file will be applied to
-+the one under /tmp/rw. This is called the file based Copy on Write
-+(COW) method.
-+Aufs mount options are described in aufs.5.
-+If you run chroot or something and make your aufs as a root directory,
-+then you need to customize the shutdown script. See the aufs manual in
-+detail.
++config AUFS_RDU
++	bool "Readdir in userspace"
++	help
++	Aufs has two methods to provide a merged view for a directory,
++	by a user-space library and by kernel-space natively. The latter
++	is always enabled but sometimes large and slow.
++	If you enable this option, install the library in aufs2-util
++	package, and set some environment variables for your readdir(3),
++	then the work will be handled in user-space which generally
++	shows better performance in most cases.
++	See detail in aufs.5.
 +
-+Additionally, there are some sample usages of aufs which are a
-+diskless system with network booting, and LiveCD over NFS.
-+See sample dir in CVS tree on SourceForge.
++config AUFS_DIRREN
++	bool "Workaround for rename(2)-ing a directory"
++	help
++	By default, aufs returns EXDEV error in renameing a dir who has
++	his child on the lower branch, since it is a bad idea to issue
++	rename(2) internally for every lower branch. But user may not
++	accept this behaviour. So here is a workaround to allow such
++	rename(2) and store some extra infromation on the writable
++	branch. Obviously this costs high (and I don't like it).
++	To use this feature, you need to enable this configuration AND
++	to specify the mount option `dirren.'
++	See details in aufs.5 and the design documents.
 +
++config AUFS_SHWH
++	bool "Show whiteouts"
++	help
++	If you want to make the whiteouts in aufs visible, then enable
++	this option and specify 'shwh' mount option. Although it may
++	sounds like philosophy or something, but in technically it
++	simply shows the name of whiteout with keeping its behaviour.
 +
-+5. Contact
-+----------------------------------------
-+When you have any problems or strange behaviour in aufs, please let me
-+know with:
-+- /proc/mounts (instead of the output of mount(8))
-+- /sys/module/aufs/*
-+- /sys/fs/aufs/* (if you have them)
-+- /debug/aufs/* (if you have them)
-+- linux kernel version
-+  if your kernel is not plain, for example modified by distributor,
-+  the url where i can download its source is necessary too.
-+- aufs version which was printed at loading the module or booting the
-+  system, instead of the date you downloaded.
-+- configuration (define/undefine CONFIG_AUFS_xxx)
-+- kernel configuration or /proc/config.gz (if you have it)
-+- behaviour which you think to be incorrect
-+- actual operation, reproducible one is better
-+- mailto: aufs-users at lists.sourceforge.net
++config AUFS_BR_RAMFS
++	bool "Ramfs (initramfs/rootfs) as an aufs branch"
++	help
++	If you want to use ramfs as an aufs branch fs, then enable this
++	option. Generally tmpfs is recommended.
++	Aufs prohibited them to be a branch fs by default, because
++	initramfs becomes unusable after switch_root or something
++	generally. If you sets initramfs as an aufs branch and boot your
++	system by switch_root, you will meet a problem easily since the
++	files in initramfs may be inaccessible.
++	Unless you are going to use ramfs as an aufs branch fs without
++	switch_root or something, leave it N.
 +
-+Usually, I don't watch the Public Areas(Bugs, Support Requests, Patches,
-+and Feature Requests) on SourceForge. Please join and write to
-+aufs-users ML.
++config AUFS_BR_FUSE
++	bool "Fuse fs as an aufs branch"
++	depends on FUSE_FS
++	select AUFS_POLL
++	help
++	If you want to use fuse-based userspace filesystem as an aufs
++	branch fs, then enable this option.
++	It implements the internal poll(2) operation which is
++	implemented by fuse only (curretnly).
 +
++config AUFS_POLL
++	bool
++	help
++	Automatic configuration for internal use.
 +
-+6. Acknowledgements
-+----------------------------------------
-+Thanks to everyone who have tried and are using aufs, whoever
-+have reported a bug or any feedback.
++config AUFS_BR_HFSPLUS
++	bool "Hfsplus as an aufs branch"
++	depends on HFSPLUS_FS
++	default y
++	help
++	If you want to use hfsplus fs as an aufs branch fs, then enable
++	this option. This option introduces a small overhead at
++	copying-up a file on hfsplus.
 +
-+Especially donators:
-+Tomas Matejicek(slax.org) made a donation (much more than once).
-+	Since Apr 2010, Tomas M (the author of Slax and Linux Live
-+	scripts) is making "doubling" donations.
-+	Unfortunately I cannot list all of the donators, but I really
-+	appreciate.
-+	It ends Aug 2010, but the ordinary donation URL is still available.
-+	<http://sourceforge.net/donate/index.php?group_id=167503>
-+Dai Itasaka made a donation (2007/8).
-+Chuck Smith made a donation (2008/4, 10 and 12).
-+Henk Schoneveld made a donation (2008/9).
-+Chih-Wei Huang, ASUS, CTC donated Eee PC 4G (2008/10).
-+Francois Dupoux made a donation (2008/11).
-+Bruno Cesar Ribas and Luis Carlos Erpen de Bona, C3SL serves public
-+	aufs2 GIT tree (2009/2).
-+William Grant made a donation (2009/3).
-+Patrick Lane made a donation (2009/4).
-+The Mail Archive (mail-archive.com) made donations (2009/5).
-+Nippy Networks (Ed Wildgoose) made a donation (2009/7).
-+New Dream Network, LLC (www.dreamhost.com) made a donation (2009/11).
-+Pavel Pronskiy made a donation (2011/2).
-+Iridium and Inmarsat satellite phone retailer (www.mailasail.com), Nippy
-+	Networks (Ed Wildgoose) made a donation for hardware (2011/3).
-+Max Lekomcev (DOM-TV project) made a donation (2011/7, 12, 2012/3, 6 and
-+11).
-+Sam Liddicott made a donation (2011/9).
-+Era Scarecrow made a donation (2013/4).
-+Bor Ratajc made a donation (2013/4).
-+Alessandro Gorreta made a donation (2013/4).
-+POIRETTE Marc made a donation (2013/4).
-+Alessandro Gorreta made a donation (2013/4).
-+lauri kasvandik made a donation (2013/5).
-+"pemasu from Finland" made a donation (2013/7).
-+The Parted Magic Project made a donation (2013/9 and 11).
-+Pavel Barta made a donation (2013/10).
-+Nikolay Pertsev made a donation (2014/5).
-+James B made a donation (2014/7 and 2015/7).
-+Stefano Di Biase made a donation (2014/8).
-+Daniel Epellei made a donation (2015/1).
-+OmegaPhil made a donation (2016/1).
-+Tomasz Szewczyk made a donation (2016/4).
-+James Burry made a donation (2016/12).
++config AUFS_BDEV_LOOP
++	bool
++	depends on BLK_DEV_LOOP
++	default y
++	help
++	Automatic configuration for internal use.
++	Convert =[ym] into =y.
 +
-+Thank you very much.
-+Donations are always, including future donations, very important and
-+helpful for me to keep on developing aufs.
++config AUFS_DEBUG
++	bool "Debug aufs"
++	help
++	Enable this to compile aufs internal debug code.
++	It will have a negative impact to the performance.
 +
++config AUFS_MAGIC_SYSRQ
++	bool
++	depends on AUFS_DEBUG && MAGIC_SYSRQ
++	default y
++	help
++	Automatic configuration for internal use.
++	When aufs supports Magic SysRq, enabled automatically.
++endif
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/Makefile linux-4.9/fs/aufs/Makefile
+--- linux-4.9/fs/aufs/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/Makefile	2021-02-24 16:15:09.531573855 +0100
+@@ -0,0 +1,45 @@
 +
-+7.
-+----------------------------------------
-+If you are an experienced user, no explanation is needed. Aufs is
-+just a linux filesystem.
++include ${src}/magic.mk
++ifeq (${CONFIG_AUFS_FS},m)
++include ${src}/conf.mk
++endif
++-include ${src}/priv_def.mk
 +
++# cf. include/linux/kernel.h
++# enable pr_debug
++ccflags-y += -DDEBUG
++# sparse requires the full pathname
++ifdef M
++ccflags-y += -include ${M}/../../include/uapi/linux/aufs_type.h
++else
++ccflags-y += -include ${srctree}/include/uapi/linux/aufs_type.h
++endif
 +
-+Enjoy!
++obj-$(CONFIG_AUFS_FS) += aufs.o
++aufs-y := module.o sbinfo.o super.o branch.o xino.o sysaufs.o opts.o \
++	wkq.o vfsub.o dcsub.o \
++	cpup.o whout.o wbr_policy.o \
++	dinfo.o dentry.o \
++	dynop.o \
++	finfo.o file.o f_op.o \
++	dir.o vdir.o \
++	iinfo.o inode.o i_op.o i_op_add.o i_op_del.o i_op_ren.o \
++	mvdown.o ioctl.o
 +
-+# Local variables: ;
-+# mode: text;
-+# 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
++# all are boolean
++aufs-$(CONFIG_PROC_FS) += procfs.o plink.o
++aufs-$(CONFIG_SYSFS) += sysfs.o
++aufs-$(CONFIG_DEBUG_FS) += dbgaufs.o
++aufs-$(CONFIG_AUFS_BDEV_LOOP) += loop.o
++aufs-$(CONFIG_AUFS_HNOTIFY) += hnotify.o
++aufs-$(CONFIG_AUFS_HFSNOTIFY) += hfsnotify.o
++aufs-$(CONFIG_AUFS_EXPORT) += export.o
++aufs-$(CONFIG_AUFS_XATTR) += xattr.o
++aufs-$(CONFIG_FS_POSIX_ACL) += posix_acl.o
++aufs-$(CONFIG_AUFS_DIRREN) += dirren.o
++aufs-$(CONFIG_AUFS_FHSM) += fhsm.o
++aufs-$(CONFIG_AUFS_POLL) += poll.o
++aufs-$(CONFIG_AUFS_RDU) += rdu.o
++aufs-$(CONFIG_AUFS_BR_HFSPLUS) += hfsplus.o
++aufs-$(CONFIG_AUFS_DEBUG) += debug.o
++aufs-$(CONFIG_AUFS_MAGIC_SYSRQ) += sysrq.o
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/aufs.h linux-4.9/fs/aufs/aufs.h
+--- linux-4.9/fs/aufs/aufs.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/aufs.h	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,60 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -3090,9 +2443,9 @@ diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h
 +
 +#endif /* __KERNEL__ */
 +#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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/branch.c linux-4.9/fs/aufs/branch.c
+--- linux-4.9/fs/aufs/branch.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/branch.c	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,1432 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -4526,9 +3879,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c
 +
 +	return err;
 +}
-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-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/branch.h linux-4.9/fs/aufs/branch.h
+--- linux-4.9/fs/aufs/branch.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/branch.h	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,324 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -4854,9 +4207,9 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h
 +
 +#endif /* __KERNEL__ */
 +#endif /* __AUFS_BRANCH_H__ */
-diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
---- /usr/share/empty/fs/aufs/conf.mk	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/conf.mk	2018-04-15 08:49:13.394483860 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/conf.mk linux-4.9/fs/aufs/conf.mk
+--- linux-4.9/fs/aufs/conf.mk	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/conf.mk	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,39 @@
 +
 +AuConfStr = CONFIG_AUFS_FS=${CONFIG_AUFS_FS}
@@ -4897,9 +4250,9 @@ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk
 +${obj}/sysfs.o: ${AuConfName}
 +
 +-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-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/cpup.c linux-4.9/fs/aufs/cpup.c
+--- linux-4.9/fs/aufs/cpup.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/cpup.c	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,1414 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -6315,9 +5668,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
 +	dput(parent);
 +	return err;
 +}
-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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/cpup.h linux-4.9/fs/aufs/cpup.h
+--- linux-4.9/fs/aufs/cpup.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/cpup.h	2021-02-24 16:15:09.521573529 +0100
 @@ -0,0 +1,99 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -6418,9 +5771,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h
 +
 +#endif /* __KERNEL__ */
 +#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-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dbgaufs.c linux-4.9/fs/aufs/dbgaufs.c
+--- linux-4.9/fs/aufs/dbgaufs.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dbgaufs.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,437 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -6859,9 +6212,9 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c
 +		err = 0;
 +	return err;
 +}
-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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dbgaufs.h linux-4.9/fs/aufs/dbgaufs.h
+--- linux-4.9/fs/aufs/dbgaufs.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dbgaufs.h	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,48 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -6911,9 +6264,9 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h
 +
 +#endif /* __KERNEL__ */
 +#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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dcsub.c linux-4.9/fs/aufs/dcsub.c
+--- linux-4.9/fs/aufs/dcsub.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dcsub.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,225 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -7140,9 +6493,9 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c
 +
 +	return path_is_under(path + 0, path + 1);
 +}
-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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dcsub.h linux-4.9/fs/aufs/dcsub.h
+--- linux-4.9/fs/aufs/dcsub.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dcsub.h	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,136 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -7280,9 +6633,9 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h
 +
 +#endif /* __KERNEL__ */
 +#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-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/debug.c linux-4.9/fs/aufs/debug.c
+--- linux-4.9/fs/aufs/debug.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/debug.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,440 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -7724,9 +7077,9 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c
 +
 +	return 0;
 +}
-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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/debug.h linux-4.9/fs/aufs/debug.h
+--- linux-4.9/fs/aufs/debug.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/debug.h	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,225 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -7953,9 +7306,9 @@ diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h
 +
 +#endif /* __KERNEL__ */
 +#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-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dentry.c linux-4.9/fs/aufs/dentry.c
+--- linux-4.9/fs/aufs/dentry.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dentry.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,1152 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -9109,9 +8462,9 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
 +const struct dentry_operations aufs_dop_noreval = {
 +	.d_release		= aufs_d_release
 +};
-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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dentry.h linux-4.9/fs/aufs/dentry.h
+--- linux-4.9/fs/aufs/dentry.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dentry.h	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,266 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -9379,9 +8732,9 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h
 +
 +#endif /* __KERNEL__ */
 +#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
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dinfo.c linux-4.9/fs/aufs/dinfo.c
+--- linux-4.9/fs/aufs/dinfo.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dinfo.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,553 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -9936,9 +9289,9 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c
 +			return bindex;
 +	return -1;
 +}
-diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
---- /usr/share/empty/fs/aufs/dir.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.c	2018-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dir.c linux-4.9/fs/aufs/dir.c
+--- linux-4.9/fs/aufs/dir.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dir.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,759 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -10699,9 +10052,9 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
 +	.flush		= aufs_flush_dir,
 +	.fsync		= aufs_fsync_dir
 +};
-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-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dir.h linux-4.9/fs/aufs/dir.h
+--- linux-4.9/fs/aufs/dir.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dir.h	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,131 @@
 +/*
 + * Copyright (C) 2005-2018 Junjiro R. Okajima
@@ -10834,9 +10187,9 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h
 +
 +#endif /* __KERNEL__ */
 +#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-04-15 08:49:13.397817296 +0200
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dirren.c linux-4.9/fs/aufs/dirren.c
+--- linux-4.9/fs/aufs/dirren.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dirren.c	2021-02-24 16:15:09.524906971 +0100
 @@ -0,0 +1,1314 @@
 +/*
 + * Copyright (C) 2017-2018 Junjiro R. Okajima
@@ -12113,51 +11466,573 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c
 +	return err;
 +}
 +
-+int au_dr_opt_flush(struct super_block *sb)
++int au_dr_opt_flush(struct super_block *sb)
++{
++	int err;
++	aufs_bindex_t bindex, bbot;
++	struct au_branch *br;
++
++	err = 0;
++	bbot = au_sbbot(sb);
++	for (bindex = 0; !err && bindex <= bbot; bindex++) {
++		br = au_sbr(sb, bindex);
++		if (au_br_writable(br->br_perm))
++			err = au_dr_hino(sb, bindex, /*br*/NULL, /*path*/NULL);
++	}
++
++	return err;
++}
++
++int au_dr_opt_clr(struct super_block *sb, int no_flush)
++{
++	int err;
++	aufs_bindex_t bindex, bbot;
++	struct au_branch *br;
++
++	err = 0;
++	if (!no_flush) {
++		err = au_dr_opt_flush(sb);
++		if (unlikely(err))
++			goto out;
++	}
++
++	bbot = au_sbbot(sb);
++	for (bindex = 0; bindex <= bbot; bindex++) {
++		br = au_sbr(sb, bindex);
++		au_dr_hino_free(&br->br_dirren);
++	}
++
++out:
++	return err;
++}
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dirren.h linux-4.9/fs/aufs/dirren.h
+--- linux-4.9/fs/aufs/dirren.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dirren.h	2021-02-24 16:15:09.524906971 +0100
+@@ -0,0 +1,145 @@
++/*
++ * Copyright (C) 2017-2018 Junjiro R. Okajima
++ *
++ * This program, aufs is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++/*
++ * renamed dir info
++ */
++
++#ifndef __AUFS_DIRREN_H__
++#define __AUFS_DIRREN_H__
++
++#ifdef __KERNEL__
++
++#include <linux/dcache.h>
++#include <linux/statfs.h>
++#include "hbl.h"
++
++#define AuDirren_NHASH 100
++
++#ifdef CONFIG_AUFS_DIRREN
++/* copied from linux/fs/xfs/uuid.h */
++typedef struct {
++	unsigned char	__u_bits[16];
++} uuid_t;
++
++#define __UUID_TMPLT		"01234567-0123-4567-0123-456701234567"
++
++enum au_brid_type {
++	AuBrid_Unset,
++	AuBrid_UUID,
++	AuBrid_FSID,
++	AuBrid_DEV
++};
++
++struct au_dr_brid {
++	enum au_brid_type	type;
++	union {
++		uuid_t	uuid;	/* unimplemented yet */
++		fsid_t	fsid;
++		dev_t	dev;
++	};
++};
++
++/* 20 is the max digits length of ulong 64 */
++/* brid-type "_" uuid "_" inum */
++#define AUFS_DIRREN_FNAME_SZ	(1 + 1 + sizeof(__UUID_TMPLT) + 20)
++#define AUFS_DIRREN_ENV_VAL_SZ	(AUFS_DIRREN_FNAME_SZ + 1 + 20)
++
++struct au_dr_hino {
++	struct hlist_bl_node	dr_hnode;
++	ino_t			dr_h_ino;
++};
++
++struct au_dr_br {
++	struct hlist_bl_head	dr_h_ino[AuDirren_NHASH];
++	struct au_dr_brid	dr_brid;
++};
++
++struct au_dr_lookup {
++	/* dr_name is pointed by struct au_do_lookup_args.name */
++	struct qstr		dr_name; /* subset of dr_info */
++	aufs_bindex_t		ninfo;
++	struct au_drinfo	**drinfo;
++};
++#else
++struct au_dr_hino;
++/* empty */
++struct au_dr_br { };
++struct au_dr_lookup { };
++#endif
++
++/* ---------------------------------------------------------------------- */
++
++struct au_branch;
++struct au_do_lookup_args;
++struct au_hinode;
++#ifdef CONFIG_AUFS_DIRREN
++int au_dr_hino_test_add(struct au_dr_br *dr, ino_t h_ino,
++			struct au_dr_hino *add_ent);
++void au_dr_hino_free(struct au_dr_br *dr);
++int au_dr_br_init(struct super_block *sb, struct au_branch *br,
++		  const struct path *path);
++int au_dr_br_fin(struct super_block *sb, struct au_branch *br);
++int au_dr_rename(struct dentry *src, aufs_bindex_t bindex,
++		 struct qstr *dst_name, void *_rev);
++void au_dr_rename_fin(struct dentry *src, aufs_bindex_t btgt, void *rev);
++void au_dr_rename_rev(struct dentry *src, aufs_bindex_t bindex, void *rev);
++int au_dr_lkup(struct au_do_lookup_args *lkup, struct dentry *dentry,
++	       aufs_bindex_t bindex);
++int au_dr_lkup_name(struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
++int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex,
++		     ino_t h_ino);
++void au_dr_lkup_fin(struct au_do_lookup_args *lkup);
++int au_dr_opt_set(struct super_block *sb);
++int au_dr_opt_flush(struct super_block *sb);
++int au_dr_opt_clr(struct super_block *sb, int no_flush);
++#else
++AuStubInt0(au_dr_hino_test_add, struct au_dr_br *dr, ino_t h_ino,
++	   struct au_dr_hino *add_ent);
++AuStubVoid(au_dr_hino_free, struct au_dr_br *dr);
++AuStubInt0(au_dr_br_init, struct super_block *sb, struct au_branch *br,
++	   const struct path *path);
++AuStubInt0(au_dr_br_fin, struct super_block *sb, struct au_branch *br);
++AuStubInt0(au_dr_rename, struct dentry *src, aufs_bindex_t bindex,
++	   struct qstr *dst_name, void *_rev);
++AuStubVoid(au_dr_rename_fin, struct dentry *src, aufs_bindex_t btgt, void *rev);
++AuStubVoid(au_dr_rename_rev, struct dentry *src, aufs_bindex_t bindex,
++	   void *rev);
++AuStubInt0(au_dr_lkup, struct au_do_lookup_args *lkup, struct dentry *dentry,
++	   aufs_bindex_t bindex);
++AuStubInt0(au_dr_lkup_name, struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
++AuStubInt0(au_dr_lkup_h_ino, struct au_do_lookup_args *lkup,
++	   aufs_bindex_t bindex, ino_t h_ino);
++AuStubVoid(au_dr_lkup_fin, struct au_do_lookup_args *lkup);
++AuStubInt0(au_dr_opt_set, struct super_block *sb);
++AuStubInt0(au_dr_opt_flush, struct super_block *sb);
++AuStubInt0(au_dr_opt_clr, struct super_block *sb, int no_flush);
++#endif
++
++/* ---------------------------------------------------------------------- */
++
++#ifdef CONFIG_AUFS_DIRREN
++static inline int au_dr_ihash(ino_t h_ino)
++{
++	return h_ino % AuDirren_NHASH;
++}
++#else
++AuStubInt0(au_dr_ihash, ino_t h_ino);
++#endif
++
++#endif /* __KERNEL__ */
++#endif /* __AUFS_DIRREN_H__ */
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dynop.c linux-4.9/fs/aufs/dynop.c
+--- linux-4.9/fs/aufs/dynop.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dynop.c	2021-02-24 16:15:09.524906971 +0100
+@@ -0,0 +1,369 @@
++/*
++ * Copyright (C) 2010-2018 Junjiro R. Okajima
++ *
++ * This program, aufs is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++/*
++ * dynamically customizable operations for regular files
++ */
++
++#include "aufs.h"
++
++#define DyPrSym(key)	AuDbgSym(key->dk_op.dy_hop)
++
++/*
++ * How large will these lists be?
++ * Usually just a few elements, 20-30 at most for each, I guess.
++ */
++static struct hlist_bl_head dynop[AuDyLast];
++
++static struct au_dykey *dy_gfind_get(struct hlist_bl_head *hbl,
++				     const void *h_op)
++{
++	struct au_dykey *key, *tmp;
++	struct hlist_bl_node *pos;
++
++	key = NULL;
++	hlist_bl_lock(hbl);
++	hlist_bl_for_each_entry(tmp, pos, hbl, dk_hnode)
++		if (tmp->dk_op.dy_hop == h_op) {
++			key = tmp;
++			kref_get(&key->dk_kref);
++			break;
++		}
++	hlist_bl_unlock(hbl);
++
++	return key;
++}
++
++static struct au_dykey *dy_bradd(struct au_branch *br, struct au_dykey *key)
++{
++	struct au_dykey **k, *found;
++	const void *h_op = key->dk_op.dy_hop;
++	int i;
++
++	found = NULL;
++	k = br->br_dykey;
++	for (i = 0; i < AuBrDynOp; i++)
++		if (k[i]) {
++			if (k[i]->dk_op.dy_hop == h_op) {
++				found = k[i];
++				break;
++			}
++		} else
++			break;
++	if (!found) {
++		spin_lock(&br->br_dykey_lock);
++		for (; i < AuBrDynOp; i++)
++			if (k[i]) {
++				if (k[i]->dk_op.dy_hop == h_op) {
++					found = k[i];
++					break;
++				}
++			} else {
++				k[i] = key;
++				break;
++			}
++		spin_unlock(&br->br_dykey_lock);
++		BUG_ON(i == AuBrDynOp); /* expand the array */
++	}
++
++	return found;
++}
++
++/* kref_get() if @key is already added */
++static struct au_dykey *dy_gadd(struct hlist_bl_head *hbl, struct au_dykey *key)
++{
++	struct au_dykey *tmp, *found;
++	struct hlist_bl_node *pos;
++	const void *h_op = key->dk_op.dy_hop;
++
++	found = NULL;
++	hlist_bl_lock(hbl);
++	hlist_bl_for_each_entry(tmp, pos, hbl, dk_hnode)
++		if (tmp->dk_op.dy_hop == h_op) {
++			kref_get(&tmp->dk_kref);
++			found = tmp;
++			break;
++		}
++	if (!found)
++		hlist_bl_add_head(&key->dk_hnode, hbl);
++	hlist_bl_unlock(hbl);
++
++	if (!found)
++		DyPrSym(key);
++	return found;
++}
++
++static void dy_free_rcu(struct rcu_head *rcu)
++{
++	struct au_dykey *key;
++
++	key = container_of(rcu, struct au_dykey, dk_rcu);
++	DyPrSym(key);
++	kfree(key);
++}
++
++static void dy_free(struct kref *kref)
++{
++	struct au_dykey *key;
++	struct hlist_bl_head *hbl;
++
++	key = container_of(kref, struct au_dykey, dk_kref);
++	hbl = dynop + key->dk_op.dy_type;
++	au_hbl_del(&key->dk_hnode, hbl);
++	call_rcu(&key->dk_rcu, dy_free_rcu);
++}
++
++void au_dy_put(struct au_dykey *key)
++{
++	kref_put(&key->dk_kref, dy_free);
++}
++
++/* ---------------------------------------------------------------------- */
++
++#define DyDbgSize(cnt, op)	AuDebugOn(cnt != sizeof(op)/sizeof(void *))
++
++#ifdef CONFIG_AUFS_DEBUG
++#define DyDbgDeclare(cnt)	unsigned int cnt = 0
++#define DyDbgInc(cnt)		do { cnt++; } while (0)
++#else
++#define DyDbgDeclare(cnt)	do {} while (0)
++#define DyDbgInc(cnt)		do {} while (0)
++#endif
++
++#define DySet(func, dst, src, h_op, h_sb) do {				\
++	DyDbgInc(cnt);							\
++	if (h_op->func) {						\
++		if (src.func)						\
++			dst.func = src.func;				\
++		else							\
++			AuDbg("%s %s\n", au_sbtype(h_sb), #func);	\
++	}								\
++} while (0)
++
++#define DySetForce(func, dst, src) do {		\
++	AuDebugOn(!src.func);			\
++	DyDbgInc(cnt);				\
++	dst.func = src.func;			\
++} while (0)
++
++#define DySetAop(func) \
++	DySet(func, dyaop->da_op, aufs_aop, h_aop, h_sb)
++#define DySetAopForce(func) \
++	DySetForce(func, dyaop->da_op, aufs_aop)
++
++static void dy_aop(struct au_dykey *key, const void *h_op,
++		   struct super_block *h_sb __maybe_unused)
++{
++	struct au_dyaop *dyaop = (void *)key;
++	const struct address_space_operations *h_aop = h_op;
++	DyDbgDeclare(cnt);
++
++	AuDbg("%s\n", au_sbtype(h_sb));
++
++	DySetAop(writepage);
++	DySetAopForce(readpage);	/* force */
++	DySetAop(writepages);
++	DySetAop(set_page_dirty);
++	DySetAop(readpages);
++	DySetAop(write_begin);
++	DySetAop(write_end);
++	DySetAop(bmap);
++	DySetAop(invalidatepage);
++	DySetAop(releasepage);
++	DySetAop(freepage);
++	/* this one will be changed according to an aufs mount option */
++	DySetAop(direct_IO);
++	DySetAop(migratepage);
++	DySetAop(isolate_page);
++	DySetAop(putback_page);
++	DySetAop(launder_page);
++	DySetAop(is_partially_uptodate);
++	DySetAop(is_dirty_writeback);
++	DySetAop(error_remove_page);
++	DySetAop(swap_activate);
++	DySetAop(swap_deactivate);
++
++	DyDbgSize(cnt, *h_aop);
++}
++
++/* ---------------------------------------------------------------------- */
++
++static void dy_bug(struct kref *kref)
++{
++	BUG();
++}
++
++static struct au_dykey *dy_get(struct au_dynop *op, struct au_branch *br)
++{
++	struct au_dykey *key, *old;
++	struct hlist_bl_head *hbl;
++	struct op {
++		unsigned int sz;
++		void (*set)(struct au_dykey *key, const void *h_op,
++			    struct super_block *h_sb __maybe_unused);
++	};
++	static const struct op a[] = {
++		[AuDy_AOP] = {
++			.sz	= sizeof(struct au_dyaop),
++			.set	= dy_aop
++		}
++	};
++	const struct op *p;
++
++	hbl = dynop + op->dy_type;
++	key = dy_gfind_get(hbl, op->dy_hop);
++	if (key)
++		goto out_add; /* success */
++
++	p = a + op->dy_type;
++	key = kzalloc(p->sz, GFP_NOFS);
++	if (unlikely(!key)) {
++		key = ERR_PTR(-ENOMEM);
++		goto out;
++	}
++
++	key->dk_op.dy_hop = op->dy_hop;
++	kref_init(&key->dk_kref);
++	p->set(key, op->dy_hop, au_br_sb(br));
++	old = dy_gadd(hbl, key);
++	if (old) {
++		kfree(key);
++		key = old;
++	}
++
++out_add:
++	old = dy_bradd(br, key);
++	if (old)
++		/* its ref-count should never be zero here */
++		kref_put(&key->dk_kref, dy_bug);
++out:
++	return key;
++}
++
++/* ---------------------------------------------------------------------- */
++/*
++ * Aufs prohibits O_DIRECT by defaut even if the branch supports it.
++ * This behaviour is necessary to return an error from open(O_DIRECT) instead
++ * of the succeeding I/O. The dio mount option enables O_DIRECT and makes
++ * open(O_DIRECT) always succeed, but the succeeding I/O may return an error.
++ * See the aufs manual in detail.
++ */
++static void dy_adx(struct au_dyaop *dyaop, int do_dx)
++{
++	if (!do_dx)
++		dyaop->da_op.direct_IO = NULL;
++	else
++		dyaop->da_op.direct_IO = aufs_aop.direct_IO;
++}
++
++static struct au_dyaop *dy_aget(struct au_branch *br,
++				const struct address_space_operations *h_aop,
++				int do_dx)
++{
++	struct au_dyaop *dyaop;
++	struct au_dynop op;
++
++	op.dy_type = AuDy_AOP;
++	op.dy_haop = h_aop;
++	dyaop = (void *)dy_get(&op, br);
++	if (IS_ERR(dyaop))
++		goto out;
++	dy_adx(dyaop, do_dx);
++
++out:
++	return dyaop;
++}
++
++int au_dy_iaop(struct inode *inode, aufs_bindex_t bindex,
++		struct inode *h_inode)
++{
++	int err, do_dx;
++	struct super_block *sb;
++	struct au_branch *br;
++	struct au_dyaop *dyaop;
++
++	AuDebugOn(!S_ISREG(h_inode->i_mode));
++	IiMustWriteLock(inode);
++
++	sb = inode->i_sb;
++	br = au_sbr(sb, bindex);
++	do_dx = !!au_opt_test(au_mntflags(sb), DIO);
++	dyaop = dy_aget(br, h_inode->i_mapping->a_ops, do_dx);
++	err = PTR_ERR(dyaop);
++	if (IS_ERR(dyaop))
++		/* unnecessary to call dy_fput() */
++		goto out;
++
++	err = 0;
++	inode->i_mapping->a_ops = &dyaop->da_op;
++
++out:
++	return err;
++}
++
++/*
++ * Is it safe to replace a_ops during the inode/file is in operation?
++ * Yes, I hope so.
++ */
++int au_dy_irefresh(struct inode *inode)
 +{
 +	int err;
-+	aufs_bindex_t bindex, bbot;
-+	struct au_branch *br;
++	aufs_bindex_t btop;
++	struct inode *h_inode;
 +
 +	err = 0;
-+	bbot = au_sbbot(sb);
-+	for (bindex = 0; !err && bindex <= bbot; bindex++) {
-+		br = au_sbr(sb, bindex);
-+		if (au_br_writable(br->br_perm))
-+			err = au_dr_hino(sb, bindex, /*br*/NULL, /*path*/NULL);
++	if (S_ISREG(inode->i_mode)) {
++		btop = au_ibtop(inode);
++		h_inode = au_h_iptr(inode, btop);
++		err = au_dy_iaop(inode, btop, h_inode);
 +	}
-+
 +	return err;
 +}
 +
-+int au_dr_opt_clr(struct super_block *sb, int no_flush)
++void au_dy_arefresh(int do_dx)
 +{
-+	int err;
-+	aufs_bindex_t bindex, bbot;
-+	struct au_branch *br;
++	struct hlist_bl_head *hbl;
++	struct hlist_bl_node *pos;
++	struct au_dykey *key;
 +
-+	err = 0;
-+	if (!no_flush) {
-+		err = au_dr_opt_flush(sb);
-+		if (unlikely(err))
-+			goto out;
-+	}
++	hbl = dynop + AuDy_AOP;
++	hlist_bl_lock(hbl);
++	hlist_bl_for_each_entry(key, pos, hbl, dk_hnode)
++		dy_adx((void *)key, do_dx);
++	hlist_bl_unlock(hbl);
++}
 +
-+	bbot = au_sbbot(sb);
-+	for (bindex = 0; bindex <= bbot; bindex++) {
-+		br = au_sbr(sb, bindex);
-+		au_dr_hino_free(&br->br_dirren);
-+	}
++/* ---------------------------------------------------------------------- */
 +
-+out:
-+	return err;
++void __init au_dy_init(void)
++{
++	int i;
++
++	/* make sure that 'struct au_dykey *' can be any type */
++	BUILD_BUG_ON(offsetof(struct au_dyaop, da_key));
++
++	for (i = 0; i < AuDyLast; i++)
++		INIT_HLIST_BL_HEAD(dynop + i);
 +}
-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-04-15 08:49:13.397817296 +0200
-@@ -0,0 +1,145 @@
++
++void au_dy_fin(void)
++{
++	int i;
++
++	for (i = 0; i < AuDyLast; i++)
++		WARN_ON(!hlist_bl_empty(dynop + i));
++}
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/dynop.h linux-4.9/fs/aufs/dynop.h
+--- linux-4.9/fs/aufs/dynop.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/dynop.h	2021-02-24 16:15:09.524906971 +0100
+@@ -0,0 +1,74 @@
 +/*
-+ * Copyright (C) 2017-2018 Junjiro R. Okajima
++ * Copyright (C) 2010-2018 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -12174,139 +12049,68 @@ diff -urN /usr/share/empty/fs/aufs/dirren.h linux/fs/aufs/dirren.h
 + */
 +
 +/*
-+ * renamed dir info
++ * dynamically customizable operations (for regular files only)
 + */
 +
-+#ifndef __AUFS_DIRREN_H__
-+#define __AUFS_DIRREN_H__
++#ifndef __AUFS_DYNOP_H__
++#define __AUFS_DYNOP_H__
 +
 +#ifdef __KERNEL__
 +
-+#include <linux/dcache.h>
-+#include <linux/statfs.h>
-+#include "hbl.h"
-+
-+#define AuDirren_NHASH 100
-+
-+#ifdef CONFIG_AUFS_DIRREN
-+/* copied from linux/fs/xfs/uuid.h */
-+typedef struct {
-+	unsigned char	__u_bits[16];
-+} uuid_t;
-+
-+#define __UUID_TMPLT		"01234567-0123-4567-0123-456701234567"
++#include <linux/fs.h>
++#include <linux/kref.h>
 +
-+enum au_brid_type {
-+	AuBrid_Unset,
-+	AuBrid_UUID,
-+	AuBrid_FSID,
-+	AuBrid_DEV
-+};
++enum {AuDy_AOP, AuDyLast};
 +
-+struct au_dr_brid {
-+	enum au_brid_type	type;
++struct au_dynop {
++	int						dy_type;
 +	union {
-+		uuid_t	uuid;	/* unimplemented yet */
-+		fsid_t	fsid;
-+		dev_t	dev;
++		const void				*dy_hop;
++		const struct address_space_operations	*dy_haop;
 +	};
 +};
 +
-+/* 20 is the max digits length of ulong 64 */
-+/* brid-type "_" uuid "_" inum */
-+#define AUFS_DIRREN_FNAME_SZ	(1 + 1 + sizeof(__UUID_TMPLT) + 20)
-+#define AUFS_DIRREN_ENV_VAL_SZ	(AUFS_DIRREN_FNAME_SZ + 1 + 20)
-+
-+struct au_dr_hino {
-+	struct hlist_bl_node	dr_hnode;
-+	ino_t			dr_h_ino;
-+};
++struct au_dykey {
++	union {
++		struct hlist_bl_node	dk_hnode;
++		struct rcu_head		dk_rcu;
++	};
++	struct au_dynop		dk_op;
 +
-+struct au_dr_br {
-+	struct hlist_bl_head	dr_h_ino[AuDirren_NHASH];
-+	struct au_dr_brid	dr_brid;
++	/*
++	 * during I am in the branch local array, kref is gotten. when the
++	 * branch is removed, kref is put.
++	 */
++	struct kref		dk_kref;
 +};
 +
-+struct au_dr_lookup {
-+	/* dr_name is pointed by struct au_do_lookup_args.name */
-+	struct qstr		dr_name; /* subset of dr_info */
-+	aufs_bindex_t		ninfo;
-+	struct au_drinfo	**drinfo;
++/* stop unioning since their sizes are very different from each other */
++struct au_dyaop {
++	struct au_dykey			da_key;
++	struct address_space_operations	da_op; /* not const */
 +};
-+#else
-+struct au_dr_hino;
-+/* empty */
-+struct au_dr_br { };
-+struct au_dr_lookup { };
-+#endif
 +
 +/* ---------------------------------------------------------------------- */
 +
++/* dynop.c */
 +struct au_branch;
-+struct au_do_lookup_args;
-+struct au_hinode;
-+#ifdef CONFIG_AUFS_DIRREN
-+int au_dr_hino_test_add(struct au_dr_br *dr, ino_t h_ino,
-+			struct au_dr_hino *add_ent);
-+void au_dr_hino_free(struct au_dr_br *dr);
-+int au_dr_br_init(struct super_block *sb, struct au_branch *br,
-+		  const struct path *path);
-+int au_dr_br_fin(struct super_block *sb, struct au_branch *br);
-+int au_dr_rename(struct dentry *src, aufs_bindex_t bindex,
-+		 struct qstr *dst_name, void *_rev);
-+void au_dr_rename_fin(struct dentry *src, aufs_bindex_t btgt, void *rev);
-+void au_dr_rename_rev(struct dentry *src, aufs_bindex_t bindex, void *rev);
-+int au_dr_lkup(struct au_do_lookup_args *lkup, struct dentry *dentry,
-+	       aufs_bindex_t bindex);
-+int au_dr_lkup_name(struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
-+int au_dr_lkup_h_ino(struct au_do_lookup_args *lkup, aufs_bindex_t bindex,
-+		     ino_t h_ino);
-+void au_dr_lkup_fin(struct au_do_lookup_args *lkup);
-+int au_dr_opt_set(struct super_block *sb);
-+int au_dr_opt_flush(struct super_block *sb);
-+int au_dr_opt_clr(struct super_block *sb, int no_flush);
-+#else
-+AuStubInt0(au_dr_hino_test_add, struct au_dr_br *dr, ino_t h_ino,
-+	   struct au_dr_hino *add_ent);
-+AuStubVoid(au_dr_hino_free, struct au_dr_br *dr);
-+AuStubInt0(au_dr_br_init, struct super_block *sb, struct au_branch *br,
-+	   const struct path *path);
-+AuStubInt0(au_dr_br_fin, struct super_block *sb, struct au_branch *br);
-+AuStubInt0(au_dr_rename, struct dentry *src, aufs_bindex_t bindex,
-+	   struct qstr *dst_name, void *_rev);
-+AuStubVoid(au_dr_rename_fin, struct dentry *src, aufs_bindex_t btgt, void *rev);
-+AuStubVoid(au_dr_rename_rev, struct dentry *src, aufs_bindex_t bindex,
-+	   void *rev);
-+AuStubInt0(au_dr_lkup, struct au_do_lookup_args *lkup, struct dentry *dentry,
-+	   aufs_bindex_t bindex);
-+AuStubInt0(au_dr_lkup_name, struct au_do_lookup_args *lkup, aufs_bindex_t btgt);
-+AuStubInt0(au_dr_lkup_h_ino, struct au_do_lookup_args *lkup,
-+	   aufs_bindex_t bindex, ino_t h_ino);
-+AuStubVoid(au_dr_lkup_fin, struct au_do_lookup_args *lkup);
-+AuStubInt0(au_dr_opt_set, struct super_block *sb);
-+AuStubInt0(au_dr_opt_flush, struct super_block *sb);
-+AuStubInt0(au_dr_opt_clr, struct super_block *sb, int no_flush);
-+#endif
-+
-+/* ---------------------------------------------------------------------- */
++void au_dy_put(struct au_dykey *key);
++int au_dy_iaop(struct inode *inode, aufs_bindex_t bindex,
++		struct inode *h_inode);
++int au_dy_irefresh(struct inode *inode);
++void au_dy_arefresh(int do_dio);
 +
-+#ifdef CONFIG_AUFS_DIRREN
-+static inline int au_dr_ihash(ino_t h_ino)
-+{
-+	return h_ino % AuDirren_NHASH;
-+}
-+#else
-+AuStubInt0(au_dr_ihash, ino_t h_ino);
-+#endif
++void __init au_dy_init(void);
++void au_dy_fin(void);
 +
 +#endif /* __KERNEL__ */
-+#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 @@
++#endif /* __AUFS_DYNOP_H__ */
+diff -urNp -x '*.orig' linux-4.9/fs/aufs/export.c linux-4.9/fs/aufs/export.c
+--- linux-4.9/fs/aufs/export.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-4.9/fs/aufs/export.c	2021-02-24 16:15:09.528240413 +0100
+@@ -0,0 +1,836 @@
 +/*
-+ * Copyright (C) 2010-2018 Junjiro R. Okajima
++ * Copyright (C) 2005-2018 Junjiro R. Okajima
 + *
 + * This program, aufs is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -12322,364 +12126,831 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c
 + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 + */
 +
-+/*
-+ * dynamically customizable operations for regular files
-+ */
++/*
++ * export via nfs
++ */
++
++#include <linux/exportfs.h>
++#include <linux/fs_struct.h>
++#include <linux/namei.h>
++#include <linux/nsproxy.h>
++#include <linux/random.h>
++#include <linux/writeback.h>
++#include "aufs.h"
++
++union conv {
++#ifdef CONFIG_AUFS_INO_T_64
++	__u32 a[2];
++#else
++	__u32 a[1];
++#endif
++	ino_t ino;
++};
++
++static ino_t decode_ino(__u32 *a)
++{
++	union conv u;
++
++	BUILD_BUG_ON(sizeof(u.ino) != sizeof(u.a));
++	u.a[0] = a[0];
++#ifdef CONFIG_AUFS_INO_T_64
++	u.a[1] = a[1];
++#endif
++	return u.ino;
++}
++
++static void encode_ino(__u32 *a, ino_t ino)
++{
++	union conv u;
++
++	u.ino = ino;
++	a[0] = u.a[0];
++#ifdef CONFIG_AUFS_INO_T_64
++	a[1] = u.a[1];
++#endif
++}
++
++/* NFS file handle */
++enum {
++	Fh_br_id,
++	Fh_sigen,
++#ifdef CONFIG_AUFS_INO_T_64
++	/* support 64bit inode number */
++	Fh_ino1,
++	Fh_ino2,
++	Fh_dir_ino1,
++	Fh_dir_ino2,
++#else
++	Fh_ino1,
++	Fh_dir_ino1,
++#endif
++	Fh_igen,
++	Fh_h_type,
++	Fh_tail,
++
++	Fh_ino = Fh_ino1,
++	Fh_dir_ino = Fh_dir_ino1
++};
++
++static int au_test_anon(struct dentry *dentry)
++{
++	/* note: read d_flags without d_lock */
++	return !!(dentry->d_flags & DCACHE_DISCONNECTED);
++}
++
++int au_test_nfsd(void)
++{
++	int ret;
++	struct task_struct *tsk = current;
++	char comm[sizeof(tsk->comm)];
++
++	ret = 0;
++	if (tsk->flags & PF_KTHREAD) {
++		get_task_comm(comm, tsk);
++		ret = !strcmp(comm, "nfsd");
++	}
++
++	return ret;
++}
++
++/* ---------------------------------------------------------------------- */
++/* inode generation external table */
++
++void au_xigen_inc(struct inode *inode)
++{
++	loff_t pos;
++	ssize_t sz;
++	__u32 igen;
++	struct super_block *sb;
++	struct au_sbinfo *sbinfo;
++
++	sb = inode->i_sb;
++	AuDebugOn(!au_opt_test(au_mntflags(sb), XINO));
++
++	sbinfo = au_sbi(sb);
++	pos = inode->i_ino;
++	pos *= sizeof(igen);
++	igen = inode->i_generation + 1;
++	sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xigen, &igen,
++			 sizeof(igen), &pos);
++	if (sz == sizeof(igen))
++		return; /* success */
++
++	if (unlikely(sz >= 0))
++		AuIOErr("xigen error (%zd)\n", sz);
++}
++
++int au_xigen_new(struct inode *inode)
++{
++	int err;
<Skipped 33874 lines>
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list