SPDX-License-Identifier: GPL-2.0
-aufs6.0 kbuild patch
+aufs6.x-rcN kbuild patch
diff --git a/fs/Kconfig b/fs/Kconfig
-index a547307c1ae8..919ca5404804 100644
+index 2685a4d0d353..a2df3d4bb3aa 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
-@@ -318,6 +318,7 @@ source "fs/sysv/Kconfig"
+@@ -319,6 +319,7 @@ source "fs/sysv/Kconfig"
source "fs/ufs/Kconfig"
source "fs/erofs/Kconfig"
source "fs/vboxsf/Kconfig"
endif # MISC_FILESYSTEMS
diff --git a/fs/Makefile b/fs/Makefile
-index 93b80529f8e8..a26c58d09435 100644
+index 4dea17840761..9795cbfdd0bf 100644
--- a/fs/Makefile
+++ b/fs/Makefile
-@@ -138,3 +138,4 @@ obj-$(CONFIG_EFIVAR_FS) += efivarfs/
+@@ -137,3 +137,4 @@ obj-$(CONFIG_EFIVAR_FS) += efivarfs/
obj-$(CONFIG_EROFS_FS) += erofs/
obj-$(CONFIG_VBOXSF_FS) += vboxsf/
obj-$(CONFIG_ZONEFS_FS) += zonefs/
+obj-$(CONFIG_AUFS_FS) += aufs/
SPDX-License-Identifier: GPL-2.0
-aufs6.0 base patch
+aufs6.x-rcN base patch
diff --git a/MAINTAINERS b/MAINTAINERS
-index 72b9654f764c..53fc0e89d1ea 100644
+index 379945f82a64..b3b8fbca497b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -3425,6 +3425,19 @@ F: include/uapi/linux/audit.h
+@@ -3455,6 +3455,19 @@ F: include/uapi/linux/audit.h
F: kernel/audit*
F: lib/*audit.c
static ssize_t loop_attr_show(struct device *dev, char *page,
diff --git a/fs/dcache.c b/fs/dcache.c
-index bb0c4d0038db..d753ad7d77e6 100644
+index 52e6d5fdab6b..519321f32f95 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1345,7 +1345,7 @@ enum d_walk_ret {
unsigned int p_space;
int ret;
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 9eced4cc286e..9c5a33fce3a8 100644
+index e654435f1651..433a4f08dab4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1364,6 +1364,7 @@ extern void fasync_free(struct fasync_struct *);
extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
extern int f_setown(struct file *filp, unsigned long arg, int force);
extern void f_delown(struct file *filp);
-@@ -2115,6 +2116,7 @@ struct file_operations {
+@@ -2117,6 +2118,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);
+ unsigned int flags);
#endif
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
-index 64a13eb56078..c9f30e12aa32 100644
+index e3375bc40dad..c1f0aadde539 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -217,7 +217,7 @@ unsigned long max_lock_class_idx;
#ifdef CONFIG_LOCK_STAT
static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats);
SPDX-License-Identifier: GPL-2.0
-aufs6.0 mmap patch
+aufs6.x-rcN mmap patch
diff --git a/fs/proc/base.c b/fs/proc/base.c
-index 93f7e3d971e4..23aa1626020a 100644
+index 9e479d7d202b..986c2ae12f8b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2218,7 +2218,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path)
ino = inode->i_ino;
}
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
-index 4e0023643f8b..09394cf6e349 100644
+index 8a74cdcc9af0..c05071b53f5b 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
-@@ -281,7 +281,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
+@@ -284,7 +284,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
const char *name = NULL;
if (file) {
dev = inode->i_sb->s_dev;
ino = inode->i_ino;
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
-@@ -1912,7 +1915,7 @@ static int show_numa_map(struct seq_file *m, void *v)
+@@ -1934,7 +1937,7 @@ static int show_numa_map(struct seq_file *m, void *v)
struct proc_maps_private *proc_priv = &numa_priv->proc_maps;
struct vm_area_struct *vma = v;
struct numa_maps *md = &numa_priv->md;
struct mempolicy *pol;
char buffer[64];
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
-index a6d21fc0033c..02c2de31196e 100644
+index 2fd06f52b6a4..b01030da424f 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)
+@@ -150,7 +150,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
file = vma->vm_file;
if (file) {
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 21f8b27bd9fd..de9572fe212b 100644
+index 8bbcccbc5565..d5006a1f4271 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
-@@ -1858,6 +1858,43 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
+@@ -1933,6 +1933,43 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
unmap_mapping_range(mapping, holebegin, holelen, 0);
}
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 cf97f3884fda..a783130a669d 100644
+index 500e536796ca..ad766e2110ca 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
-@@ -372,6 +372,9 @@ struct vm_region {
+@@ -413,6 +413,9 @@ 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 */
int vm_usage; /* region usage count (access under nommu_region_sem) */
bool vm_icache_flushed : 1; /* true if the icache has been flushed for
-@@ -468,6 +471,9 @@ struct vm_area_struct {
+@@ -494,6 +497,9 @@ 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). */
#ifdef CONFIG_SWAP
diff --git a/kernel/fork.c b/kernel/fork.c
-index 2b6bd511c6ed..944adfb5189a 100644
+index 08969f5aa38d..61871700033a 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
-@@ -662,7 +662,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
+@@ -661,7 +661,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
if (file) {
struct address_space *mapping = file->f_mapping;
if (tmp->vm_flags & VM_SHARED)
mapping_allow_writable(mapping);
diff --git a/mm/Makefile b/mm/Makefile
-index 9a564f836403..86a4be7f34a8 100644
+index 8e105e5b3e29..c218d042dbce 100644
--- a/mm/Makefile
+++ b/mm/Makefile
-@@ -134,3 +134,4 @@ obj-$(CONFIG_IO_MAPPING) += io-mapping.o
+@@ -138,3 +138,4 @@ obj-$(CONFIG_IO_MAPPING) += io-mapping.o
obj-$(CONFIG_HAVE_BOOTMEM_INFO_NODE) += bootmem_info.o
obj-$(CONFIG_GENERIC_IOREMAP) += ioremap.o
obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o
+obj-$(CONFIG_AUFS_FS:m=y) += prfile.o
diff --git a/mm/filemap.c b/mm/filemap.c
-index 15800334147b..2c22abb4a14d 100644
+index 08341616ae7a..410ca60fbf39 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
-@@ -3403,7 +3403,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
+@@ -3418,7 +3418,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
vm_fault_t ret = VM_FAULT_LOCKED;
sb_start_pagefault(mapping->host->i_sb);
if (folio->mapping != mapping) {
folio_unlock(folio);
diff --git a/mm/mmap.c b/mm/mmap.c
-index 9d780f415be3..e744ba276454 100644
+index 2def55555e05..fefc5c67e96e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
-@@ -142,7 +142,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
+@@ -139,7 +139,7 @@ static void remove_vma(struct vm_area_struct *vma)
if (vma->vm_ops && vma->vm_ops->close)
vma->vm_ops->close(vma);
if (vma->vm_file)
+ vma_fput(vma);
mpol_put(vma_policy(vma));
vm_area_free(vma);
- return next;
-@@ -911,7 +911,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
+ }
+@@ -590,7 +590,7 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
if (remove_next) {
if (file) {
uprobe_munmap(next, next->vm_start, next->vm_end);
}
if (next->anon_vma)
anon_vma_merge(vma, next);
-@@ -1845,7 +1845,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
- if (vma->vm_ops && vma->vm_ops->close)
- vma->vm_ops->close(vma);
- unmap_and_free_vma:
-- fput(vma->vm_file);
-+ vma_fput(vma);
- vma->vm_file = NULL;
-
- /* Undo any partial mapping done by a device driver. */
-@@ -2705,7 +2705,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -831,7 +831,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,
+ again:
+ 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);
+@@ -2228,7 +2228,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);
-@@ -2724,7 +2724,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
+@@ -2250,7 +2250,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));
-@@ -2897,6 +2897,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2746,7 +2746,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
+ if (vma->vm_ops && vma->vm_ops->close)
+ vma->vm_ops->close(vma);
+ unmap_and_free_vma:
+- fput(vma->vm_file);
++ vma_fput(vma);
+ vma->vm_file = NULL;
+
+ /* Undo any partial mapping done by a device driver. */
+@@ -2813,6 +2813,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
unsigned long populate = 0;
unsigned long ret = -EINVAL;
struct file *file;
pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/mm/remap_file_pages.rst.\n",
current->comm, current->pid);
-@@ -2952,10 +2955,34 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2871,10 +2874,34 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
if (vma->vm_flags & VM_LOCKED)
flags |= MAP_LOCKED;
out:
mmap_write_unlock(mm);
if (populate)
-@@ -3229,7 +3256,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+@@ -3227,7 +3254,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)
+ 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);
+ if (vma_link(mm, new_vma))
diff --git a/mm/nommu.c b/mm/nommu.c
-index e819cbc21b39..dc7d40fb197f 100644
+index 214c70e1d059..dccbb939d2a9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
-@@ -524,7 +524,7 @@ static void __put_nommu_region(struct vm_region *region)
+@@ -523,7 +523,7 @@ static void __put_nommu_region(struct vm_region *region)
up_write(&nommu_region_sem);
if (region->vm_file)
/* IO memory and memory shared directly out of the pagecache
* from ramfs/tmpfs mustn't be released here */
-@@ -656,7 +656,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma)
+@@ -653,7 +653,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)
put_nommu_region(vma->vm_region);
vm_area_free(vma);
}
-@@ -1176,7 +1176,7 @@ unsigned long do_mmap(struct file *file,
+@@ -1164,7 +1164,7 @@ unsigned long do_mmap(struct file *file,
goto error_just_free;
}
}
kmem_cache_free(vm_region_jar, region);
region = pregion;
result = start;
-@@ -1253,10 +1253,10 @@ unsigned long do_mmap(struct file *file,
- up_write(&nommu_region_sem);
+@@ -1241,10 +1241,10 @@ unsigned long do_mmap(struct file *file,
error:
+ mas_destroy(&mas);
if (region->vm_file)
- fput(region->vm_file);
+ vmr_fput(region);
+}
+#endif /* !CONFIG_MMU */
SPDX-License-Identifier: GPL-2.0
-aufs6.0 standalone patch
+aufs6.x-rcN standalone patch
diff --git a/fs/dcache.c b/fs/dcache.c
-index d753ad7d77e6..1a3b40ebc12b 100644
+index 519321f32f95..267e0c65914a 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1450,6 +1450,7 @@ void d_walk(struct dentry *parent, void *data,
struct check_mount {
struct vfsmount *mnt;
-@@ -3061,6 +3062,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2)
+@@ -3052,6 +3053,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 d046dbb9cbd0..5b9023e75de0 100644
+index a0b1f0337a62..2038fdb508c9 100644
--- a/fs/exec.c
+++ b/fs/exec.c
-@@ -111,6 +111,7 @@ bool path_noexec(const struct path *path)
+@@ -110,6 +110,7 @@ bool path_noexec(const struct path *path)
return (path->mnt->mnt_flags & MNT_NOEXEC) ||
(path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC);
}
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 99c6796c9f28..ad533dcedfec 100644
+index dd88701e54a9..ecdb7817b074 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -198,6 +198,7 @@ struct file *alloc_empty_file(int flags, const struct cred *cred)
/*
* Drop a reference to a group. Free it if it's through.
diff --git a/fs/open.c b/fs/open.c
-index cf7e5c350a54..c99195ee46ba 100644
+index a81319b6177f..50bb15ea3fb5 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -66,6 +66,7 @@ int do_truncate(struct user_namespace *mnt_userns, struct dentry *dentry,
/**
* splice_direct_to_actor - splices data directly between two non-pipes
diff --git a/fs/xattr.c b/fs/xattr.c
-index a1f4998bc6be..284d4ca54893 100644
+index 61107b6bbed2..243855024966 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
-@@ -396,6 +396,7 @@ vfs_getxattr_alloc(struct user_namespace *mnt_userns, struct dentry *dentry,
+@@ -392,6 +392,7 @@ vfs_getxattr_alloc(struct user_namespace *mnt_userns, struct dentry *dentry,
*xattr_value = value;
return error;
}
ssize_t
__vfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name,
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
-index c9f30e12aa32..d04fedf1e4d9 100644
+index c1f0aadde539..278e0a322d20 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -238,6 +238,7 @@ inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock)
#ifdef CONFIG_LOCK_STAT
diff --git a/kernel/task_work.c b/kernel/task_work.c
-index dff75bcde151..30b814618535 100644
+index 065e1ef8fc8d..c623c6f0c645 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
-@@ -180,3 +180,4 @@ void task_work_run(void)
+@@ -182,3 +182,4 @@ void task_work_run(void)
} while (work);
}
}
+EXPORT_SYMBOL_GPL(task_work_run);
diff --git a/security/security.c b/security/security.c
-index 4b95de24bc8d..139e1443c49b 100644
+index 79d82cb6e469..1c50e6faadcd 100644
--- a/security/security.c
+++ b/security/security.c
-@@ -1165,6 +1165,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
+@@ -1167,6 +1167,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)
{
-@@ -1181,6 +1182,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry,
+@@ -1183,6 +1184,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)
-@@ -1189,6 +1191,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
+@@ -1191,6 +1193,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,
-@@ -1209,6 +1212,7 @@ int security_path_truncate(const struct path *path)
+@@ -1211,6 +1214,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)
{
-@@ -1216,6 +1220,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
+@@ -1218,6 +1222,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)
{
-@@ -1223,6 +1228,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
+@@ -1225,6 +1230,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)
{
-@@ -1323,6 +1329,7 @@ int security_inode_permission(struct inode *inode, int mask)
+@@ -1325,6 +1331,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 user_namespace *mnt_userns,
struct dentry *dentry, struct iattr *attr)
-@@ -1521,6 +1528,7 @@ int security_file_permission(struct file *file, int mask)
+@@ -1523,6 +1530,7 @@ int security_file_permission(struct file *file, int mask)
return fsnotify_perm(file, mask);
}
+};
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 2022-11-05 23:02:18.962555950 +0100
-@@ -0,0 +1,269 @@
++++ linux/fs/aufs/dentry.h 2022-12-17 09:21:34.796521861 +0100
+@@ -0,0 +1,270 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ aufs_bindex_t di_btop, di_bbot, di_bwh, di_bdiropq;
+ unsigned char di_tmpfile; /* to allow the different name */
+ struct au_hdentry *di_hdentry;
++ struct file *di_htmpfile;
+ struct rcu_head rcu;
+} ____cacheline_aligned_in_smp;
+
+#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 2022-11-05 23:02:18.962555950 +0100
-@@ -0,0 +1,554 @@
++++ linux/fs/aufs/dinfo.c 2022-12-17 09:21:34.796521861 +0100
+@@ -0,0 +1,555 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ dinfo->di_tmpfile = 0;
+ for (i = 0; i < nbr; i++)
+ dinfo->di_hdentry[i].hd_id = -1;
++ dinfo->di_htmpfile = NULL;
+ goto out;
+ }
+
+}
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 2022-11-05 23:02:18.962555950 +0100
++++ linux/fs/aufs/dir.c 2022-12-17 09:21:34.796521861 +0100
@@ -0,0 +1,765 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ aufs_bindex_t bindex;
+};
+
-+static int test_empty_cb(struct dir_context *ctx, const char *__name,
-+ int namelen, loff_t offset __maybe_unused, u64 ino,
-+ unsigned int d_type)
++static bool test_empty_cb(struct dir_context *ctx, const char *__name,
++ int namelen, loff_t offset __maybe_unused, u64 ino,
++ unsigned int d_type)
+{
+ struct test_empty_arg *arg = container_of(ctx, struct test_empty_arg,
+ ctx);
+out:
+ /* smp_mb(); */
+ AuTraceErr(arg->err);
-+ return arg->err;
++ return !arg->err;
+}
+
+static int do_test_empty(struct dentry *dentry, struct test_empty_arg *arg)
+#endif /* __AUFS_DYNOP_H__ */
diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c
--- /usr/share/empty/fs/aufs/export.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/export.c 2022-11-05 23:02:18.962555950 +0100
++++ linux/fs/aufs/export.c 2022-12-17 09:21:34.796521861 +0100
@@ -0,0 +1,830 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ int namelen;
+};
+
-+static int
++static bool
+find_name_by_ino(struct dir_context *ctx, const char *name, int namelen,
+ loff_t offset, u64 ino, unsigned int d_type)
+{
+
+ a->called++;
+ if (a->ino != ino)
-+ return 0;
++ return true;
+
+ memcpy(a->name, name, namelen);
+ a->namelen = namelen;
+ a->found = 1;
-+ return 1;
++ return false;
+}
+
+static struct dentry *au_lkup_by_ino(struct path *path, ino_t ino,
+}
diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c
--- /usr/share/empty/fs/aufs/file.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/file.c 2022-11-05 23:02:18.965889284 +0100
-@@ -0,0 +1,858 @@
++++ linux/fs/aufs/file.c 2022-12-17 09:21:34.799855195 +0100
+@@ -0,0 +1,860 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ AuDebugOn(IS_ERR_OR_NULL(dentry));
+ di_write_lock_child(dentry);
+ err = au_cmoo(dentry);
-+ di_downgrade_lock(dentry, AuLock_IR);
+ if (!err) {
-+ if (!aopen)
-+ err = args->open(file, vfsub_file_flags(file), NULL);
-+ else {
++ if (!aopen) {
++ err = args->open(file, vfsub_file_flags(file),
++ au_di(dentry)->di_htmpfile);
++ di_write_unlock(dentry);
++ } else {
++ di_downgrade_lock(dentry, AuLock_IR);
+ lockdep_off();
+ err = args->open(file, vfsub_file_flags(file),
+ args->h_file);
+ lockdep_on();
++ di_read_unlock(dentry, AuLock_IR);
+ }
+ }
-+ di_read_unlock(dentry, AuLock_IR);
+
+ finfo = au_fi(file);
+ if (!err) {
+}
diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c
--- /usr/share/empty/fs/aufs/f_op.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/f_op.c 2022-11-05 23:02:18.962555950 +0100
-@@ -0,0 +1,771 @@
++++ linux/fs/aufs/f_op.c 2022-12-17 09:21:34.799855195 +0100
+@@ -0,0 +1,776 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ /* br ref is already inc-ed */
+ }
+
-+ if ((flags & __O_TMPFILE)
-+ && !(flags & O_EXCL)) {
-+ h_inode = file_inode(h_file);
-+ spin_lock(&h_inode->i_lock);
-+ h_inode->i_state |= I_LINKABLE;
-+ spin_unlock(&h_inode->i_lock);
++ if (flags & __O_TMPFILE) {
++ AuDebugOn(!h_file);
++ AuDebugOn(h_file != au_di(dentry)->di_htmpfile);
++ au_di(dentry)->di_htmpfile = NULL;
++
++ if (!(flags & O_EXCL)) {
++ h_inode = file_inode(h_file);
++ spin_lock(&h_inode->i_lock);
++ h_inode->i_state |= I_LINKABLE;
++ spin_unlock(&h_inode->i_lock);
++ }
+ }
+ au_set_fbtop(file, bindex);
+ au_set_h_fptr(file, bindex, h_file);
+}
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 2022-11-05 23:02:18.965889284 +0100
++++ linux/fs/aufs/inode.h 2022-12-17 09:21:34.799855195 +0100
@@ -0,0 +1,705 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+int au_aopen_or_create(struct inode *dir, struct dentry *dentry,
+ struct vfsub_aopen_args *args);
+int aufs_tmpfile(struct user_namespace *userns, struct inode *dir,
-+ struct dentry *dentry, umode_t mode);
++ struct file *file, umode_t mode);
+int aufs_link(struct dentry *src_dentry, struct inode *dir,
+ struct dentry *dentry);
+int aufs_mkdir(struct user_namespace *userns, struct inode *dir,
+ union {
+ struct {
+ const char *name;
-+ void *value;
++ const void *value;
+ size_t size;
+ int flags;
+ } set;
+#endif
diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c
--- /usr/share/empty/fs/aufs/i_op_add.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_add.c 2022-11-05 23:02:18.965889284 +0100
-@@ -0,0 +1,941 @@
++++ linux/fs/aufs/i_op_add.c 2022-12-17 09:21:34.799855195 +0100
+@@ -0,0 +1,972 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+}
+
+int aufs_tmpfile(struct user_namespace *userns, struct inode *dir,
-+ struct dentry *dentry, umode_t mode)
++ struct file *file, umode_t mode)
+{
+ int err;
+ aufs_bindex_t bindex;
++ struct path h_ppath;
+ struct super_block *sb;
-+ struct dentry *parent, *h_parent, *h_dentry;
++ struct au_branch *br;
++ struct dentry *dentry, *parent, *h_parent, *h_dentry;
+ struct inode *h_dir, *inode;
+ struct vfsmount *h_mnt;
+ struct user_namespace *h_userns;
++ struct file *h_file;
+ struct au_wr_dir_args wr_dir_args = {
+ .force_btgt = -1,
+ .flags = AuWrDir_TMPFILE
+ /* copy-up may happen */
+ inode_lock(dir);
+
++ h_file = NULL;
+ sb = dir->i_sb;
+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM);
+ if (unlikely(err))
+ goto out;
+
++ dentry = file->f_path.dentry;
+ err = au_di_init(dentry);
+ if (unlikely(err))
+ goto out_si;
+ if (unlikely(!h_dir->i_op->tmpfile))
+ goto out_parent;
+
-+ h_mnt = au_sbr_mnt(sb, bindex);
++ br = au_sbr(sb, bindex);
++ h_mnt = au_br_mnt(br);
+ err = vfsub_mnt_want_write(h_mnt);
+ if (unlikely(err))
+ goto out_parent;
+
+ h_userns = mnt_user_ns(h_mnt);
+ h_parent = au_h_dptr(parent, bindex);
-+ h_dentry = vfs_tmpfile(h_userns, h_parent, mode, /*open_flag*/0);
-+ if (IS_ERR(h_dentry)) {
-+ err = PTR_ERR(h_dentry);
++ h_ppath.mnt = h_mnt;
++ h_ppath.dentry = h_parent;
++ h_file = vfs_tmpfile_open(h_userns, &h_ppath, mode, /*open_flag*/0,
++ /*cred*/NULL);
++ if (IS_ERR(h_file)) {
++ err = PTR_ERR(h_file);
++ h_file = NULL;
+ goto out_mnt;
+ }
+
++ h_dentry = h_file->f_path.dentry;
+ au_set_dbtop(dentry, bindex);
+ au_set_dbbot(dentry, bindex);
+ au_set_h_dptr(dentry, bindex, dget(h_dentry));
+ au_set_h_dptr(dentry, bindex, NULL);
+ au_set_dbtop(dentry, -1);
+ au_set_dbbot(dentry, -1);
-+ } else {
-+ if (!inode->i_nlink)
-+ set_nlink(inode, 1);
-+ d_tmpfile(dentry, inode);
-+ au_di(dentry)->di_tmpfile = 1;
-+
-+ /* update without i_mutex */
-+ if (au_ibtop(dir) == au_dbtop(dentry))
-+ au_cpup_attr_timesizes(dir);
++ goto out_h_file;
+ }
-+ dput(h_dentry);
+
++ if (!inode->i_nlink)
++ set_nlink(inode, 1);
++ d_tmpfile(file, inode);
++ au_di(dentry)->di_tmpfile = 1;
++ get_file(h_file);
++ au_di(dentry)->di_htmpfile = h_file;
++
++ /* update without i_mutex */
++ if (au_ibtop(dir) == au_dbtop(dentry))
++ au_cpup_attr_timesizes(dir);
++
++out_h_file:
++ fput(h_file);
+out_mnt:
+ vfsub_mnt_drop_write(h_mnt);
+out_parent:
+ di_write_unlock(parent);
+ dput(parent);
+ di_write_unlock(dentry);
-+ if (unlikely(err)) {
-+ au_di_fin(dentry);
-+ dentry->d_fsdata = NULL;
-+ }
++ if (!err)
++ goto out_si;
++ if (h_file)
++ fput(h_file);
++ au_di(dentry)->di_htmpfile = NULL;
++ au_di_fin(dentry);
++ dentry->d_fsdata = NULL;
+out_si:
+ si_read_unlock(sb);
++ if (!err && h_file) {
++ /* finally... */
++ err = finish_open_simple(file, err);
++ if (!err)
++ au_lcnt_inc(&br->br_nfiles);
++ else {
++ fput(h_file);
++ au_di(dentry)->di_htmpfile = NULL;
++ au_di_fin(dentry);
++ dentry->d_fsdata = NULL;
++ }
++ }
+out:
+ inode_unlock(dir);
++ AuTraceErr(err);
+ return err;
+}
+
+}
diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
--- /usr/share/empty/fs/aufs/rdu.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rdu.c 2022-11-05 23:02:18.969222617 +0100
++++ linux/fs/aufs/rdu.c 2022-12-17 09:21:34.799855195 +0100
@@ -0,0 +1,384 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ int err;
+};
+
-+static int au_rdu_fill(struct dir_context *ctx, const char *name, int nlen,
-+ loff_t offset, u64 h_ino, unsigned int d_type)
++static bool au_rdu_fill(struct dir_context *ctx, const char *name, int nlen,
++ loff_t offset, u64 h_ino, unsigned int d_type)
+{
+ int err, len;
+ struct au_rdu_arg *arg = container_of(ctx, struct au_rdu_arg, ctx);
+
+out:
+ /* AuTraceErr(err); */
-+ return err;
++ return !err;
+}
+
+static int au_rdu_do(struct file *h_file, struct au_rdu_arg *arg)
+}
diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c
--- /usr/share/empty/fs/aufs/vdir.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vdir.c 2022-11-05 23:02:18.969222617 +0100
++++ linux/fs/aufs/vdir.c 2022-12-17 09:21:34.799855195 +0100
@@ -0,0 +1,896 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ int err;
+};
+
-+static int fillvdir(struct dir_context *ctx, const char *__name, int nlen,
++static bool fillvdir(struct dir_context *ctx, const char *__name, int nlen,
+ loff_t offset __maybe_unused, u64 h_ino,
+ unsigned int d_type)
+{
+ arg->vdir->vd_jiffy = jiffies;
+ /* smp_mb(); */
+ AuTraceErr(arg->err);
-+ return arg->err;
++ return !arg->err;
+}
+
+static int au_handle_shwh(struct super_block *sb, struct au_vdir *vdir,
+}
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 2022-11-05 23:02:18.969222617 +0100
-@@ -0,0 +1,362 @@
++++ linux/fs/aufs/vfsub.h 2022-12-17 09:21:34.799855195 +0100
+@@ -0,0 +1,358 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+
+/* ---------------------------------------------------------------------- */
+
-+/*
-+ * The parameter 'value' is not const since the id in ACL_USER/ACL_GROUP may be
-+ * changed by idmapping.
-+ */
+static inline int vfsub_setxattr(struct user_namespace *userns,
+ struct dentry *dentry, const char *name,
-+ void *value, size_t size, int flags)
++ const void *value, size_t size, int flags)
+{
+ int err;
+
+#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 2022-11-05 23:02:18.972555950 +0100
-@@ -0,0 +1,372 @@
++++ linux/fs/aufs/xattr.c 2022-12-17 09:21:34.799855195 +0100
+@@ -0,0 +1,368 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2014-2022 Junjiro R. Okajima
+}
+
+static int au_setxattr(struct dentry *dentry, struct inode *inode,
-+ const char *name, void *value, size_t size,
++ const char *name, const void *value, size_t size,
+ int flags)
+{
+ struct au_sxattr arg = {
+ return au_getxattr(dentry, inode, name, buffer, size);
+}
+
-+/*
-+ * The prameter 'void *value' of vfs_setxattr() is NOT const, but
-+ * xattr_handler->set() requires const. Is it OK? I don't know.
-+ */
+static int au_xattr_set(const struct xattr_handler *handler,
+ struct user_namespace *userns,
+ struct dentry *dentry, struct inode *inode,
+ const char *name, const void *value, size_t size,
+ int flags)
+{
-+ return au_setxattr(dentry, inode, name, (void *)value, size, flags);
++ return au_setxattr(dentry, inode, name, value, size, flags);
+}
+
+static const struct xattr_handler au_xattr_handler = {
+}
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 2022-11-05 23:02:18.972555950 +0100
++++ linux/include/uapi/linux/aufs_type.h 2022-12-17 09:21:34.803188528 +0100
@@ -0,0 +1,452 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+#include <limits.h>
+#endif /* __KERNEL__ */
+
-+#define AUFS_VERSION "6.0-20221031"
++#define AUFS_VERSION "6.x-rcN-20221107"
+
+/* todo? move this to linux-2.6.19/include/magic.h */
+#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's')
+
+#endif /* __AUFS_TYPE_H__ */
SPDX-License-Identifier: GPL-2.0
-aufs6.0 loopback patch
+aufs6.x-rcN loopback patch
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 8ca56da3ca69..9ac6f67edf09 100644
struct address_space *mapping;
int error;
@@ -1031,6 +1055,13 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
- /* suppress uevents while reconfiguring the device */
- dev_set_uevent_suppress(disk_to_dev(lo->lo_disk), 1);
+ /* This is safe, since we have a reference from open(). */
+ __module_get(THIS_MODULE);
+ f = loop_real_file(file);
+ if (f) {
+ fput(virt_file);
/* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
- goto done;
+ return error;
@@ -1154,6 +1188,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
static void __loop_clr_fd(struct loop_device *lo, bool release)
{
static int loop_clr_fd(struct loop_device *lo)
diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c
-index 5c5641222d67..79504ea71dad 100644
+index 66ddf86a3331..6cbef597d5b9 100644
--- a/fs/aufs/f_op.c
+++ b/fs/aufs/f_op.c
-@@ -304,7 +304,7 @@ static ssize_t aufs_read_iter(struct kiocb *kio, struct iov_iter *iov_iter)
+@@ -309,7 +309,7 @@ static ssize_t aufs_read_iter(struct kiocb *kio, struct iov_iter *iov_iter)
if (IS_ERR(h_file))
goto out;
/* ---------------------------------------------------------------------- */
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 9c5a33fce3a8..a3c40bc66852 100644
+index 433a4f08dab4..0b17b7e5ee11 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -2253,6 +2253,10 @@ struct super_operations {
+@@ -2257,6 +2257,10 @@ struct super_operations {
struct shrink_control *);
long (*free_cached_objects)(struct super_block *,
struct shrink_control *);