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 cc07a0cd3172..5ee4f1be48ff 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
-@@ -318,6 +318,7 @@ source "fs/sysv/Kconfig"
+@@ -316,6 +316,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 834f1c3dba46..b5c97dd026cd 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 7e0b87d5aa2e..ce2984ca2f06 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -3425,6 +3425,19 @@ F: include/uapi/linux/audit.h
+@@ -3387,6 +3387,19 @@ F: include/uapi/linux/audit.h
F: kernel/audit*
F: lib/*audit.c
M: Miguel Ojeda <ojeda@kernel.org>
S: Maintained
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index ad92192c7d61..8ca56da3ca69 100644
+index bc31bb7072a2..131294601819 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -645,6 +645,24 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
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 {
{
struct dentry *this_parent;
diff --git a/fs/fcntl.c b/fs/fcntl.c
-index 146c9ab0cd4b..c980a0524118 100644
+index b622be119706..9ea58b7bb580 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
-@@ -33,7 +33,7 @@
+@@ -34,7 +34,7 @@
#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
{
struct inode * inode = file_inode(filp);
int error = 0;
-@@ -63,6 +63,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
+@@ -64,6 +64,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);
return error;
diff --git a/fs/namespace.c b/fs/namespace.c
-index df137ba19d37..faae7f8644ac 100644
+index 54847db5b819..ebb7b4b057ea 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
-@@ -852,6 +852,12 @@ static inline int check_mnt(struct mount *mnt)
+@@ -849,6 +849,12 @@ static inline int check_mnt(struct mount *mnt)
return mnt->mnt_ns == current->nsproxy->mnt_ns;
}
* vfsmount lock must be held for write
*/
diff --git a/fs/splice.c b/fs/splice.c
-index 0878b852b355..d83f9e5cddbc 100644
+index 3e06611d19ae..97a66df75d4c 100644
--- a/fs/splice.c
+++ b/fs/splice.c
-@@ -756,8 +756,8 @@ static int warn_unsupported(struct file *file, const char *op)
+@@ -865,8 +865,8 @@ static int warn_unsupported(struct file *file, const char *op)
/*
* Attempt to initiate a splice from pipe to file.
*/
{
if (unlikely(!out->f_op->splice_write))
return warn_unsupported(out, "write");
-@@ -767,9 +767,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -876,9 +876,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.
*/
unsigned int p_space;
int ret;
diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 9eced4cc286e..9c5a33fce3a8 100644
+index 21a981680856..1e3054e5367d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -1364,6 +1364,7 @@ extern void fasync_free(struct fasync_struct *);
+@@ -1066,6 +1066,7 @@ extern void fasync_free(struct fasync_struct *);
/* can be called from interrupts */
extern void kill_fasync(struct fasync_struct **, int, int);
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 {
+@@ -1793,6 +1794,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);
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);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
-index 1f1099dac3f0..81d10b8e9dc0 100644
+index b32256e9e944..16bd7230f44b 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
-@@ -248,6 +248,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock,
+@@ -249,6 +249,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock,
return lock->key == key;
}
+ unsigned int flags);
#endif
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
-index 64a13eb56078..c9f30e12aa32 100644
+index dcd1d5bfc1e0..85d1f7e0bc07 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
-@@ -217,7 +217,7 @@ unsigned long max_lock_class_idx;
+@@ -218,7 +218,7 @@ unsigned long max_lock_class_idx;
struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
DECLARE_BITMAP(lock_classes_in_use, MAX_LOCKDEP_KEYS);
{
unsigned int class_idx = hlock->class_idx;
-@@ -238,6 +238,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
+@@ -239,6 +239,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
*/
return lock_classes + 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 05452c3b9872..6b92a8430130 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 420510f6a545..edfc0941806a 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)
+@@ -285,7 +285,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)
+@@ -1943,7 +1946,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 0ec35072a8e5..f0f0a03eb2b5 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 27ce77080c79..5f07b972242d 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,
+@@ -2353,6 +2353,43 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
unmap_mapping_range(mapping, holebegin, holelen, 0);
}
-+#if IS_ENABLED(CONFIG_AUFS_FS)
++#if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
+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);
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 306a3d1a0fa6..56374f0eb825 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
-@@ -372,6 +372,9 @@ struct vm_region {
+@@ -449,6 +449,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 */
-+#if IS_ENABLED(CONFIG_AUFS_FS)
++#if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
+ struct file *vm_prfile; /* the virtual backing file or NULL */
+#endif
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 {
+@@ -548,6 +551,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). */
-+#if IS_ENABLED(CONFIG_AUFS_FS)
++#if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
+ struct file *vm_prfile; /* shadow of vm_file */
+#endif
void * vm_private_data; /* was vm_pte (shared mem) */
- #ifdef CONFIG_SWAP
+ #ifdef CONFIG_ANON_VMA_NAME
diff --git a/kernel/fork.c b/kernel/fork.c
-index 2b6bd511c6ed..944adfb5189a 100644
+index ed4e01daccaa..e945a1639283 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
-@@ -662,7 +662,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
+@@ -733,7 +733,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 e29afc890cde..c467601299d4 100644
--- a/mm/Makefile
+++ b/mm/Makefile
-@@ -134,3 +134,4 @@ obj-$(CONFIG_IO_MAPPING) += io-mapping.o
+@@ -137,3 +137,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
++obj-y += prfile.o
diff --git a/mm/filemap.c b/mm/filemap.c
-index 15800334147b..2c22abb4a14d 100644
+index b4c9bd368b7e..ec4f4e5c1a92 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
-@@ -3403,7 +3403,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
+@@ -3564,7 +3564,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 13678edaa22c..4de00f38822c 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)
+@@ -140,7 +140,7 @@ static void remove_vma(struct vm_area_struct *vma, bool unreachable)
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));
- vm_area_free(vma);
- return next;
-@@ -911,7 +911,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);
-@@ -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,
+ if (unreachable)
+ __vm_area_free(vma);
+@@ -2269,7 +2269,7 @@ int __split_vma(struct vma_iterator *vmi, 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,
- 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));
-@@ -2897,6 +2897,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
+@@ -2774,7 +2774,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
+
+ if (file || vma->vm_file) {
+ unmap_and_free_vma:
+- fput(vma->vm_file);
++ vma_fput(vma);
+ vma->vm_file = NULL;
+
+ /* Undo any partial mapping done by a device driver. */
+@@ -2843,6 +2843,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
unsigned long populate = 0;
unsigned long ret = -EINVAL;
struct file *file;
-+#if IS_ENABLED(CONFIG_AUFS_FS)
++#if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
+ struct file *prfile;
+#endif
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,
+@@ -2901,10 +2904,34 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
if (vma->vm_flags & VM_LOCKED)
flags |= MAP_LOCKED;
-+#if IS_ENABLED(CONFIG_AUFS_FS)
++#if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
+ vma_get_file(vma);
+ file = vma->vm_file;
+ prfile = vma->vm_prfile;
out:
mmap_write_unlock(mm);
if (populate)
-@@ -3229,7 +3256,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+@@ -3250,7 +3277,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);
+ vma_start_write(new_vma);
+@@ -3266,7 +3293,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+ new_vma->vm_ops->close(new_vma);
+
+ if (new_vma->vm_file)
+- fput(new_vma->vm_file);
++ vma_fput(new_vma);
+
+ unlink_anon_vmas(new_vma);
+ out_free_mempol:
diff --git a/mm/nommu.c b/mm/nommu.c
-index e819cbc21b39..dc7d40fb197f 100644
+index f670d9979a26..94d41bc45915 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)
+@@ -602,7 +602,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,
+@@ -1124,7 +1124,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);
+@@ -1206,10 +1206,10 @@ unsigned long do_mmap(struct file *file,
error:
+ vma_iter_free(&vmi);
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 a466e797c8e2..c60353b5214f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
-@@ -111,6 +111,7 @@ bool path_noexec(const struct path *path)
+@@ -112,6 +112,7 @@ bool path_noexec(const struct path *path)
return (path->mnt->mnt_flags & MNT_NOEXEC) ||
(path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC);
}
#ifdef CONFIG_USELIB
/*
diff --git a/fs/fcntl.c b/fs/fcntl.c
-index c980a0524118..40087d11a974 100644
+index 9ea58b7bb580..99fef189bcd6 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
-@@ -86,6 +86,7 @@ int setfl(int fd, struct file *filp, unsigned long arg)
+@@ -87,6 +87,7 @@ int setfl(int fd, struct file *filp, unsigned long arg)
out:
return error;
}
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 372653b92617..69128fe39b6d 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)
+@@ -199,6 +199,7 @@ struct file *alloc_empty_file(int flags, const struct cred *cred)
}
return ERR_PTR(-ENFILE);
}
/*
* Variant of alloc_empty_file() that doesn't check and modify nr_files.
diff --git a/fs/namespace.c b/fs/namespace.c
-index faae7f8644ac..0310c99a83dd 100644
+index ebb7b4b057ea..6ee47677de2f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
-@@ -456,6 +456,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
+@@ -457,6 +457,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
-@@ -857,6 +858,7 @@ int is_current_mnt_ns(struct vfsmount *mnt)
+@@ -854,6 +855,7 @@ int is_current_mnt_ns(struct vfsmount *mnt)
{
return check_mnt(real_mount(mnt));
}
/*
* vfsmount lock must be held for write
-@@ -2060,6 +2062,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+@@ -2062,6 +2064,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
}
return 0;
}
/*
* 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 4478adcc4f3a..5a984ff90580 100644
--- a/fs/open.c
+++ b/fs/open.c
-@@ -66,6 +66,7 @@ int do_truncate(struct user_namespace *mnt_userns, struct dentry *dentry,
+@@ -67,6 +67,7 @@ int do_truncate(struct mnt_idmap *idmap, struct dentry *dentry,
inode_unlock(dentry->d_inode);
return ret;
}
long vfs_truncate(const struct path *path, loff_t length)
{
diff --git a/fs/read_write.c b/fs/read_write.c
-index 328ce8cf9a85..59931848f794 100644
+index a21ba3be7dbe..ec40061176b3 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -477,6 +477,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
/* file_ppos returns &file->f_pos or NULL if file is stream */
static inline loff_t *file_ppos(struct file *file)
diff --git a/fs/splice.c b/fs/splice.c
-index d83f9e5cddbc..ac355ebeb9f0 100644
+index 97a66df75d4c..19c8d35f5ebd 100644
--- a/fs/splice.c
+++ b/fs/splice.c
-@@ -763,6 +763,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+@@ -872,6 +872,7 @@ long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
return warn_unsupported(out, "write");
return out->f_op->splice_write(pipe, out, ppos, len, flags);
}
/*
* Attempt to initiate a splice from a file to a pipe.
-@@ -792,6 +793,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
+@@ -901,6 +902,7 @@ long do_splice_to(struct file *in, loff_t *ppos,
return warn_unsupported(in, "read");
return in->f_op->splice_read(in, ppos, pipe, len, flags);
}
/**
* 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 fcf67d80d7f9..174dfb9285fb 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
-@@ -396,6 +396,7 @@ vfs_getxattr_alloc(struct user_namespace *mnt_userns, struct dentry *dentry,
+@@ -406,6 +406,7 @@ vfs_getxattr_alloc(struct mnt_idmap *idmap, 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 85d1f7e0bc07..5e20504eed24 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)
+@@ -239,6 +239,7 @@ inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock)
*/
return lock_classes + class_idx;
}
#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 d5ff7ff45b77..5cca1f5774ef 100644
--- a/security/security.c
+++ b/security/security.c
-@@ -1165,6 +1165,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry)
+@@ -1711,6 +1711,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)
- {
-@@ -1181,6 +1182,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry,
+ /**
+ * security_path_unlink() - Check if removing a hard link is allowed
+@@ -1746,6 +1747,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)
-@@ -1189,6 +1191,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir,
+ /**
+ * security_path_link - Check if creating a hard link is allowed
+@@ -1764,6 +1766,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,
-@@ -1209,6 +1212,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)
- {
-@@ -1216,6 +1220,7 @@ int security_path_chmod(const struct path *path, umode_t mode)
+ /**
+ * security_path_rename() - Check if renaming a file is allowed
+@@ -1825,6 +1828,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)
- {
-@@ -1223,6 +1228,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid)
+ /**
+ * security_path_chown() - Check if changing the file's owner/group is allowed
+@@ -1842,6 +1846,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)
- {
-@@ -1323,6 +1329,7 @@ int security_inode_permission(struct inode *inode, int mask)
+ /**
+ * security_path_chroot() - Check if changing the root directory is allowed
+@@ -2071,6 +2076,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 user_namespace *mnt_userns,
- struct dentry *dentry, struct iattr *attr)
-@@ -1521,6 +1528,7 @@ int security_file_permission(struct file *file, int mask)
+ /**
+ * security_inode_setattr() - Check if setting file attributes is allowed
+@@ -2549,6 +2555,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)
+ /**
+ * security_file_alloc() - Allocate and init a file's LSM blob
+@@ -2815,6 +2822,7 @@ int security_file_truncate(struct file *file)
{
+ return call_int_hook(file_truncate, 0, file);
+ }
++EXPORT_SYMBOL_GPL(security_file_truncate);
+
+ /**
+ * security_task_alloc() - Allocate a task's LSM blob
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 2022-11-05 23:02:18.955889283 +0100
+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 2022-11-05 23:02:18.955889283 +0100
-@@ -0,0 +1,403 @@
++++ linux/Documentation/filesystems/aufs/README 2023-07-04 23:43:55.846316200 +0200
+@@ -0,0 +1,408 @@
+
+Aufs6 -- advanced multi layered unification filesystem version 6.x
+http://aufs.sf.net
+
+2. Download
+----------------------------------------
-+There are three GIT trees for aufs6, aufs6-linux.git,
-+aufs6-standalone.git, and aufs-util.git. Note that there is no "6" in
-+"aufs-util.git."
-+While the aufs-util is always necessary, you need either of aufs6-linux
-+or aufs6-standalone.
++There are three GIT trees for aufs6, aufs-linux.git,
++aufs-standalone.git, and aufs-util.git.
++While the aufs-util is always necessary, you need either of aufs-linux
++or aufs-standalone.
+
-+The aufs6-linux tree includes the whole linux mainline GIT tree,
++The aufs-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 aufs6 as an external kernel module.
+Several extra patches are not included in this tree. Only
-+aufs6-standalone tree contains them. They are described in the later
++aufs-standalone tree contains them. They are described in the later
+section "Configuration and Compilation."
+
-+On the other hand, the aufs6-standalone tree has only aufs source files
++On the other hand, the aufs-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.
+
+"aufs6.0" is for linux-6.0. For latest "linux-6.x-rcN", use
+"aufs6.x-rcN" branch.
+
-+o aufs6-linux tree
++o aufs-linux tree
+$ git clone --reference /your/linux/git/tree \
-+ git://github.com/sfjro/aufs6-linux.git aufs6-linux.git
++ git://github.com/sfjro/aufs-linux.git aufs-linux.git
+- if you don't have linux GIT tree, then remove "--reference ..."
-+$ cd aufs6-linux.git
++$ cd aufs-linux.git
+$ git checkout origin/aufs6.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 aufs6 git://github.com/sfjro/aufs6-linux.git
-+$ git fetch aufs6
++$ git remote add aufs git://github.com/sfjro/aufs-linux.git
++$ git fetch aufs
+$ git checkout -b my6.0 v6.0
+$ (add your local change...)
-+$ git pull aufs6 aufs6.0
++$ git pull aufs aufs6.0
+- now you have v6.0 + your_changes + aufs6.0 in you my6.0 branch.
+- you may need to solve some conflicts between your_changes and
+ aufs6.0. in this case, git-rerere is recommended so that you can
+ solve the similar conflicts automatically when you upgrade to 6.1 or
+ later in the future.
+
-+o aufs6-standalone tree
-+$ git clone git://github.com/sfjro/aufs6-standalone.git aufs6-standalone.git
-+$ cd aufs6-standalone.git
++o aufs-standalone tree
++$ git clone git://github.com/sfjro/aufs-standalone.git aufs-standalone.git
++$ cd aufs-standalone.git
+$ git checkout origin/aufs6.0
+
+o aufs-util tree
+----------------------------------------
+Make sure you have git-checkout'ed the correct branch.
+
-+For aufs6-linux tree,
++For aufs-linux tree,
+- enable CONFIG_AUFS_FS.
+- set other aufs configurations if necessary.
+- for aufs5.13 and later
+ CONFIG_LOCKDEP_BITS=21
+ CONFIG_LOCKDEP_CHAINS_BITS=21
+ CONFIG_LOCKDEP_STACK_TRACE_BITS=24
++ Also you will need to expand some constant values in LOCKDEP. Refer
++ to lockdep-debug.patch in aufs-standalone.git.
+
-+For aufs6-standalone tree,
++For aufs-standalone tree,
+There are several ways to build.
+
+1.
+- apply ./aufs6-base.patch too.
+- apply ./aufs6-mmap.patch too.
+- apply ./aufs6-standalone.patch too, if you have a plan to set
-+ CONFIG_AUFS_FS=m. otherwise you don't need ./aufs6-standalone.patch.
++ CONFIG_AUFS_FS=m. otherwise you don't need ./aufs-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
+ then run "make install_ulib" too. And refer to the aufs manual in
+ detail.
+
-+There several other patches in aufs6-standalone.git. They are all
++There several other patches in aufs-standalone.git. They are all
+optional. When you meet some problems, they will help you.
+- aufs6-loopback.patch
+ Supports a nested loopback mount in a branch-fs. This patch is
+ 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
++ Similar to some kernel configurations for LOCKDEP (see the top of
++ this section), you will need expand some constants in LOCKDEP for
++ aufs if you enable CONFIG_LOCKDEP.
+
+
+4. Usage
+----------------------------------------
+At first, make sure aufs-util are installed, and please read the aufs
-+manual, aufs.6 in aufs-util.git tree.
-+$ man -l aufs.6
++manual, aufs.5 in aufs-util.git tree.
++$ man -l aufs.5
+
+And then,
+$ mkdir /tmp/rw /tmp/aufs
+/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.6.
++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.
+James Burry made a donation (2016/12).
+Carsten Rose made a donation (2018/9).
+Porteus Kiosk made a donation (2018/10).
-+Enya Quetzalli Gomez Rodriguez made a donation (2022/5).
++huronOS team: Enya Quetzalli made donations (2022/5 and 2023/5).
+
+Thank you very much.
+Donations are always, including future donations, very important and
+}
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 2022-11-05 23:02:18.959222617 +0100
++++ linux/fs/aufs/branch.h 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,375 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ return br->br_path.dentry;
+}
+
-+static inline struct user_namespace *au_br_userns(struct au_branch *br)
++static inline struct mnt_idmap *au_br_idmap(struct au_branch *br)
+{
-+ return mnt_user_ns(br->br_path.mnt);
++ return mnt_idmap(br->br_path.mnt);
+}
+
+static inline struct super_block *au_br_sb(struct au_branch *br)
+}
+
+static inline
-+struct user_namespace *au_sbr_userns(struct super_block *sb, aufs_bindex_t bindex)
++struct mnt_idmap *au_sbr_idmap(struct super_block *sb, aufs_bindex_t bindex)
+{
-+ return au_br_userns(au_sbr(sb, bindex));
++ return au_br_idmap(au_sbr(sb, bindex));
+}
+
+static inline
+-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 2022-11-05 23:02:18.962555950 +0100
++++ linux/fs/aufs/cpup.c 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,1459 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * regardless 'acl' option, reset all ACL.
+ * All ACL will be copied up later from the original entry on the lower branch.
+ */
-+static int au_reset_acl(struct inode *h_dir, struct path *h_path, umode_t mode)
++static int au_reset_acl(struct path *h_path, umode_t mode)
+{
+ int err;
+ struct dentry *h_dentry;
-+ struct inode *h_inode;
-+ struct user_namespace *h_userns;
++ /* struct inode *h_inode; */
++ struct mnt_idmap *h_idmap;
+
-+ h_userns = mnt_user_ns(h_path->mnt);
++ h_idmap = mnt_idmap(h_path->mnt);
+ h_dentry = h_path->dentry;
-+ h_inode = d_inode(h_dentry);
++ /* h_inode = d_inode(h_dentry); */
+ /* forget_all_cached_acls(h_inode)); */
-+ err = vfsub_removexattr(h_userns, h_dentry, XATTR_NAME_POSIX_ACL_ACCESS);
++ err = vfsub_remove_acl(h_idmap, h_dentry, XATTR_NAME_POSIX_ACL_ACCESS);
+ AuTraceErr(err);
+ if (err == -EOPNOTSUPP)
+ err = 0;
+ if (!err)
-+ err = vfsub_acl_chmod(h_userns, h_inode, mode);
++ err = vfsub_acl_chmod(h_idmap, h_dentry, mode);
+
+ AuTraceErr(err);
+ return err;
+{
+ int err;
+ struct inode *dir, *inode;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
-+ h_userns = mnt_user_ns(h_path->mnt);
-+ err = vfsub_removexattr(h_userns, h_path->dentry,
-+ XATTR_NAME_POSIX_ACL_DEFAULT);
++ h_idmap = mnt_idmap(h_path->mnt);
++ err = vfsub_remove_acl(h_idmap, h_path->dentry,
++ XATTR_NAME_POSIX_ACL_DEFAULT);
+ AuTraceErr(err);
+ if (err == -EOPNOTSUPP)
+ err = 0;
+ err = -EIO;
+ }
+ if (!err)
-+ err = au_reset_acl(h_dir, &h_path, mode);
++ err = au_reset_acl(&h_path, mode);
+
+ mnt_flags = au_mntflags(sb);
+ if (!au_opt_test(mnt_flags, UDBA_NONE)
+ struct dentry *dentry, *parent;
+ struct file *h_file;
+ struct inode *h_dir;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ dentry = cpg->dentry;
+ h_file = NULL;
+
+ parent = dget_parent(dentry);
+ h_dir = au_h_iptr(d_inode(parent), cpg->bdst);
-+ h_userns = au_sbr_userns(dentry->d_sb, cpg->bdst);
-+ if (!au_test_h_perm_sio(h_userns, h_dir, MAY_EXEC | MAY_WRITE)
++ h_idmap = au_sbr_idmap(dentry->d_sb, cpg->bdst);
++ if (!au_test_h_perm_sio(h_idmap, h_dir, MAY_EXEC | MAY_WRITE)
+ && !au_cpup_sio_test(cpg->pin, d_inode(dentry)->i_mode))
+ err = au_cpup_simple(cpg);
+ else {
+ struct inode *dir, *h_dir, *h_tmpdir;
+ struct au_wbr *wbr;
+ struct au_pin wh_pin, *pin_orig;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ dentry = cpg->dentry;
+ bdst = cpg->bdst;
+ cpg->pin = &wh_pin;
+ }
+
-+ h_userns = au_sbr_userns(dentry->d_sb, bdst);
-+ if (!au_test_h_perm_sio(h_userns, h_tmpdir, MAY_EXEC | MAY_WRITE)
++ h_idmap = au_sbr_idmap(dentry->d_sb, bdst);
++ if (!au_test_h_perm_sio(h_idmap, h_tmpdir, MAY_EXEC | MAY_WRITE)
+ && !au_cpup_sio_test(cpg->pin, d_inode(dentry)->i_mode))
+ err = au_cpup_wh(cpg, file);
+ else {
+#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 2022-11-05 23:02:18.962555950 +0100
-@@ -0,0 +1,444 @@
++++ linux/fs/aufs/debug.c 2023-02-20 21:05:51.959693785 +0100
+@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ }
+
+ dpri("i%d: %p, i%lu, %s, cnt %d, nl %u, 0%o, sz %llu, blk %llu,"
++ " acl %p, def_acl %p,"
+ " hn %d, ct %lld, np %lu, st 0x%lx, f 0x%x, v %llu, g %x%s%.*s\n",
+ bindex, inode,
+ inode->i_ino, inode->i_sb ? au_sbtype(inode->i_sb) : "??",
+ atomic_read(&inode->i_count), inode->i_nlink, inode->i_mode,
+ i_size_read(inode), (unsigned long long)inode->i_blocks,
++ inode->i_acl, inode->i_default_acl,
+ hn, (long long)timespec64_to_ns(&inode->i_ctime) & 0x0ffff,
+ inode->i_mapping ? inode->i_mapping->nrpages : 0,
+ inode->i_state, inode->i_flags, inode_peek_iversion(inode),
+#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 2022-11-05 23:02:18.962555950 +0100
++++ linux/fs/aufs/dentry.c 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,1168 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ struct dentry *h_dentry;
+ struct inode *h_inode;
+ struct au_branch *br;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+ struct path h_path;
+ int wh_found, opq;
+ unsigned char wh_able;
+ br = au_sbr(dentry->d_sb, bindex);
+ h_path.dentry = h_parent;
+ h_path.mnt = au_br_mnt(br);
-+ h_userns = au_br_userns(br);
++ h_idmap = au_br_idmap(br);
+ wh_able = !!au_br_whable(br->br_perm);
+ if (wh_able)
-+ wh_found = au_wh_test(h_userns, &h_path, &args->whname,
++ wh_found = au_wh_test(h_idmap, &h_path, &args->whname,
+ ignore_perm);
+ h_dentry = ERR_PTR(wh_found);
+ if (!wh_found)
+ if (!ignore_perm)
+ h_dentry = vfsub_lkup_one(args->name, &h_path);
+ else
-+ h_dentry = au_sio_lkup_one(h_userns, args->name, &h_path);
++ h_dentry = au_sio_lkup_one(h_idmap, args->name, &h_path);
+ if (IS_ERR(h_dentry)) {
+ if (PTR_ERR(h_dentry) == -ENAMETOOLONG
+ && !allow_neg)
+
+ h_path.dentry = h_dentry;
+ inode_lock_shared_nested(h_inode, AuLsc_I_CHILD);
-+ opq = au_diropq_test(h_userns, &h_path);
++ opq = au_diropq_test(h_idmap, &h_path);
+ inode_unlock_shared(h_inode);
+ if (opq > 0)
+ au_set_dbdiropq(dentry, bindex);
+ return err;
+}
+
-+struct dentry *au_sio_lkup_one(struct user_namespace *userns, struct qstr *name,
++struct dentry *au_sio_lkup_one(struct mnt_idmap *idmap, struct qstr *name,
+ struct path *ppath)
+{
+ struct dentry *dentry;
+ int wkq_err;
+
-+ if (!au_test_h_perm_sio(userns, d_inode(ppath->dentry), MAY_EXEC))
++ if (!au_test_h_perm_sio(idmap, d_inode(ppath->dentry), MAY_EXEC))
+ dentry = vfsub_lkup_one(name, ppath);
+ else {
+ struct vfsub_lkup_one_args args = {
+ int err;
+ struct dentry *parent, *h_dentry;
+ struct au_branch *br;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+ struct path h_ppath;
+
+ parent = dget_parent(dentry);
+ br = au_sbr(dentry->d_sb, bindex);
+ h_ppath.dentry = au_h_dptr(parent, bindex);
+ h_ppath.mnt = au_br_mnt(br);
-+ h_userns = au_br_userns(br);
++ h_idmap = au_br_idmap(br);
+ if (wh)
+ h_dentry = au_whtmp_lkup(h_ppath.dentry, br, &dentry->d_name);
+ else
-+ h_dentry = au_sio_lkup_one(h_userns, &dentry->d_name, &h_ppath);
++ h_dentry = au_sio_lkup_one(h_idmap, &dentry->d_name, &h_ppath);
+ err = PTR_ERR(h_dentry);
+ if (IS_ERR(h_dentry))
+ goto out;
+};
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 2023-04-24 08:13:40.969576115 +0200
+@@ -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;
+
+/* dentry.c */
+extern const struct dentry_operations aufs_dop, aufs_dop_noreval;
+struct au_branch;
-+struct dentry *au_sio_lkup_one(struct user_namespace *userns, struct qstr *name,
++struct dentry *au_sio_lkup_one(struct mnt_idmap *idmap, struct qstr *name,
+ struct path *ppath);
+int au_h_verify(struct dentry *h_dentry, unsigned int udba, struct inode *h_dir,
+ struct dentry *h_parent, struct au_branch *br);
+#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 2023-04-24 08:13:40.969576115 +0200
@@ -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)
+ int err, wkq_err;
+ struct dentry *h_dentry;
+ struct inode *h_inode;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
-+ h_userns = au_sbr_userns(dentry->d_sb, arg->bindex);
++ h_idmap = au_sbr_idmap(dentry->d_sb, arg->bindex);
+ h_dentry = au_h_dptr(dentry, arg->bindex);
+ h_inode = d_inode(h_dentry);
+ /* todo: i_mode changes anytime? */
+ inode_lock_shared_nested(h_inode, AuLsc_I_CHILD);
-+ err = au_test_h_perm_sio(h_userns, h_inode, MAY_EXEC | MAY_READ);
++ err = au_test_h_perm_sio(h_idmap, h_inode, MAY_EXEC | MAY_READ);
+ inode_unlock_shared(h_inode);
+ if (!err)
+ err = do_test_empty(dentry, 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 2023-02-20 21:05:51.959693785 +0100
+@@ -0,0 +1,780 @@
+// 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);
+ lockdep_off();
+ err = vfs_fallocate(h_file, mode, offset, len);
+ lockdep_on();
++ /*
++ * we don't need to call file_modifed() here since au_write_post()
++ * is equivalent and copies-up all timestamps and permission bits.
++ */
+ au_write_post(inode, h_file, &wpre, /*written*/1);
+
+out:
+}
diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c
--- /usr/share/empty/fs/aufs/inode.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/inode.c 2022-11-05 23:02:18.965889284 +0100
++++ linux/fs/aufs/inode.c 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,531 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ }
+ au_cpup_attr_all(inode, /*force*/1);
+ /*
-+ * to force calling aufs_get_acl() every time,
++ * to force calling aufs_get_inode_acl() every time,
+ * do not call cache_no_acl() for aufs inode.
+ */
+
+ return err;
+}
+
-+int au_test_h_perm(struct user_namespace *h_userns, struct inode *h_inode,
++int au_test_h_perm(struct mnt_idmap *h_idmap, struct inode *h_inode,
+ int mask)
+{
+ if (uid_eq(current_fsuid(), GLOBAL_ROOT_UID))
+ return 0;
-+ return inode_permission(h_userns, h_inode, mask);
++ return inode_permission(h_idmap, h_inode, mask);
+}
+
-+int au_test_h_perm_sio(struct user_namespace *h_userns, struct inode *h_inode,
++int au_test_h_perm_sio(struct mnt_idmap *h_idmap, struct inode *h_inode,
+ int mask)
+{
+ if (au_test_nfs(h_inode->i_sb)
+ && (mask & MAY_WRITE)
+ && S_ISDIR(h_inode->i_mode))
+ mask |= MAY_READ; /* force permission check */
-+ return au_test_h_perm(h_userns, h_inode, mask);
++ return au_test_h_perm(h_idmap, h_inode, mask);
+}
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
-@@ -0,0 +1,705 @@
++++ linux/fs/aufs/inode.h 2023-04-24 08:13:40.969576115 +0200
+@@ -0,0 +1,707 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+struct inode *au_new_inode(struct dentry *dentry, int must_new);
+int au_test_ro(struct super_block *sb, aufs_bindex_t bindex,
+ struct inode *inode);
-+int au_test_h_perm(struct user_namespace *h_userns, struct inode *h_inode,
++int au_test_h_perm(struct mnt_idmap *h_idmap, struct inode *h_inode,
+ int mask);
-+int au_test_h_perm_sio(struct user_namespace *h_userns, struct inode *h_inode,
++int au_test_h_perm_sio(struct mnt_idmap *h_idmap, struct inode *h_inode,
+ int mask);
+
+static inline int au_wh_ino(struct super_block *sb, aufs_bindex_t bindex,
+/* i_op_add.c */
+int au_may_add(struct dentry *dentry, aufs_bindex_t bindex,
+ struct dentry *h_parent, int isdir);
-+int aufs_mknod(struct user_namespace *userns, struct inode *dir,
++int aufs_mknod(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode, dev_t dev);
-+int aufs_symlink(struct user_namespace *userns, struct inode *dir,
++int aufs_symlink(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, const char *symname);
-+int aufs_create(struct user_namespace *userns, struct inode *dir,
++int aufs_create(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode, bool want_excl);
+struct vfsub_aopen_args;
+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);
++int aufs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
++ 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,
++int aufs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode);
+
+/* i_op_del.c */
+
+/* i_op_ren.c */
+int au_wbr(struct dentry *dentry, aufs_bindex_t btgt);
-+int aufs_rename(struct user_namespace *userns,
++int aufs_rename(struct mnt_idmap *idmap,
+ struct inode *_src_dir, struct dentry *_src_dentry,
+ struct inode *_dst_dir, struct dentry *_dst_dentry,
+ unsigned int _flags);
+#endif
+
+#ifdef CONFIG_FS_POSIX_ACL
-+struct posix_acl *aufs_get_acl(struct inode *inode, int type, bool rcu);
-+int aufs_set_acl(struct user_namespace *userns, struct inode *inode,
++struct posix_acl *aufs_get_inode_acl(struct inode *inode, int type, bool rcu);
++struct posix_acl *aufs_get_acl(struct mnt_idmap *idmap,
++ struct dentry *dentry, int type);
++int aufs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
+ struct posix_acl *acl, int type);
+#endif
+
+ 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 2023-04-24 08:13:40.969576115 +0200
+@@ -0,0 +1,972 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ return err;
+}
+
-+int aufs_mknod(struct user_namespace *userns, struct inode *dir,
++int aufs_mknod(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode, dev_t dev)
+{
+ struct simple_arg arg = {
+ return add_simple(dir, dentry, &arg);
+}
+
-+int aufs_symlink(struct user_namespace *userns, struct inode *dir,
++int aufs_symlink(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, const char *symname)
+{
+ struct simple_arg arg = {
+ return add_simple(dir, dentry, &arg);
+}
+
-+int aufs_create(struct user_namespace *userns, struct inode *dir,
++int aufs_create(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode, bool want_excl)
+{
+ struct simple_arg arg = {
+ return add_simple(dir, dentry, &arg);
+}
+
-+int aufs_tmpfile(struct user_namespace *userns, struct inode *dir,
-+ struct dentry *dentry, umode_t mode)
++int aufs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
++ 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 mnt_idmap *h_idmap;
++ 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_idmap = mnt_idmap(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_idmap, &h_ppath, mode, /*open_flag*/0,
++ current_cred());
++ 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;
+}
+
+ return err;
+}
+
-+int aufs_mkdir(struct user_namespace *userns, struct inode *dir,
++int aufs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+ struct dentry *dentry, umode_t mode)
+{
+ int err, rerr;
+}
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 2022-11-05 23:02:18.965889284 +0100
-@@ -0,0 +1,1512 @@
++++ linux/fs/aufs/i_op.c 2023-04-24 08:13:40.969576115 +0200
+@@ -0,0 +1,1517 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+ */
+
+#include <linux/device_cgroup.h>
++#include <linux/filelock.h>
+#include <linux/fs_stack.h>
+#include <linux/iversion.h>
+#include <linux/security.h>
+{
+ int err;
+ const unsigned char write_mask = !!(mask & (MAY_WRITE | MAY_APPEND));
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ err = -EPERM;
+ if (write_mask && IS_IMMUTABLE(h_inode))
+ * - nfs always sets SB_POSIXACL regardless its mount option 'noacl.'
+ * in this case, generic_permission() returns -EOPNOTSUPP.
+ */
-+ h_userns = mnt_user_ns(h_path->mnt);
++ h_idmap = mnt_idmap(h_path->mnt);
+ if ((write_mask && !au_br_writable(brperm))
+ || (au_test_nfs(h_inode->i_sb) && S_ISDIR(h_inode->i_mode)
+ && write_mask && !(mask & MAY_READ))
+ || !h_inode->i_op->permission) {
+ /* AuLabel(generic_permission); */
-+ /* AuDbg("get_acl %ps\n", h_inode->i_op->get_acl); */
-+ err = generic_permission(h_userns, h_inode, mask);
++ /* AuDbg("get_inode_acl %ps\n",
++ h_inode->i_op->get_inode_acl); */
++ err = generic_permission(h_idmap, h_inode, mask);
+ if (err == -EOPNOTSUPP && au_test_nfs_noacl(h_inode))
-+ err = h_inode->i_op->permission(h_userns, h_inode,
++ err = h_inode->i_op->permission(h_idmap, h_inode,
+ mask);
+ AuTraceErr(err);
+ } else {
+ /* AuLabel(h_inode->permission); */
-+ err = h_inode->i_op->permission(h_userns, h_inode, mask);
++ err = h_inode->i_op->permission(h_idmap, h_inode, mask);
+ AuTraceErr(err);
+ }
+
+ return err;
+}
+
-+static int aufs_permission(struct user_namespace *userns, struct inode *inode,
++static int aufs_permission(struct mnt_idmap *idmap, struct inode *inode,
+ int mask)
+{
+ int err;
+ return err;
+}
+
-+static int aufs_setattr(struct user_namespace *userns, struct dentry *dentry,
++static int aufs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
+ struct iattr *ia)
+{
+ int err;
+ struct super_block *sb;
+ struct file *file;
+ struct au_icpup_args *a;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ inode = d_inode(dentry);
+ IMustLock(inode);
+
-+ err = setattr_prepare(userns, dentry, ia);
++ err = setattr_prepare(idmap, dentry, ia);
+ if (unlikely(err))
+ goto out;
+
+ * why don't all acl-aware fs call this func from their ->setattr()?
+ */
+ if (!err && (ia->ia_valid & ATTR_MODE)) {
-+ h_userns = mnt_user_ns(a->h_path.mnt);
-+ err = vfsub_acl_chmod(h_userns, a->h_inode, ia->ia_mode);
++ h_idmap = mnt_idmap(a->h_path.mnt);
++ err = vfsub_acl_chmod(h_idmap, a->h_path.dentry, ia->ia_mode);
+ }
+ if (!err)
+ au_cpup_attr_changeable(inode);
+ struct super_block *sb;
+ struct au_icpup_args *a;
+ struct inode *h_inode;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ IMustLock(inode);
+
+ err = au_h_path_to_set_attr(dentry, a, &h_path);
+ if (unlikely(err))
+ goto out_di;
-+ h_userns = mnt_user_ns(h_path.mnt);
++ h_idmap = mnt_idmap(h_path.mnt);
+
+ inode_unlock(a->h_inode);
+ switch (arg->type) {
+ case AU_XATTR_SET:
+ AuDebugOn(d_is_negative(h_path.dentry));
-+ err = vfsub_setxattr(h_userns, h_path.dentry,
++ err = vfsub_setxattr(h_idmap, h_path.dentry,
+ arg->u.set.name, arg->u.set.value,
+ arg->u.set.size, arg->u.set.flags);
+ break;
+ h_inode = d_inode(h_path.dentry);
+ if (h_inode->i_op->set_acl) {
+ /* this will call posix_acl_update_mode */
-+ err = h_inode->i_op->set_acl(h_userns, h_inode,
++ err = h_inode->i_op->set_acl(h_idmap, h_path.dentry,
+ arg->u.acl_set.acl,
+ arg->u.acl_set.type);
+ }
+ return err;
+}
+
-+static int aufs_getattr(struct user_namespace *userns, const struct path *path,
++static int aufs_getattr(struct mnt_idmap *idmap, const struct path *path,
+ struct kstat *st, u32 request, unsigned int query)
+{
+ int err;
+ goto out_di;
+
+out_fill:
-+ generic_fillattr(userns, inode, st);
++ generic_fillattr(idmap, inode, st);
+out_di:
+ di_read_unlock(dentry, AuLock_IR);
+out_si:
+ [AuIop_SYMLINK] = {
+ .permission = aufs_permission,
+#ifdef CONFIG_FS_POSIX_ACL
++ .get_inode_acl = aufs_get_inode_acl,
+ .get_acl = aufs_get_acl,
+ .set_acl = aufs_set_acl, /* unsupport for symlink? */
+#endif
+
+ .permission = aufs_permission,
+#ifdef CONFIG_FS_POSIX_ACL
++ .get_inode_acl = aufs_get_inode_acl,
+ .get_acl = aufs_get_acl,
+ .set_acl = aufs_set_acl,
+#endif
+ [AuIop_OTHER] = {
+ .permission = aufs_permission,
+#ifdef CONFIG_FS_POSIX_ACL
++ .get_inode_acl = aufs_get_inode_acl,
+ .get_acl = aufs_get_acl,
+ .set_acl = aufs_set_acl,
+#endif
+};
diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c
--- /usr/share/empty/fs/aufs/i_op_del.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_del.c 2022-11-05 23:02:18.965889284 +0100
++++ linux/fs/aufs/i_op_del.c 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,522 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ struct path h_ppath;
+ struct super_block *sb;
+ struct au_branch *br;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ h_dentry = au_h_dptr(dentry, bindex);
+ if (d_really_is_positive(dentry)) {
+ err = -EACCES;
+ sb = dentry->d_sb;
+ br = au_sbr(sb, bindex);
-+ h_userns = au_br_userns(br);
++ h_idmap = au_br_idmap(br);
+ if (unlikely(!au_opt_test(au_mntflags(sb), DIRPERM1)
-+ && au_test_h_perm(h_userns, d_inode(h_parent),
++ && au_test_h_perm(h_idmap, d_inode(h_parent),
+ MAY_EXEC | MAY_WRITE)))
+ goto out;
+
+ h_ppath.dentry = h_parent;
+ h_ppath.mnt = au_br_mnt(br);
-+ h_latest = au_sio_lkup_one(h_userns, &dentry->d_name, &h_ppath);
++ h_latest = au_sio_lkup_one(h_idmap, &dentry->d_name, &h_ppath);
+ err = -EIO;
+ if (IS_ERR(h_latest))
+ goto out;
+}
diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c
--- /usr/share/empty/fs/aufs/i_op_ren.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/i_op_ren.c 2022-11-05 23:02:18.965889284 +0100
++++ linux/fs/aufs/i_op_ren.c 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,1257 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+
+/* ---------------------------------------------------------------------- */
+
-+int aufs_rename(struct user_namespace *userns,
++int aufs_rename(struct mnt_idmap *idmap,
+ struct inode *_src_dir, struct dentry *_src_dentry,
+ struct inode *_dst_dir, struct dentry *_dst_dentry,
+ unsigned int _flags)
+}
diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c
--- /usr/share/empty/fs/aufs/posix_acl.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/posix_acl.c 2022-11-05 23:02:18.969222617 +0100
-@@ -0,0 +1,111 @@
++++ linux/fs/aufs/posix_acl.c 2023-04-24 08:13:40.969576115 +0200
+@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2014-2022 Junjiro R. Okajima
+#include <linux/fs.h>
+#include "aufs.h"
+
-+struct posix_acl *aufs_get_acl(struct inode *inode, int type, bool rcu)
++struct posix_acl *aufs_get_inode_acl(struct inode *inode, int type, bool rcu)
+{
+ struct posix_acl *acl;
+ int err;
+ }
+
+ /* always topmost only */
-+ acl = get_acl(h_inode, type);
++ acl = get_inode_acl(h_inode, type);
+ if (IS_ERR(acl))
+ forget_cached_acl(inode, type);
+ else
+ return acl;
+}
+
-+int aufs_set_acl(struct user_namespace *userns, struct inode *inode,
++struct posix_acl *aufs_get_acl(struct mnt_idmap *idmap,
++ struct dentry *dentry, int type)
++{
++ struct posix_acl *acl;
++ struct inode *inode;
++
++ inode = d_inode(dentry);
++ acl = aufs_get_inode_acl(inode, type, /*rcu*/false);
++
++ return acl;
++}
++
++int aufs_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
+ struct posix_acl *acl, int type)
+{
+ int err;
+ ssize_t ssz;
-+ struct dentry *dentry;
++ struct inode *inode;
+ struct au_sxattr arg = {
+ .type = AU_ACL_SET,
+ .u.acl_set = {
+ },
+ };
+
++ inode = d_inode(dentry);
+ IMustLock(inode);
+
-+ if (inode->i_ino == AUFS_ROOT_INO)
-+ dentry = dget(inode->i_sb->s_root);
-+ else {
-+ dentry = d_find_alias(inode);
-+ if (!dentry)
-+ dentry = d_find_any_alias(inode);
-+ if (!dentry) {
-+ pr_warn("cannot handle this inode, "
-+ "please report to aufs-users ML\n");
-+ err = -ENOENT;
-+ goto out;
-+ }
-+ }
-+
+ ssz = au_sxattr(dentry, inode, &arg);
+ /* forget even it if succeeds since the branch might set differently */
+ forget_cached_acl(inode, type);
-+ dput(dentry);
+ err = ssz;
+ if (ssz >= 0)
+ err = 0;
+
-+out:
+ return err;
+}
diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c
+}
diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c
--- /usr/share/empty/fs/aufs/rdu.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/rdu.c 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.c linux/fs/aufs/vfsub.c
--- /usr/share/empty/fs/aufs/vfsub.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/vfsub.c 2022-11-05 23:02:18.969222617 +0100
++++ linux/fs/aufs/vfsub.c 2023-04-24 08:13:40.969576115 +0200
@@ -0,0 +1,918 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+{
+ int err;
+ struct dentry *d;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ IMustLock(dir);
+
+ path->dentry = d;
+ if (unlikely(err))
+ goto out;
-+ userns = mnt_user_ns(path->mnt);
++ idmap = mnt_idmap(path->mnt);
+
+ lockdep_off();
-+ err = vfs_create(userns, dir, path->dentry, mode, want_excl);
++ err = vfs_create(idmap, dir, path->dentry, mode, want_excl);
+ lockdep_on();
+ if (!err) {
+ struct path tmp = *path;
+{
+ int err;
+ struct dentry *d;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ IMustLock(dir);
+
+ path->dentry = d;
+ if (unlikely(err))
+ goto out;
-+ userns = mnt_user_ns(path->mnt);
++ idmap = mnt_idmap(path->mnt);
+
+ lockdep_off();
-+ err = vfs_symlink(userns, dir, path->dentry, symname);
++ err = vfs_symlink(idmap, dir, path->dentry, symname);
+ lockdep_on();
+ if (!err) {
+ struct path tmp = *path;
+{
+ int err;
+ struct dentry *d;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ IMustLock(dir);
+
+ path->dentry = d;
+ if (unlikely(err))
+ goto out;
-+ userns = mnt_user_ns(path->mnt);
++ idmap = mnt_idmap(path->mnt);
+
+ lockdep_off();
-+ err = vfs_mknod(userns, dir, path->dentry, mode, dev);
++ err = vfs_mknod(idmap, dir, path->dentry, mode, dev);
+ lockdep_on();
+ if (!err) {
+ struct path tmp = *path;
+{
+ int err;
+ struct dentry *d;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ IMustLock(dir);
+
+ path->dentry = d;
+ if (unlikely(err))
+ goto out;
-+ userns = mnt_user_ns(path->mnt);
++ idmap = mnt_idmap(path->mnt);
+
+ lockdep_off();
-+ err = vfs_link(src_dentry, userns, dir, path->dentry, delegated_inode);
++ err = vfs_link(src_dentry, idmap, dir, path->dentry, delegated_inode);
+ lockdep_on();
+ if (!err) {
+ struct path tmp = *path;
+ if (unlikely(err))
+ goto out;
+
-+ rd.old_mnt_userns = mnt_user_ns(path->mnt);
++ rd.old_mnt_idmap = mnt_idmap(path->mnt);
+ rd.old_dir = src_dir;
+ rd.old_dentry = src_dentry;
-+ rd.new_mnt_userns = rd.old_mnt_userns;
++ rd.new_mnt_idmap = rd.old_mnt_idmap;
+ rd.new_dir = dir;
+ rd.new_dentry = path->dentry;
+ rd.delegated_inode = delegated_inode;
+{
+ int err;
+ struct dentry *d;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ IMustLock(dir);
+
+ path->dentry = d;
+ if (unlikely(err))
+ goto out;
-+ userns = mnt_user_ns(path->mnt);
++ idmap = mnt_idmap(path->mnt);
+
+ lockdep_off();
-+ err = vfs_mkdir(userns, dir, path->dentry, mode);
++ err = vfs_mkdir(idmap, dir, path->dentry, mode);
+ lockdep_on();
+ if (!err) {
+ struct path tmp = *path;
+{
+ int err;
+ struct dentry *d;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ IMustLock(dir);
+
+ path->dentry = d;
+ if (unlikely(err))
+ goto out;
-+ userns = mnt_user_ns(path->mnt);
++ idmap = mnt_idmap(path->mnt);
+
+ lockdep_off();
-+ err = vfs_rmdir(userns, dir, path->dentry);
++ err = vfs_rmdir(idmap, dir, path->dentry);
+ lockdep_on();
+ if (!err) {
+ struct path tmp = {
+ int err;
+ struct inode *h_inode;
+ struct super_block *h_sb;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ if (!h_file) {
+ err = vfsub_truncate(h_path, length);
+ lockdep_off();
+ sb_start_write(h_sb);
+ lockdep_on();
-+ err = security_path_truncate(h_path);
++ err = security_file_truncate(h_file);
+ if (!err) {
-+ h_userns = mnt_user_ns(h_path->mnt);
++ h_idmap = mnt_idmap(h_path->mnt);
+ lockdep_off();
-+ err = do_truncate(h_userns, h_path->dentry, length, attr,
++ err = do_truncate(h_idmap, h_path->dentry, length, attr,
+ h_file);
+ lockdep_on();
+ }
+int vfsub_sio_mkdir(struct inode *dir, struct path *path, int mode)
+{
+ int err, do_sio, wkq_err;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
-+ userns = mnt_user_ns(path->mnt);
-+ do_sio = au_test_h_perm_sio(userns, dir, MAY_EXEC | MAY_WRITE);
++ idmap = mnt_idmap(path->mnt);
++ do_sio = au_test_h_perm_sio(idmap, dir, MAY_EXEC | MAY_WRITE);
+ if (!do_sio) {
+ lockdep_off();
+ err = vfsub_mkdir(dir, path, mode);
+int vfsub_sio_rmdir(struct inode *dir, struct path *path)
+{
+ int err, do_sio, wkq_err;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
-+ userns = mnt_user_ns(path->mnt);
-+ do_sio = au_test_h_perm_sio(userns, dir, MAY_EXEC | MAY_WRITE);
++ idmap = mnt_idmap(path->mnt);
++ do_sio = au_test_h_perm_sio(idmap, dir, MAY_EXEC | MAY_WRITE);
+ if (!do_sio) {
+ lockdep_off();
+ err = vfsub_rmdir(dir, path);
+{
+ struct notify_change_args *a = args;
+ struct inode *h_inode;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+
+ h_inode = d_inode(a->path->dentry);
+ IMustLock(h_inode);
+
+ *a->errp = -EPERM;
+ if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) {
-+ userns = mnt_user_ns(a->path->mnt);
++ idmap = mnt_idmap(a->path->mnt);
+ lockdep_off();
-+ *a->errp = notify_change(userns, a->path->dentry, a->ia,
++ *a->errp = notify_change(idmap, a->path->dentry, a->ia,
+ a->delegated_inode);
+ lockdep_on();
+ if (!*a->errp)
+ struct unlink_args *a = args;
+ struct dentry *d = a->path->dentry;
+ struct inode *h_inode;
-+ struct user_namespace *userns;
++ struct mnt_idmap *idmap;
+ const int stop_sillyrename = (au_test_nfs(d->d_sb)
+ && au_dcount(d) == 1);
+
+ ihold(h_inode);
+ }
+
-+ userns = mnt_user_ns(a->path->mnt);
++ idmap = mnt_idmap(a->path->mnt);
+ lockdep_off();
-+ *a->errp = vfs_unlink(userns, a->dir, d, a->delegated_inode);
++ *a->errp = vfs_unlink(idmap, a->dir, d, a->delegated_inode);
+ lockdep_on();
+ if (!*a->errp) {
+ struct path tmp = {
+}
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 2023-04-24 08:13:40.969576115 +0200
+@@ -0,0 +1,390 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2005-2022 Junjiro R. Okajima
+}
+
+#ifdef CONFIG_FS_POSIX_ACL
-+static inline int vfsub_acl_chmod(struct user_namespace *h_userns,
-+ struct inode *h_inode, umode_t h_mode)
++static inline int vfsub_acl_chmod(struct mnt_idmap *h_idmap,
++ struct dentry *h_dentry, umode_t h_mode)
+{
+ int err;
+
-+ err = posix_acl_chmod(h_userns, h_inode, h_mode);
++ err = posix_acl_chmod(h_idmap, h_dentry, h_mode);
+ if (err == -EOPNOTSUPP)
+ err = 0;
+ return err;
+}
+#else
-+AuStubInt0(vfsub_acl_chmod, struct user_namespace *h_userns,
-+ struct inode *h_inode, umode_t h_mode);
++AuStubInt0(vfsub_acl_chmod, struct mnt_idmap *h_idmap,
++ struct dentry *h_dentry, umode_t h_mode);
+#endif
+
+long vfsub_splice_to(struct file *in, loff_t *ppos,
+
+/* ---------------------------------------------------------------------- */
+
-+/*
-+ * 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,
++static inline int vfsub_setxattr(struct mnt_idmap *idmap,
+ struct dentry *dentry, const char *name,
-+ void *value, size_t size, int flags)
++ const void *value, size_t size, int flags)
+{
+ int err;
+
+ lockdep_off();
-+ err = vfs_setxattr(userns, dentry, name, value, size, flags);
++ err = vfs_setxattr(idmap, dentry, name, value, size, flags);
+ lockdep_on();
+
+ return err;
+}
+
-+static inline int vfsub_removexattr(struct user_namespace *userns,
++static inline int vfsub_removexattr(struct mnt_idmap *idmap,
+ struct dentry *dentry, const char *name)
+{
+ int err;
+
+ lockdep_off();
-+ err = vfs_removexattr(userns, dentry, name);
++ err = vfs_removexattr(idmap, dentry, name);
++ lockdep_on();
++
++ return err;
++}
++
++#ifdef CONFIG_FS_POSIX_ACL
++static inline int vfsub_set_acl(struct mnt_idmap *idmap,
++ struct dentry *dentry, const char *name,
++ struct posix_acl *acl)
++{
++ int err;
++
++ lockdep_off();
++ err = vfs_set_acl(idmap, dentry, name, acl);
++ lockdep_on();
++
++ return err;
++}
++
++static inline int vfsub_remove_acl(struct mnt_idmap *idmap,
++ struct dentry *dentry, const char *name)
++{
++ int err;
++
++ lockdep_off();
++ err = vfs_remove_acl(idmap, dentry, name);
+ lockdep_on();
+
+ return err;
+}
++#else
++AuStubInt0(vfsub_set_acl, struct mnt_idmap *idmap, struct dentry *dentry,
++ const char *name, struct posix_acl *acl);
++AuStubInt0(vfsub_remove_acl, struct mnt_idmap *idmap,
++ struct dentry *dentry, const char *name);
++#endif
+
+#endif /* __KERNEL__ */
+#endif /* __AUFS_VFSUB_H__ */
+};
diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c
--- /usr/share/empty/fs/aufs/whout.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/whout.c 2022-11-05 23:02:18.972555950 +0100
++++ linux/fs/aufs/whout.c 2023-04-24 08:13:40.972909448 +0200
@@ -0,0 +1,1072 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * test if the @wh_name exists under @h_ppath.
+ * @try_sio specifies the necessary of super-io.
+ */
-+int au_wh_test(struct user_namespace *h_userns, struct path *h_ppath,
++int au_wh_test(struct mnt_idmap *h_idmap, struct path *h_ppath,
+ struct qstr *wh_name, int try_sio)
+{
+ int err;
+ if (!try_sio)
+ wh_dentry = vfsub_lkup_one(wh_name, h_ppath);
+ else
-+ wh_dentry = au_sio_lkup_one(h_userns, wh_name, h_ppath);
++ wh_dentry = au_sio_lkup_one(h_idmap, wh_name, h_ppath);
+ err = PTR_ERR(wh_dentry);
+ if (IS_ERR(wh_dentry)) {
+ if (err == -ENAMETOOLONG)
+/*
+ * test if the @h_path->dentry sets opaque or not.
+ */
-+int au_diropq_test(struct user_namespace *h_userns, struct path *h_path)
++int au_diropq_test(struct mnt_idmap *h_idmap, struct path *h_path)
+{
+ int err;
+ struct inode *h_dir;
+
+ h_dir = d_inode(h_path->dentry);
-+ err = au_wh_test(h_userns, h_path, &diropq_name,
-+ au_test_h_perm_sio(h_userns, h_dir, MAY_EXEC));
++ err = au_wh_test(h_idmap, h_path, &diropq_name,
++ au_test_h_perm_sio(h_idmap, h_dir, MAY_EXEC));
+ return err;
+}
+
+ static unsigned short cnt;
+ struct qstr qs;
+ struct path h_ppath;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ BUILD_BUG_ON(sizeof(cnt) * 2 > AUFS_WH_TMP_LEN);
+
+
+ h_ppath.dentry = h_parent;
+ h_ppath.mnt = au_br_mnt(br);
-+ h_userns = au_br_userns(br);
++ h_idmap = au_br_idmap(br);
+ qs.name = name;
+ for (i = 0; i < 3; i++) {
+ sprintf(p, "%.*x", AUFS_WH_TMP_LEN, cnt++);
-+ dentry = au_sio_lkup_one(h_userns, &qs, &h_ppath);
++ dentry = au_sio_lkup_one(h_idmap, &qs, &h_ppath);
+ if (IS_ERR(dentry) || d_is_negative(dentry))
+ goto out_name;
+ dput(dentry);
+ unsigned int flags)
+{
+ struct dentry *diropq, *h_dentry;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
-+ h_userns = au_sbr_userns(dentry->d_sb, bindex);
++ h_idmap = au_sbr_idmap(dentry->d_sb, bindex);
+ h_dentry = au_h_dptr(dentry, bindex);
-+ if (!au_test_h_perm_sio(h_userns, d_inode(h_dentry),
++ if (!au_test_h_perm_sio(h_idmap, d_inode(h_dentry),
+ MAY_EXEC | MAY_WRITE))
+ diropq = do_diropq(dentry, bindex, flags);
+ else {
+ struct path wh_path;
+ struct inode *wh_inode, *h_dir;
+ struct au_branch *br;
-+ struct user_namespace *h_userns;
++ struct mnt_idmap *h_idmap;
+
+ h_dir = d_inode(wh_dentry->d_parent); /* dir inode is locked */
+ IMustLock(h_dir);
+ br = au_sbr(dir->i_sb, bindex);
+ wh_path.dentry = wh_dentry;
+ wh_path.mnt = au_br_mnt(br);
-+ h_userns = au_br_userns(br);
++ h_idmap = au_br_idmap(br);
+ wh_inode = d_inode(wh_dentry);
+ inode_lock_nested(wh_inode, AuLsc_I_CHILD);
+
+ * someone else might change some whiteouts while we were sleeping.
+ * it means this whlist may have an obsoleted entry.
+ */
-+ if (!au_test_h_perm_sio(h_userns, wh_inode, MAY_EXEC | MAY_WRITE))
++ if (!au_test_h_perm_sio(h_idmap, wh_inode, MAY_EXEC | MAY_WRITE))
+ err = del_wh_children(&wh_path, whlist, bindex);
+ else {
+ int wkq_err;
+}
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 2022-11-05 23:02:18.972555950 +0100
++++ linux/fs/aufs/whout.h 2023-04-24 08:13:40.972909448 +0200
@@ -0,0 +1,87 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+
+/* whout.c */
+int au_wh_name_alloc(struct qstr *wh, const struct qstr *name);
-+int au_wh_test(struct user_namespace *h_userns, struct path *h_ppath,
++int au_wh_test(struct mnt_idmap *h_idmap, struct path *h_ppath,
+ struct qstr *wh_name, int try_sio);
-+int au_diropq_test(struct user_namespace *h_userns, struct path *h_path);
++int au_diropq_test(struct mnt_idmap *h_idmap, struct path *h_path);
+struct au_branch;
+struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br,
+ struct qstr *prefix);
+#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 2023-07-04 23:43:55.849649534 +0200
+@@ -0,0 +1,360 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2014-2022 Junjiro R. Okajima
+ */
+
+#include <linux/fs.h>
-+#include <linux/posix_acl_xattr.h>
+#include <linux/xattr.h>
+#include "aufs.h"
+
+ char *name, char **buf, unsigned int ignore_flags,
+ unsigned int verbose)
+{
-+ int err;
++ int err, is_acl;
+ ssize_t ssz;
+ struct inode *h_idst;
+ struct dentry *h_dst_dentry, *h_src_dentry;
-+ struct user_namespace *h_dst_userns, *h_src_userns;
++ struct mnt_idmap *h_dst_idmap, *h_src_idmap;
++ struct posix_acl *acl;
+
-+ h_src_userns = mnt_user_ns(h_src->mnt);
++ is_acl = !!is_posix_acl_xattr(name);
++ h_src_idmap = mnt_idmap(h_src->mnt);
+ h_src_dentry = h_src->dentry;
-+ ssz = vfs_getxattr_alloc(h_src_userns, h_src_dentry, name, buf, 0,
-+ GFP_NOFS);
-+ err = ssz;
-+ if (unlikely(err <= 0)) {
-+ if (err == -ENODATA
-+ || (err == -EOPNOTSUPP
-+ && ((ignore_flags & au_xattr_out_of_list)
-+ || (au_test_nfs_noacl(d_inode(h_src_dentry))
-+ && (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS)
-+ || !strcmp(name,
-+ XATTR_NAME_POSIX_ACL_DEFAULT))))
-+ ))
-+ err = 0;
-+ if (err && (verbose || au_debug_test()))
-+ pr_err("%s, err %d\n", name, err);
-+ goto out;
++ if (is_acl) {
++ acl = vfs_get_acl(h_src_idmap, h_src_dentry, name);
++ AuDebugOn(!acl);
++ if (unlikely(IS_ERR(acl))) {
++ err = PTR_ERR(acl);
++ if (err == -ENODATA)
++ err = 0;
++ else if (err == -EOPNOTSUPP
++ && au_test_nfs_noacl(d_inode(h_src_dentry)))
++ err = 0;
++ else if (verbose || au_debug_test())
++ pr_err("%s, err %d\n", name, err);
++ goto out;
++ }
++ } else {
++ ssz = vfs_getxattr_alloc(h_src_idmap, h_src_dentry, name, buf,
++ 0, GFP_NOFS);
++ if (unlikely(ssz <= 0)) {
++ err = ssz;
++ if (err == -ENODATA)
++ err = 0;
++ else if (err == -EOPNOTSUPP
++ && (ignore_flags & au_xattr_out_of_list))
++ err = 0;
++ else if (err && (verbose || au_debug_test()))
++ pr_err("%s, err %d\n", name, err);
++ goto out;
++ }
+ }
+
+ /* unlock it temporary */
-+ h_dst_userns = mnt_user_ns(h_dst->mnt);
++ h_dst_idmap = mnt_idmap(h_dst->mnt);
+ h_dst_dentry = h_dst->dentry;
+ h_idst = d_inode(h_dst_dentry);
+ inode_unlock(h_idst);
-+ err = vfsub_setxattr(h_dst_userns, h_dst_dentry, name, *buf, ssz,
-+ /*flags*/0);
++ if (is_acl) {
++ err = vfsub_set_acl(h_dst_idmap, h_dst_dentry, name, acl);
++ posix_acl_release(acl);
++ } else
++ err = vfsub_setxattr(h_dst_idmap, h_dst_dentry, name, *buf,
++ ssz, /*flags*/0);
+ inode_lock_nested(h_idst, AuLsc_I_CHILD2);
+ if (unlikely(err)) {
+ if (verbose || au_debug_test())
+int au_cpup_xattr(struct path *h_dst, struct path *h_src, int ignore_flags,
+ unsigned int verbose)
+{
-+ int err, unlocked, acl_access, acl_default;
++ int err, unlocked;
+ ssize_t ssz;
+ struct dentry *h_dst_dentry, *h_src_dentry;
+ struct inode *h_isrc, *h_idst;
+ err = 0;
+ e = p + ssz;
+ value = NULL;
-+ acl_access = 0;
-+ acl_default = 0;
++ ignore_flags |= au_xattr_out_of_list;
+ while (!err && p < e) {
-+ acl_access |= !strncmp(p, XATTR_NAME_POSIX_ACL_ACCESS,
-+ sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1);
-+ acl_default |= !strncmp(p, XATTR_NAME_POSIX_ACL_DEFAULT,
-+ sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)
-+ - 1);
+ err = au_do_cpup_xattr(h_dst, h_src, p, &value, ignore_flags,
+ verbose);
+ p += strlen(p) + 1;
+ }
-+ AuTraceErr(err);
-+ ignore_flags |= au_xattr_out_of_list;
-+ if (!err && !acl_access) {
-+ err = au_do_cpup_xattr(h_dst, h_src,
-+ XATTR_NAME_POSIX_ACL_ACCESS, &value,
-+ ignore_flags, verbose);
-+ AuTraceErr(err);
-+ }
-+ if (!err && !acl_default) {
-+ err = au_do_cpup_xattr(h_dst, h_src,
-+ XATTR_NAME_POSIX_ACL_DEFAULT, &value,
-+ ignore_flags, verbose);
-+ AuTraceErr(err);
-+ }
-+
+ au_kfree_try_rcu(value);
+
+out_free:
+ break;
+ case AU_XATTR_GET:
+ AuDebugOn(d_is_negative(h_path.dentry));
-+ err = vfs_getxattr(mnt_user_ns(h_path.mnt), h_path.dentry,
++ err = vfs_getxattr(mnt_idmap(h_path.mnt), h_path.dentry,
+ arg->u.get.name, arg->u.get.value,
+ arg->u.get.size);
+ break;
+}
+
+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 mnt_idmap *idmap,
+ 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 = {
+};
+
+static const struct xattr_handler *au_xattr_handlers[] = {
-+#ifdef CONFIG_FS_POSIX_ACL
-+ &posix_acl_access_xattr_handler,
-+ &posix_acl_default_xattr_handler,
-+#endif
+ &au_xattr_handler, /* must be last */
+ NULL
+};
+}
diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c
--- /usr/share/empty/fs/aufs/xino.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux/fs/aufs/xino.c 2022-11-05 23:02:18.972555950 +0100
++++ linux/fs/aufs/xino.c 2023-04-24 08:13:40.972909448 +0200
@@ -0,0 +1,1926 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ }
+
+ /* no need to mnt_want_write() since we call dentry_open() later */
-+ err = vfs_create(mnt_user_ns(base->mnt), dir, path.dentry, 0666, NULL);
++ err = vfs_create(mnt_idmap(base->mnt), dir, path.dentry, 0666, NULL);
+ if (unlikely(err)) {
+ file = ERR_PTR(err);
+ pr_err("%pd create err %d\n", dentry, 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 2022-11-05 23:02:18.972555950 +0100
++++ linux/include/uapi/linux/aufs_type.h 2023-07-04 23:43:55.849649534 +0200
@@ -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-20230515"
+
+/* 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
+index 131294601819..56016fc9c9d8 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -54,7 +54,7 @@ struct loop_device {
struct inode *inode;
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);
+@@ -1028,6 +1052,13 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
+ /* 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 1ed300047a41..ea63191d6473 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 1e3054e5367d..2a780fcbdc75 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
-@@ -2253,6 +2253,10 @@ struct super_operations {
+@@ -1934,6 +1934,10 @@ struct super_operations {
struct shrink_control *);
long (*free_cached_objects)(struct super_block *,
struct shrink_control *);