aufs4.x-rcN kbuild patch
diff --git a/fs/Kconfig b/fs/Kconfig
-index b0e42b6..7fa4b68 100644
+index 7aee6d6..ec92031 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
-@@ -249,6 +249,7 @@ source "fs/pstore/Kconfig"
+@@ -248,6 +248,7 @@ source "fs/pstore/Kconfig"
source "fs/sysv/Kconfig"
source "fs/ufs/Kconfig"
source "fs/exofs/Kconfig"
aufs4.x-rcN base patch
diff --git a/MAINTAINERS b/MAINTAINERS
-index 09b5ab6..6640ab1 100644
+index 1c3feff..1a12137 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -2348,6 +2348,19 @@ F: include/linux/audit.h
+@@ -2392,6 +2392,19 @@ F: include/linux/audit.h
F: include/uapi/linux/audit.h
F: kernel/audit*
M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
W: http://miguelojeda.es/auxdisplay.htm
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index ebbd0c3..6b8a6a4c 100644
+index f321b96..10707c3 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -700,6 +700,24 @@ static inline int is_loop_device(struct file *file)
static ssize_t loop_attr_show(struct device *dev, char *page,
diff --git a/fs/dcache.c b/fs/dcache.c
-index a9f995f..3458af5 100644
+index f901413..e3719a5 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
-@@ -1164,7 +1164,7 @@ enum d_walk_ret {
+@@ -1197,7 +1197,7 @@ enum d_walk_ret {
*
* The @enter() and @finish() callbacks are called with d_lock held.
*/
void (*finish)(void *))
{
diff --git a/fs/fcntl.c b/fs/fcntl.c
-index f4e7267..d39404c 100644
+index 3b01b64..659760e 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -31,7 +31,7 @@
return error;
diff --git a/fs/inode.c b/fs/inode.c
-index db59147..69cbe9c 100644
+index 5037059..73820bf 100644
--- a/fs/inode.c
+++ b/fs/inode.c
-@@ -1640,7 +1640,7 @@ EXPORT_SYMBOL(generic_update_time);
+@@ -1641,7 +1641,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.
*/
int (*update_time)(struct inode *, struct timespec *, int);
diff --git a/fs/read_write.c b/fs/read_write.c
-index 19d4d88..05033f7 100644
+index 0cc7033..6e542f0 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
-@@ -513,6 +513,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
+@@ -473,6 +473,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
}
EXPORT_SYMBOL(__vfs_write);
{
mm_segment_t old_fs;
diff --git a/fs/splice.c b/fs/splice.c
-index 540c4a4..4a0bc62 100644
+index ae41201..9753304 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -853,8 +853,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
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 11ba023..abf6a5d 100644
+index 2a54c1f..7a5fa3f 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -27,7 +27,7 @@
static inline void fput_light(struct file *file, int fput_needed)
{
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 803e5a9..22d2910 100644
+index cbfe127..9b21bb5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -1248,6 +1248,7 @@ extern void fasync_free(struct fasync_struct *);
+@@ -1262,6 +1262,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 int f_setown(struct file *filp, unsigned long arg, int force);
extern void f_delown(struct file *filp);
-@@ -1674,6 +1675,7 @@ struct file_operations {
+@@ -1683,6 +1684,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 (*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);
-@@ -1750,6 +1752,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
+@@ -1753,6 +1755,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
struct iovec *fast_pointer,
struct iovec **ret_pointer);
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 *);
-@@ -2131,6 +2139,7 @@ extern int current_umask(void);
+@@ -2157,6 +2165,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);
/* /sys/fs */
extern struct kobject *fs_kobj;
-@@ -2411,6 +2420,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
+@@ -2437,6 +2446,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
return false;
}
#endif
aufs4.x-rcN mmap patch
diff --git a/fs/proc/base.c b/fs/proc/base.c
-index f1e1927..7b5af0c 100644
+index 719c2e9..a1b7968 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
-@@ -1943,7 +1943,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path)
+@@ -1986,7 +1986,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) {
ino = inode->i_ino;
}
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
-index 520802d..61a037d 100644
+index fe8f326..b2f7f1a 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
-@@ -292,7 +292,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
+@@ -293,7 +293,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
const char *name = NULL;
if (file) {
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
-@@ -1638,7 +1641,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
+@@ -1640,7 +1643,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;
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 6f543a4..696494b 100644
+index 46b9ac5..62ba1c3 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1306,6 +1306,28 @@ static inline int fixup_user_fault(struct task_struct *tsk,
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 45cdb27..1a40012 100644
+index 3cadee0..d0142c1 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -259,6 +259,7 @@ struct vm_region {
#ifndef CONFIG_MMU
diff --git a/kernel/fork.c b/kernel/fork.c
-index e53770d..cdf7516 100644
+index cbbea27..f0fd8a1 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
-@@ -665,7 +665,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
+@@ -663,7 +663,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
struct inode *inode = file_inode(file);
struct address_space *mapping = file->f_mapping;
atomic_dec(&inode->i_writecount);
i_mmap_lock_write(mapping);
diff --git a/mm/Makefile b/mm/Makefile
-index 026f6a8..723da17 100644
+index 411bd24..e7de927 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -39,7 +39,7 @@ obj-y := filemap.o mempool.o oom_kill.o \
obj-y += init-mm.o
diff --git a/mm/filemap.c b/mm/filemap.c
-index 6f1be57..69a8d94 100644
+index 0b41c8c..c5262ff 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
-@@ -2408,7 +2408,7 @@ int filemap_page_mkwrite(struct vm_fault *vmf)
+@@ -2543,7 +2543,7 @@ int filemap_page_mkwrite(struct vm_fault *vmf)
int ret = VM_FAULT_LOCKED;
sb_start_pagefault(inode->i_sb);
if (page->mapping != inode->i_mapping) {
unlock_page(page);
diff --git a/mm/mmap.c b/mm/mmap.c
-index a5e3dcd..a5d908c 100644
+index f19efcf..7fdd59e 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)
/* Undo any partial mapping done by a device driver. */
unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end);
-@@ -2571,7 +2571,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2568,7 +2568,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
goto out_free_mpol;
if (new->vm_file)
if (new->vm_ops && new->vm_ops->open)
new->vm_ops->open(new);
-@@ -2590,7 +2590,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2587,7 +2587,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
if (new->vm_ops && new->vm_ops->close)
new->vm_ops->close(new);
if (new->vm_file)
unlink_anon_vmas(new);
out_free_mpol:
mpol_put(vma_policy(new));
-@@ -2744,7 +2744,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2741,7 +2741,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;
pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.\n",
current->comm, current->pid);
-@@ -2819,10 +2819,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2816,10 +2816,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
}
}
out:
up_write(&mm->mmap_sem);
if (populate)
-@@ -3113,7 +3130,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+@@ -3110,7 +3127,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)
aufs4.x-rcN standalone patch
diff --git a/fs/dcache.c b/fs/dcache.c
-index 3458af5..5fd25bb 100644
+index e3719a5..3203470 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
-@@ -1272,6 +1272,7 @@ void d_walk(struct dentry *parent, void *data,
+@@ -1305,6 +1305,7 @@ void d_walk(struct dentry *parent, void *data,
seq = 1;
goto again;
}
struct check_mount {
struct vfsmount *mnt;
-@@ -2862,6 +2863,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2)
+@@ -2894,6 +2895,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2)
write_sequnlock(&rename_lock);
}
/**
* d_ancestor - search for an ancestor
diff --git a/fs/exec.c b/fs/exec.c
-index 9041990..31f14c6 100644
+index 62175cb..f0b6fdd 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -109,6 +109,7 @@ bool path_noexec(const struct path *path)
#ifdef CONFIG_USELIB
/*
diff --git a/fs/fcntl.c b/fs/fcntl.c
-index d39404c..ac1dc66 100644
+index 659760e..5c37087 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -84,6 +84,7 @@ int setfl(int fd, struct file * filp, unsigned long arg)
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 954d510..4fb5b10 100644
+index 72e861a..01ae52f 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -148,6 +148,7 @@ struct file *get_empty_filp(void)
/**
* alloc_file - allocate and initialize a 'struct file'
-@@ -259,6 +260,7 @@ void flush_delayed_fput(void)
+@@ -260,6 +261,7 @@ void flush_delayed_fput(void)
{
delayed_fput(NULL);
}
static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);
-@@ -301,6 +303,7 @@ void __fput_sync(struct file *file)
+@@ -302,6 +304,7 @@ void __fput_sync(struct file *file)
}
EXPORT_SYMBOL(fput);
void put_filp(struct file *file)
{
-@@ -309,6 +312,7 @@ void put_filp(struct file *file)
+@@ -310,6 +313,7 @@ void put_filp(struct file *file)
file_free(file);
}
}
void __init files_init(void)
{
diff --git a/fs/inode.c b/fs/inode.c
-index 69cbe9c..764566d 100644
+index 73820bf..7db829e 100644
--- a/fs/inode.c
+++ b/fs/inode.c
-@@ -1649,6 +1649,7 @@ int update_time(struct inode *inode, struct timespec *time, int flags)
+@@ -1650,6 +1650,7 @@ int update_time(struct inode *inode, struct timespec *time, int flags)
return update_time(inode, time, flags);
}
/**
* touch_atime - update the access time
diff --git a/fs/namespace.c b/fs/namespace.c
-index 5a44384..cc6f6fb 100644
+index f8893dc..c55d949 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
-@@ -462,6 +462,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
+@@ -463,6 +463,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
mnt_dec_writers(real_mount(mnt));
preempt_enable();
}
/**
* mnt_drop_write - give up write access to a mount
-@@ -1881,6 +1882,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+@@ -1823,6 +1824,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
}
return 0;
}
/*
* Destroy all marks in destroy_list, waits for SRCU period to finish before
diff --git a/fs/open.c b/fs/open.c
-index cd0c5be..491442a 100644
+index 35bb784..92e08c5 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,
static int do_dentry_open(struct file *f,
struct inode *inode,
diff --git a/fs/read_write.c b/fs/read_write.c
-index 05033f7..ce062e8 100644
+index 6e542f0..c6fa090 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
-@@ -523,6 +523,7 @@ vfs_readf_t vfs_readf(struct file *file)
+@@ -483,6 +483,7 @@ vfs_readf_t vfs_readf(struct file *file)
return new_sync_read;
return ERR_PTR(-ENOSYS);
}
vfs_writef_t vfs_writef(struct file *file)
{
-@@ -534,6 +535,7 @@ vfs_writef_t vfs_writef(struct file *file)
+@@ -494,6 +495,7 @@ vfs_writef_t vfs_writef(struct file *file)
return new_sync_write;
return ERR_PTR(-ENOSYS);
}
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 4a0bc62..21d7893 100644
+index 9753304..b38e036 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -866,6 +866,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
/**
* splice_direct_to_actor - splices data directly between two non-pipes
diff --git a/fs/sync.c b/fs/sync.c
-index abf6a5d..c86fe9c 100644
+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)
int devcgroup_inode_mknod(int mode, dev_t dev)
{
diff --git a/security/security.c b/security/security.c
-index b9fea39..afa97dd 100644
+index 3013237..342ce8b 100644
--- a/security/security.c
+++ b/security/security.c
-@@ -492,6 +492,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
+@@ -535,6 +535,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
return 0;
return call_int_hook(path_rmdir, 0, dir, dentry);
}
int security_path_unlink(const struct path *dir, struct dentry *dentry)
{
-@@ -508,6 +509,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry,
+@@ -551,6 +552,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);
}
int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
struct dentry *new_dentry)
-@@ -516,6 +518,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
+@@ -559,6 +561,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);
}
int security_path_rename(const struct path *old_dir, struct dentry *old_dentry,
const struct path *new_dir, struct dentry *new_dentry,
-@@ -543,6 +546,7 @@ int security_path_truncate(const struct path *path)
+@@ -586,6 +589,7 @@ int security_path_truncate(const struct path *path)
return 0;
return call_int_hook(path_truncate, 0, path);
}
int security_path_chmod(const struct path *path, umode_t mode)
{
-@@ -550,6 +554,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
+@@ -593,6 +597,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
return 0;
return call_int_hook(path_chmod, 0, path, mode);
}
int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
{
-@@ -557,6 +562,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
+@@ -600,6 +605,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);
}
int security_path_chroot(const struct path *path)
{
-@@ -642,6 +648,7 @@ int security_inode_readlink(struct dentry *dentry)
+@@ -685,6 +691,7 @@ int security_inode_readlink(struct dentry *dentry)
return 0;
return call_int_hook(inode_readlink, 0, dentry);
}
int security_inode_follow_link(struct dentry *dentry, struct inode *inode,
bool rcu)
-@@ -657,6 +664,7 @@ int security_inode_permission(struct inode *inode, int mask)
+@@ -700,6 +707,7 @@ int security_inode_permission(struct inode *inode, int mask)
return 0;
return call_int_hook(inode_permission, 0, inode, mask);
}
int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
{
-@@ -828,6 +836,7 @@ int security_file_permission(struct file *file, int mask)
+@@ -871,6 +879,7 @@ int security_file_permission(struct file *file, int mask)
return fsnotify_perm(file, mask);
}
int security_file_alloc(struct file *file)
{
-@@ -887,6 +896,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
+@@ -930,6 +939,7 @@ int security_mmap_file(struct file *file, unsigned long prot,
return ret;
return ima_file_mmap(file, prot);
}
+ will be empty. About XINO files, see the aufs manual.
diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt linux/Documentation/filesystems/aufs/design/01intro.txt
--- /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt 1970-01-01 01:00:00.000000000 +0100
-+++ linux/Documentation/filesystems/aufs/design/01intro.txt 2017-07-29 12:14:25.893041746 +0200
++++ linux/Documentation/filesystems/aufs/design/01intro.txt 2017-09-05 10:42:11.038754821 +0200
@@ -0,0 +1,171 @@
+
+# Copyright (C) 2005-2017 Junjiro R. Okajima
+Introduction
+----------------------------------------
+
-+aufs [ei ju: ef es] | [a u f s]
++aufs [ei ju: ef es] | /ey-yoo-ef-es/ | [a u f s]
+1. abbrev. for "advanced multi-layered unification filesystem".
+2. abbrev. for "another unionfs".
+3. abbrev. for "auf das" in German which means "on the" in English.
+-include ${srctree}/${src}/conf_priv.mk
diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c
--- /usr/share/empty/fs/aufs/cpup.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/cpup.c 2017-07-29 12:14:25.899708630 +0200
++++ linux/fs/aufs/cpup.c 2017-09-05 10:42:11.055421928 +0200
@@ -0,0 +1,1442 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ if (!au_test_xfs(h_src_sb))
+ err = au_copy_file(dst, src, len);
+ else {
-+ inode_unlock(h_src_inode);
++ inode_unlock_shared(h_src_inode);
+ err = au_copy_file(dst, src, len);
-+ inode_lock(h_src_inode);
++ vfsub_inode_lock_shared_nested(h_src_inode, AuLsc_I_CHILD);
+ }
+
+ return err;
+ }
+
+ if (!au_test_nfs(h_src_sb)) {
-+ inode_unlock(h_src_inode);
++ inode_unlock_shared(h_src_inode);
+ err = vfsub_clone_file_range(src, dst, len);
-+ inode_lock(h_src_inode);
++ vfsub_inode_lock_shared_nested(h_src_inode, AuLsc_I_CHILD);
+ } else
+ err = vfsub_clone_file_range(src, dst, len);
+ /* older XFS has a condition in cloning */
+ cpg->len = l;
+ if (cpg->len) {
+ /* try stopping to update while we are referencing */
-+ inode_lock_nested(h_src_inode, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(h_src_inode, AuLsc_I_CHILD);
+ au_pin_hdir_unlock(cpg->pin);
+
+ h_path.dentry = au_h_dptr(cpg->dentry, cpg->bsrc);
+ if (!au_test_nfs(h_src_inode->i_sb))
+ err = vfsub_getattr(&h_path, &h_src_attr->st);
+ else {
-+ inode_unlock(h_src_inode);
++ inode_unlock_shared(h_src_inode);
+ err = vfsub_getattr(&h_path, &h_src_attr->st);
-+ inode_lock_nested(h_src_inode, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(h_src_inode, AuLsc_I_CHILD);
+ }
+ if (unlikely(err)) {
-+ inode_unlock(h_src_inode);
++ inode_unlock_shared(h_src_inode);
+ goto out;
+ }
+ h_src_attr->valid = 1;
+ if (!au_test_nfs(h_src_inode->i_sb)) {
+ err = au_cp_regular(cpg);
-+ inode_unlock(h_src_inode);
++ inode_unlock_shared(h_src_inode);
+ } else {
-+ inode_unlock(h_src_inode);
++ inode_unlock_shared(h_src_inode);
+ err = au_cp_regular(cpg);
+ }
+ rerr = au_pin_hdir_relock(cpg->pin);
+#endif /* __AUFS_DEBUG_H__ */
diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c
--- /usr/share/empty/fs/aufs/dentry.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dentry.c 2017-07-29 12:14:25.899708630 +0200
++++ linux/fs/aufs/dentry.c 2017-09-05 10:42:11.055421928 +0200
@@ -0,0 +1,1130 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ || (d_really_is_positive(dentry) && !d_is_dir(dentry)))
+ goto out; /* success */
+
-+ inode_lock_nested(h_inode, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(h_inode, AuLsc_I_CHILD);
+ opq = au_diropq_test(h_dentry);
-+ inode_unlock(h_inode);
++ inode_unlock_shared(h_inode);
+ if (opq > 0)
+ au_set_dbdiropq(dentry, bindex);
+ else if (unlikely(opq < 0)) {
+ continue;
+
+ h_dir = d_inode(h_parent);
-+ inode_lock_nested(h_dir, AuLsc_I_PARENT);
++ vfsub_inode_lock_shared_nested(h_dir, AuLsc_I_PARENT);
+ h_dentry = au_do_lookup(h_parent, dentry, bindex, &whname,
+ &args);
-+ inode_unlock(h_dir);
++ inode_unlock_shared(h_dir);
+ err = PTR_ERR(h_dentry);
+ if (IS_ERR(h_dentry))
+ goto out_parent;
+}
diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c
--- /usr/share/empty/fs/aufs/dir.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/dir.c 2017-07-29 12:14:25.899708630 +0200
++++ linux/fs/aufs/dir.c 2017-09-05 10:42:11.058755349 +0200
@@ -0,0 +1,759 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ h_dentry = au_h_dptr(dentry, arg->bindex);
+ h_inode = d_inode(h_dentry);
+ /* todo: i_mode changes anytime? */
-+ inode_lock_nested(h_inode, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(h_inode, AuLsc_I_CHILD);
+ err = au_test_h_perm_sio(h_inode, MAY_EXEC | MAY_READ);
-+ inode_unlock(h_inode);
++ inode_unlock_shared(h_inode);
+ if (!err)
+ err = do_test_empty(dentry, arg);
+ else {
+};
diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h
--- /usr/share/empty/fs/aufs/file.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.h 2017-07-29 12:14:25.903042072 +0200
-@@ -0,0 +1,330 @@
++++ linux/fs/aufs/file.h 2017-09-05 10:42:11.058755349 +0200
+@@ -0,0 +1,331 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ *
+
+#include <linux/file.h>
+#include <linux/fs.h>
++#include <linux/mm_types.h>
+#include <linux/poll.h>
+#include "rwsem.h"
+
+}
diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c
--- /usr/share/empty/fs/aufs/hnotify.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/hnotify.c 2017-07-29 12:14:25.903042072 +0200
++++ linux/fs/aufs/hnotify.c 2017-09-05 10:42:11.058755349 +0200
@@ -0,0 +1,711 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ if (au_ftest_hnjob(a->flags, TRYXINO0)
+ && a->inode
+ && a->h_inode) {
-+ inode_lock_nested(a->h_inode, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(a->h_inode, AuLsc_I_CHILD);
+ if (!a->h_inode->i_nlink
+ && !(a->h_inode->i_state & I_LINKABLE))
+ hn_xino(a->inode, a->h_inode); /* ignore this error */
-+ inode_unlock(a->h_inode);
++ inode_unlock_shared(a->h_inode);
+ }
+
+ /* make the generation obsolete */
+}
diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h
--- /usr/share/empty/fs/aufs/inode.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.h 2017-07-29 12:14:25.903042072 +0200
-@@ -0,0 +1,686 @@
++++ linux/fs/aufs/inode.h 2017-09-05 10:42:11.058755349 +0200
+@@ -0,0 +1,694 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ *
+
+#include <linux/fsnotify.h>
+#include "rwsem.h"
++#include "vfsub.h"
+
+struct vfsmount;
+
+ au_hn_suspend(hdir);
+}
+
++static inline void au_hn_inode_lock_shared_nested(struct au_hinode *hdir,
++ unsigned int sc)
++{
++ vfsub_inode_lock_shared_nested(hdir->hi_inode, sc);
++ au_hn_suspend(hdir);
++}
++
+static inline void au_hn_inode_unlock(struct au_hinode *hdir)
+{
+ au_hn_resume(hdir);
+}
diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c
--- /usr/share/empty/fs/aufs/i_op.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op.c 2017-07-29 12:14:25.903042072 +0200
++++ linux/fs/aufs/i_op.c 2017-09-05 10:42:11.058755349 +0200
@@ -0,0 +1,1452 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ if (!err && add_entry && !au_ftest_wrdir(add_entry, TMPFILE)) {
+ h_parent = au_h_dptr(parent, bcpup);
+ h_dir = d_inode(h_parent);
-+ inode_lock_nested(h_dir, AuLsc_I_PARENT);
++ vfsub_inode_lock_shared_nested(h_dir, AuLsc_I_PARENT);
+ err = au_lkup_neg(dentry, bcpup, /*wh*/0);
+ /* todo: no unlock here */
-+ inode_unlock(h_dir);
++ inode_unlock_shared(h_dir);
+
+ AuDbg("bcpup %d\n", bcpup);
+ if (!err) {
+ a->h_path.dentry = au_h_dptr(dentry, btop);
+ a->h_inode = d_inode(a->h_path.dentry);
+ if (ia && (ia->ia_valid & ATTR_SIZE)) {
-+ inode_lock_nested(a->h_inode, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(a->h_inode, AuLsc_I_CHILD);
+ if (ia->ia_size < i_size_read(a->h_inode))
+ sz = ia->ia_size;
-+ inode_unlock(a->h_inode);
++ inode_unlock_shared(a->h_inode);
+ }
+
+ hi_wh = NULL;
+}
diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h
--- /usr/share/empty/fs/aufs/opts.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/opts.h 2017-07-29 12:14:25.903042072 +0200
-@@ -0,0 +1,212 @@
++++ linux/fs/aufs/opts.h 2017-09-05 10:42:11.058755349 +0200
+@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ *
+const char *au_optstr_wbr_create(int wbr_create);
+
+void au_opts_free(struct au_opts *opts);
++struct super_block;
+int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts);
+int au_opts_verify(struct super_block *sb, unsigned long sb_flags,
+ unsigned int pending);
+#endif /* __AUFS_OPTS_H__ */
diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c
--- /usr/share/empty/fs/aufs/plink.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/plink.c 2017-07-29 12:14:25.903042072 +0200
++++ linux/fs/aufs/plink.c 2017-09-05 10:42:11.058755349 +0200
@@ -0,0 +1,514 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ struct inode *h_inode;
+
+ h_inode = d_inode(h_parent);
-+ inode_lock_nested(h_inode, AuLsc_I_CHILD2);
++ vfsub_inode_lock_shared_nested(h_inode, AuLsc_I_CHILD2);
+ h_dentry = vfsub_lkup_one(tgtname, h_parent);
-+ inode_unlock(h_inode);
++ inode_unlock_shared(h_inode);
+ return h_dentry;
+}
+
+}
diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h
--- /usr/share/empty/fs/aufs/vfsub.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.h 2017-07-29 12:14:25.906375514 +0200
-@@ -0,0 +1,353 @@
++++ linux/fs/aufs/vfsub.h 2017-09-05 10:42:11.058755349 +0200
+@@ -0,0 +1,360 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ *
+#define MtxMustLock(mtx) AuDebugOn(!mutex_is_locked(mtx))
+#define IMustLock(i) AuDebugOn(!inode_is_locked(i))
+
++/* why VFS doesn't define it? */
++static inline
++void vfsub_inode_lock_shared_nested(struct inode *inode, unsigned int sc)
++{
++ down_read_nested(&inode->i_rwsem, sc);
++}
++
+/* ---------------------------------------------------------------------- */
+
+static inline void vfsub_drop_nlink(struct inode *inode)
+}
diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h
--- /usr/share/empty/fs/aufs/whout.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.h 2017-07-29 12:14:25.906375514 +0200
-@@ -0,0 +1,84 @@
++++ linux/fs/aufs/whout.h 2017-09-05 10:42:11.058755349 +0200
+@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+ *
+int au_wh_name_alloc(struct qstr *wh, const struct qstr *name);
+int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio);
+int au_diropq_test(struct dentry *h_dentry);
++struct au_branch;
+struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br,
+ struct qstr *prefix);
+int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br);
+#endif /* __AUFS_WKQ_H__ */
diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c
--- /usr/share/empty/fs/aufs/xattr.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xattr.c 2017-07-29 12:14:25.906375514 +0200
++++ linux/fs/aufs/xattr.c 2017-09-05 10:42:11.058755349 +0200
@@ -0,0 +1,357 @@
+/*
+ * Copyright (C) 2014-2017 Junjiro R. Okajima
+ h_isrc = d_inode(h_src);
+ h_idst = d_inode(h_dst);
+ inode_unlock(h_idst);
-+ inode_lock_nested(h_isrc, AuLsc_I_CHILD);
++ vfsub_inode_lock_shared_nested(h_isrc, AuLsc_I_CHILD);
+ inode_lock_nested(h_idst, AuLsc_I_CHILD2);
+ unlocked = 0;
+
+ goto out;
+ err = vfs_listxattr(h_src, p, ssz);
+ }
-+ inode_unlock(h_isrc);
++ inode_unlock_shared(h_isrc);
+ unlocked = 1;
+ AuDbg("err %d, ssz %zd\n", err, ssz);
+ if (unlikely(err < 0))
+ kfree(o);
+out:
+ if (!unlocked)
-+ inode_unlock(h_isrc);
++ inode_unlock_shared(h_isrc);
+ AuTraceErr(err);
+ return err;
+}
+}
diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/linux/aufs_type.h
--- /usr/share/empty/include/uapi/linux/aufs_type.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux/include/uapi/linux/aufs_type.h 2017-07-31 10:27:18.853311720 +0200
++++ linux/include/uapi/linux/aufs_type.h 2017-09-05 10:42:11.058755349 +0200
@@ -0,0 +1,419 @@
+/*
+ * Copyright (C) 2005-2017 Junjiro R. Okajima
+
+#include <linux/limits.h>
+
-+#define AUFS_VERSION "4.x-rcN-20170703"
++#define AUFS_VERSION "4.x-rcN-20170904"
+
+/* todo? move this to linux-2.6.19/include/magic.h */
+#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
aufs4.x-rcN loopback patch
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index 6b8a6a4c..a80416e 100644
+index 10707c3..af32e47 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -547,7 +547,7 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)
/* freeze queue and wait for completion of scheduled requests */
blk_mq_freeze_queue(lo->lo_queue);
-@@ -614,6 +617,15 @@ static int loop_flush(struct loop_device *lo)
- return loop_switch(lo, NULL);
- }
-
+@@ -611,7 +614,16 @@ static int loop_flush(struct loop_device *lo)
+ /* 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);
++}
++
+static struct file *loop_real_file(struct file *file)
+{
+ struct file *f = NULL;
+ 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,
- struct block_device *bdev)
- {
@@ -648,6 +660,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
unsigned int arg)
{
out:
return error;
}
-@@ -875,7 +899,7 @@ static int loop_prepare_queue(struct loop_device *lo)
+@@ -882,7 +906,7 @@ static int loop_prepare_queue(struct loop_device *lo)
static int loop_set_fd(struct loop_device *lo, fmode_t mode,
struct block_device *bdev, unsigned int arg)
{
struct inode *inode;
struct address_space *mapping;
unsigned lo_blocksize;
-@@ -890,6 +914,12 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
+@@ -897,6 +921,12 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
file = fget(arg);
if (!file)
goto out;
error = -EBUSY;
if (lo->lo_state != Lo_unbound)
-@@ -942,6 +972,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
+@@ -949,6 +979,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
lo->lo_device = bdev;
lo->lo_flags = lo_flags;
lo->lo_backing_file = file;
lo->transfer = NULL;
lo->ioctl = NULL;
lo->lo_sizelimit = 0;
-@@ -974,6 +1005,8 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
+@@ -981,6 +1012,8 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
out_putf:
fput(file);
out:
/* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
-@@ -1020,6 +1053,7 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
+@@ -1027,6 +1060,7 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
static int loop_clr_fd(struct loop_device *lo)
{
struct file *filp = lo->lo_backing_file;
gfp_t gfp = lo->old_gfp_mask;
struct block_device *bdev = lo->lo_device;
-@@ -1051,6 +1085,7 @@ static int loop_clr_fd(struct loop_device *lo)
+@@ -1058,6 +1092,7 @@ static int loop_clr_fd(struct loop_device *lo)
spin_lock_irq(&lo->lo_lock);
lo->lo_state = Lo_rundown;
lo->lo_backing_file = NULL;
spin_unlock_irq(&lo->lo_lock);
loop_release_xfer(lo);
-@@ -1095,6 +1130,8 @@ static int loop_clr_fd(struct loop_device *lo)
+@@ -1102,6 +1137,8 @@ static int loop_clr_fd(struct loop_device *lo)
* bd_mutex which is usually taken before lo_ctl_mutex.
*/
fput(filp);
/* ---------------------------------------------------------------------- */
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 22d2910..d8db3fb 100644
+index 9b21bb5..f7124fa 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -1811,6 +1811,10 @@ struct super_operations {
+@@ -1814,6 +1814,10 @@ struct super_operations {
struct shrink_control *);
long (*free_cached_objects)(struct super_block *,
struct shrink_control *);
};
/*
---- linux-4.12/drivers/block/loop.c~ 2017-07-31 10:28:05.000000000 +0200
-+++ linux-4.12/drivers/block/loop.c 2017-07-31 10:30:00.818087749 +0200
-@@ -614,7 +614,7 @@ 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);
- }
-
- static struct file *loop_real_file(struct file *file)