X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=kernel-aufs5.patch;h=968a40067b549a5fa07b77747a943ba57561932b;hb=758e9dad9651b5d1bad74f209dd0633e7a713660;hp=76f3cabe66c55f46f801aeb89998cf7f22f45308;hpb=13f235e580afa1a1844887c485745375dbd53a02;p=packages%2Fkernel.git diff --git a/kernel-aufs5.patch b/kernel-aufs5.patch index 76f3cabe..968a4006 100644 --- a/kernel-aufs5.patch +++ b/kernel-aufs5.patch @@ -1,11 +1,11 @@ SPDX-License-Identifier: GPL-2.0 -aufs5.11 kbuild patch +aufs5.x-rcN kbuild patch diff --git a/fs/Kconfig b/fs/Kconfig -index da524c4d7b7e0..50ab89368c2b5 100644 +index a6313a969bc5f..aca4b89d41a14 100644 --- a/fs/Kconfig +++ b/fs/Kconfig -@@ -288,6 +288,7 @@ source "fs/sysv/Kconfig" +@@ -312,6 +312,7 @@ source "fs/sysv/Kconfig" source "fs/ufs/Kconfig" source "fs/erofs/Kconfig" source "fs/vboxsf/Kconfig" @@ -14,24 +14,24 @@ index da524c4d7b7e0..50ab89368c2b5 100644 endif # MISC_FILESYSTEMS diff --git a/fs/Makefile b/fs/Makefile -index 999d1a23f036c..0cd76857ca764 100644 +index 84c5e4cdfee5a..b4fcdad8412ed 100644 --- a/fs/Makefile +++ b/fs/Makefile -@@ -136,3 +136,4 @@ obj-$(CONFIG_EFIVAR_FS) += efivarfs/ +@@ -138,3 +138,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 -aufs5.11 base patch +aufs5.x-rcN base patch diff --git a/MAINTAINERS b/MAINTAINERS -index bfc1b86e3e733..cf773a5624338 100644 +index a4a0c2baaf274..cc2119bc60fd1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -3017,6 +3017,19 @@ F: include/linux/audit.h - F: include/uapi/linux/audit.h +@@ -3122,6 +3122,19 @@ F: include/uapi/linux/audit.h F: kernel/audit* + F: lib/*audit.c +AUFS (advanced multi layered unification filesystem) FILESYSTEM +M: "J. R. Okajima" @@ -50,10 +50,10 @@ index bfc1b86e3e733..cf773a5624338 100644 M: Miguel Ojeda S: Maintained diff --git a/drivers/block/loop.c b/drivers/block/loop.c -index e5ff328f09175..39d539df0349d 100644 +index 7bf4686af774e..a62b132cbd551 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c -@@ -761,6 +761,24 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, +@@ -811,6 +811,24 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, return error; } @@ -79,10 +79,10 @@ index e5ff328f09175..39d539df0349d 100644 static ssize_t loop_attr_show(struct device *dev, char *page, diff --git a/fs/dcache.c b/fs/dcache.c -index 97e81a844a966..a7522ebbca659 100644 +index cf871a81f4fdc..bc5095b734f58 100644 --- a/fs/dcache.c +++ b/fs/dcache.c -@@ -1292,7 +1292,7 @@ enum d_walk_ret { +@@ -1320,7 +1320,7 @@ enum d_walk_ret { * * The @enter() callbacks are called with d_lock held. */ @@ -92,10 +92,10 @@ index 97e81a844a966..a7522ebbca659 100644 { struct dentry *this_parent; diff --git a/fs/fcntl.c b/fs/fcntl.c -index 05b36b28f2e87..e747a47a97da4 100644 +index 9c6c6a3e2de51..02382fa9bd341 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c -@@ -32,7 +32,7 @@ +@@ -33,7 +33,7 @@ #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME) @@ -104,7 +104,7 @@ index 05b36b28f2e87..e747a47a97da4 100644 { 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); @@ -114,10 +114,10 @@ index 05b36b28f2e87..e747a47a97da4 100644 return error; diff --git a/fs/inode.c b/fs/inode.c -index 6442d97d9a4ab..e4a25c3fa9e55 100644 +index ed0cab8a32db1..7e53985e62e5e 100644 --- a/fs/inode.c +++ b/fs/inode.c -@@ -1769,7 +1769,7 @@ EXPORT_SYMBOL(generic_update_time); +@@ -1782,7 +1782,7 @@ EXPORT_SYMBOL(generic_update_time); * This does the actual work of updating an inodes time or version. Must have * had called mnt_want_write() before calling this. */ @@ -127,10 +127,10 @@ index 6442d97d9a4ab..e4a25c3fa9e55 100644 if (inode->i_op->update_time) return inode->i_op->update_time(inode, time, flags); diff --git a/fs/namespace.c b/fs/namespace.c -index 9d33909d0f9e3..3e16fc64df8b8 100644 +index 659a8f39c61af..1283670737826 100644 --- a/fs/namespace.c +++ b/fs/namespace.c -@@ -792,6 +792,12 @@ static inline int check_mnt(struct mount *mnt) +@@ -808,6 +808,12 @@ static inline int check_mnt(struct mount *mnt) return mnt->mnt_ns == current->nsproxy->mnt_ns; } @@ -144,10 +144,10 @@ index 9d33909d0f9e3..3e16fc64df8b8 100644 * vfsmount lock must be held for write */ diff --git a/fs/splice.c b/fs/splice.c -index 866d5c2367b23..55b5356262085 100644 +index 5dbce4dcc1a7d..3e6ba363b7775 100644 --- a/fs/splice.c +++ b/fs/splice.c -@@ -756,8 +756,8 @@ static int warn_unsupported(struct file *file, const char *op) +@@ -759,8 +759,8 @@ static int warn_unsupported(struct file *file, const char *op) /* * Attempt to initiate a splice from pipe to file. */ @@ -158,7 +158,7 @@ index 866d5c2367b23..55b5356262085 100644 { 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, +@@ -770,9 +770,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. */ @@ -185,10 +185,10 @@ index 1373a610dc784..b7b5a0a0df6ff 100644 if (wait) sync_inodes_sb(sb); diff --git a/include/linux/fs.h b/include/linux/fs.h -index fd47deea7c176..91f3fbe5b57ff 100644 +index e7a633353fd20..376ddf1965aa2 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h -@@ -1330,6 +1330,7 @@ extern void fasync_free(struct fasync_struct *); +@@ -1381,6 +1381,7 @@ extern void fasync_free(struct fasync_struct *); /* can be called from interrupts */ extern void kill_fasync(struct fasync_struct **, int, int); @@ -196,7 +196,7 @@ index fd47deea7c176..91f3fbe5b57ff 100644 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); -@@ -1841,6 +1842,7 @@ struct file_operations { +@@ -2092,6 +2093,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); @@ -204,7 +204,7 @@ index fd47deea7c176..91f3fbe5b57ff 100644 int (*flock) (struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); -@@ -2326,6 +2328,7 @@ extern int current_umask(void); +@@ -2613,6 +2615,7 @@ extern int current_umask(void); extern void ihold(struct inode * inode); extern void iput(struct inode *); extern int generic_update_time(struct inode *, struct timespec64 *, int); @@ -212,7 +212,7 @@ index fd47deea7c176..91f3fbe5b57ff 100644 /* /sys/fs */ extern struct kobject *fs_kobj; -@@ -2562,6 +2565,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb) +@@ -2776,6 +2779,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb) } void emergency_thaw_all(void); @@ -221,10 +221,10 @@ index fd47deea7c176..91f3fbe5b57ff 100644 extern const struct file_operations def_blk_fops; extern const struct file_operations def_chr_fops; diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h -index b9e9adec73e8b..e152c49cc3163 100644 +index 9fe165beb0f9e..e47f7e15eeaf7 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h -@@ -241,6 +241,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock, +@@ -248,6 +248,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock, return lock->key == key; } @@ -269,10 +269,10 @@ index a55179fd60fc3..8e21c53cf8831 100644 + unsigned int flags); #endif diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c -index bdaf4829098c0..5c3bff75de111 100644 +index bf1c00c881e48..e0aaf34974df5 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c -@@ -188,7 +188,7 @@ static +@@ -189,7 +189,7 @@ static struct lock_class lock_classes[MAX_LOCKDEP_KEYS]; static DECLARE_BITMAP(lock_classes_in_use, MAX_LOCKDEP_KEYS); @@ -281,7 +281,7 @@ index bdaf4829098c0..5c3bff75de111 100644 { unsigned int class_idx = hlock->class_idx; -@@ -209,6 +209,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock) +@@ -210,6 +210,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock) */ return lock_classes + class_idx; } @@ -290,13 +290,13 @@ index bdaf4829098c0..5c3bff75de111 100644 #ifdef CONFIG_LOCK_STAT static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats); SPDX-License-Identifier: GPL-2.0 -aufs5.11 mmap patch +aufs5.x-rcN mmap patch diff --git a/fs/proc/base.c b/fs/proc/base.c -index b3422cda2a91e..bda8e8ece7208 100644 +index 533d5836eb9a4..f5de60c5327f5 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c -@@ -2184,7 +2184,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path) +@@ -2186,7 +2186,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path) rc = -ENOENT; vma = find_exact_vma(mm, vm_start, vm_end); if (vma && vma->vm_file) { @@ -322,7 +322,7 @@ index 13452b32e2bd5..38acccfef9d49 100644 ino = inode->i_ino; } diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 602e3a52884d8..a36614b84de16 100644 +index cf25be3e03212..70af1c25ffa22 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -280,7 +280,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma) @@ -337,7 +337,7 @@ index 602e3a52884d8..a36614b84de16 100644 dev = inode->i_sb->s_dev; ino = inode->i_ino; pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; -@@ -1862,7 +1865,7 @@ static int show_numa_map(struct seq_file *m, void *v) +@@ -1865,7 +1868,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; @@ -363,10 +363,10 @@ index a6d21fc0033c6..02c2de31196e0 100644 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 ecdf8a8cd6aeb..d9b3ec02ecbef 100644 +index 73a52aba448f9..5dd42acf0707b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h -@@ -1715,6 +1715,28 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping, +@@ -1806,6 +1806,28 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping, unmap_mapping_range(mapping, holebegin, holelen, 0); } @@ -396,10 +396,10 @@ index ecdf8a8cd6aeb..d9b3ec02ecbef 100644 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 07d9acb5b19c4..2f395ab624f38 100644 +index 7f8ee09c711f4..3a9a798a4ae1f 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h -@@ -278,6 +278,7 @@ struct vm_region { +@@ -294,6 +294,7 @@ struct vm_region { unsigned long vm_top; /* region allocated to here */ unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ struct file *vm_file; /* the backing file or NULL */ @@ -407,7 +407,7 @@ index 07d9acb5b19c4..2f395ab624f38 100644 int vm_usage; /* region usage count (access under nommu_region_sem) */ bool vm_icache_flushed : 1; /* true if the icache has been flushed for -@@ -357,6 +358,7 @@ struct vm_area_struct { +@@ -373,6 +374,7 @@ struct vm_area_struct { unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE units */ struct file * vm_file; /* File we map to (can be NULL). */ @@ -416,20 +416,20 @@ index 07d9acb5b19c4..2f395ab624f38 100644 #ifdef CONFIG_SWAP diff --git a/kernel/fork.c b/kernel/fork.c -index d66cd1014211b..a2addc21d63fc 100644 +index 38681ad44c76b..95de8e9843192 100644 --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -555,7 +555,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, - struct inode *inode = file_inode(file); +@@ -573,7 +573,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, + if (file) { struct address_space *mapping = file->f_mapping; - get_file(file); + vma_get_file(tmp); - if (tmp->vm_flags & VM_DENYWRITE) - put_write_access(inode); i_mmap_lock_write(mapping); + if (tmp->vm_flags & VM_SHARED) + mapping_allow_writable(mapping); diff --git a/mm/Makefile b/mm/Makefile -index b6cd2fffa4922..784e2cebe1eac 100644 +index fc60a40ce954b..c715b0138237b 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -52,7 +52,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.o \ @@ -442,10 +442,10 @@ index b6cd2fffa4922..784e2cebe1eac 100644 # Give 'page_alloc' its own module-parameter namespace page-alloc-y := page_alloc.o diff --git a/mm/filemap.c b/mm/filemap.c -index aa0e0fb046700..d883a19f4237e 100644 +index dae481293b5d9..52bf3bf87b757 100644 --- a/mm/filemap.c +++ b/mm/filemap.c -@@ -2993,7 +2993,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf) +@@ -3350,7 +3350,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); @@ -455,10 +455,10 @@ index aa0e0fb046700..d883a19f4237e 100644 if (page->mapping != mapping) { unlock_page(page); diff --git a/mm/mmap.c b/mm/mmap.c -index dc7206032387c..09b10e20c097c 100644 +index 88dcc5c252255..6c276614ca962 100644 --- a/mm/mmap.c +++ b/mm/mmap.c -@@ -179,7 +179,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) +@@ -183,7 +183,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) if (vma->vm_ops && vma->vm_ops->close) vma->vm_ops->close(vma); if (vma->vm_file) @@ -467,7 +467,7 @@ index dc7206032387c..09b10e20c097c 100644 mpol_put(vma_policy(vma)); vm_area_free(vma); return next; -@@ -951,7 +951,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, +@@ -952,7 +952,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); @@ -476,7 +476,7 @@ index dc7206032387c..09b10e20c097c 100644 } if (next->anon_vma) anon_vma_merge(vma, next); -@@ -1897,7 +1897,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, +@@ -1873,7 +1873,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, return addr; unmap_and_free_vma: @@ -485,7 +485,7 @@ index dc7206032387c..09b10e20c097c 100644 vma->vm_file = NULL; /* Undo any partial mapping done by a device driver. */ -@@ -2757,7 +2757,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, +@@ -2731,7 +2731,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, goto out_free_mpol; if (new->vm_file) @@ -494,7 +494,7 @@ index dc7206032387c..09b10e20c097c 100644 if (new->vm_ops && new->vm_ops->open) new->vm_ops->open(new); -@@ -2776,7 +2776,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, +@@ -2750,7 +2750,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) @@ -503,7 +503,7 @@ index dc7206032387c..09b10e20c097c 100644 unlink_anon_vmas(new); out_free_mpol: mpol_put(vma_policy(new)); -@@ -2969,7 +2969,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, +@@ -2945,7 +2945,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, struct vm_area_struct *vma; unsigned long populate = 0; unsigned long ret = -EINVAL; @@ -512,9 +512,9 @@ index dc7206032387c..09b10e20c097c 100644 pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.rst.\n", current->comm, current->pid); -@@ -3044,10 +3044,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, - } - } +@@ -3001,10 +3001,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, + if (vma->vm_flags & VM_LOCKED) + flags |= MAP_LOCKED; - file = get_file(vma->vm_file); + vma_get_file(vma); @@ -541,7 +541,7 @@ index dc7206032387c..09b10e20c097c 100644 out: mmap_write_unlock(mm); if (populate) -@@ -3334,7 +3351,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, +@@ -3285,7 +3302,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) @@ -551,10 +551,10 @@ index dc7206032387c..09b10e20c097c 100644 new_vma->vm_ops->open(new_vma); vma_link(mm, new_vma, prev, rb_link, rb_parent); diff --git a/mm/nommu.c b/mm/nommu.c -index 870fea12823e6..edbc99eee5b6b 100644 +index 02d2427b8f9e8..a7419302ab4ed 100644 --- a/mm/nommu.c +++ b/mm/nommu.c -@@ -533,7 +533,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) @@ -563,7 +563,7 @@ index 870fea12823e6..edbc99eee5b6b 100644 /* IO memory and memory shared directly out of the pagecache * from ramfs/tmpfs mustn't be released here */ -@@ -665,7 +665,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma) +@@ -655,7 +655,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) @@ -572,7 +572,7 @@ index 870fea12823e6..edbc99eee5b6b 100644 put_nommu_region(vma->vm_region); vm_area_free(vma); } -@@ -1188,7 +1188,7 @@ unsigned long do_mmap(struct file *file, +@@ -1175,7 +1175,7 @@ unsigned long do_mmap(struct file *file, goto error_just_free; } } @@ -581,7 +581,7 @@ index 870fea12823e6..edbc99eee5b6b 100644 kmem_cache_free(vm_region_jar, region); region = pregion; result = start; -@@ -1265,10 +1265,10 @@ unsigned long do_mmap(struct file *file, +@@ -1252,10 +1252,10 @@ unsigned long do_mmap(struct file *file, up_write(&nommu_region_sem); error: if (region->vm_file) @@ -596,7 +596,7 @@ index 870fea12823e6..edbc99eee5b6b 100644 diff --git a/mm/prfile.c b/mm/prfile.c new file mode 100644 -index 0000000000000..00d51187c3250 +index 0000000000000..511543ab1b418 --- /dev/null +++ b/mm/prfile.c @@ -0,0 +1,86 @@ @@ -608,7 +608,7 @@ index 0000000000000..00d51187c3250 + * + * See Documentation/filesystems/aufs/design/06mmap.txt + * -+ * Copyright (c) 2014-2020 Junjro R. Okajima ++ * Copyright (c) 2014-2021 Junjro R. Okajima + * Copyright (c) 2014 Ian Campbell + */ + @@ -687,13 +687,13 @@ index 0000000000000..00d51187c3250 +} +#endif /* !CONFIG_MMU */ SPDX-License-Identifier: GPL-2.0 -aufs5.11 standalone patch +aufs5.x-rcN standalone patch diff --git a/fs/dcache.c b/fs/dcache.c -index a7522ebbca659..d429c984133ca 100644 +index bc5095b734f58..9508bd57a3bc0 100644 --- a/fs/dcache.c +++ b/fs/dcache.c -@@ -1397,6 +1397,7 @@ void d_walk(struct dentry *parent, void *data, +@@ -1425,6 +1425,7 @@ void d_walk(struct dentry *parent, void *data, seq = 1; goto again; } @@ -701,7 +701,7 @@ index a7522ebbca659..d429c984133ca 100644 struct check_mount { struct vfsmount *mnt; -@@ -2942,6 +2943,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2) +@@ -2970,6 +2971,7 @@ void d_exchange(struct dentry *dentry1, struct dentry *dentry2) write_sequnlock(&rename_lock); } @@ -710,10 +710,10 @@ index a7522ebbca659..d429c984133ca 100644 /** * d_ancestor - search for an ancestor diff --git a/fs/exec.c b/fs/exec.c -index 5d4d52039105c..adc75877cdee7 100644 +index a098c133d8d74..7b6a249fd4778 100644 --- a/fs/exec.c +++ b/fs/exec.c -@@ -114,6 +114,7 @@ bool path_noexec(const struct path *path) +@@ -111,6 +111,7 @@ bool path_noexec(const struct path *path) return (path->mnt->mnt_flags & MNT_NOEXEC) || (path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC); } @@ -722,10 +722,10 @@ index 5d4d52039105c..adc75877cdee7 100644 #ifdef CONFIG_USELIB /* diff --git a/fs/fcntl.c b/fs/fcntl.c -index e747a47a97da4..d6211ff25c9a4 100644 +index 02382fa9bd341..3418c60b90146 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c -@@ -85,6 +85,7 @@ int setfl(int fd, struct file *filp, unsigned long arg) +@@ -86,6 +86,7 @@ int setfl(int fd, struct file *filp, unsigned long arg) out: return error; } @@ -754,10 +754,10 @@ index 45437f8e1003e..786af52904fcf 100644 void __init files_init(void) { diff --git a/fs/inode.c b/fs/inode.c -index e4a25c3fa9e55..497326faa1247 100644 +index 7e53985e62e5e..e36c5b2f96df7 100644 --- a/fs/inode.c +++ b/fs/inode.c -@@ -1775,6 +1775,7 @@ int update_time(struct inode *inode, struct timespec64 *time, int flags) +@@ -1788,6 +1788,7 @@ int update_time(struct inode *inode, struct timespec64 *time, int flags) return inode->i_op->update_time(inode, time, flags); return generic_update_time(inode, time, flags); } @@ -766,10 +766,10 @@ index e4a25c3fa9e55..497326faa1247 100644 /** * atime_needs_update - update the access time diff --git a/fs/namespace.c b/fs/namespace.c -index 3e16fc64df8b8..eed3453ec40a8 100644 +index 1283670737826..db99365620118 100644 --- a/fs/namespace.c +++ b/fs/namespace.c -@@ -431,6 +431,7 @@ void __mnt_drop_write(struct vfsmount *mnt) +@@ -439,6 +439,7 @@ void __mnt_drop_write(struct vfsmount *mnt) mnt_dec_writers(real_mount(mnt)); preempt_enable(); } @@ -777,7 +777,7 @@ index 3e16fc64df8b8..eed3453ec40a8 100644 /** * mnt_drop_write - give up write access to a mount -@@ -797,6 +798,7 @@ int is_current_mnt_ns(struct vfsmount *mnt) +@@ -813,6 +814,7 @@ int is_current_mnt_ns(struct vfsmount *mnt) { return check_mnt(real_mount(mnt)); } @@ -785,7 +785,7 @@ index 3e16fc64df8b8..eed3453ec40a8 100644 /* * vfsmount lock must be held for write -@@ -1967,6 +1969,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, +@@ -2011,6 +2013,7 @@ int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, } return 0; } @@ -794,7 +794,7 @@ index 3e16fc64df8b8..eed3453ec40a8 100644 static void lock_mnt_tree(struct mount *mnt) { diff --git a/fs/notify/group.c b/fs/notify/group.c -index a4a4b1c64d32a..86dc2efb1850c 100644 +index fb89c351295d6..460ad19c2570a 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c @@ -100,6 +100,7 @@ void fsnotify_get_group(struct fsnotify_group *group) @@ -806,10 +806,10 @@ index a4a4b1c64d32a..86dc2efb1850c 100644 /* * Drop a reference to a group. Free it if it's through. diff --git a/fs/open.c b/fs/open.c -index 1e06e443a5651..c3bbb8aafcd1a 100644 +index daa324606a41f..0d8bb2f1922a3 100644 --- a/fs/open.c +++ b/fs/open.c -@@ -65,6 +65,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, +@@ -65,6 +65,7 @@ int do_truncate(struct user_namespace *mnt_userns, struct dentry *dentry, inode_unlock(dentry->d_inode); return ret; } @@ -818,10 +818,10 @@ index 1e06e443a5651..c3bbb8aafcd1a 100644 long vfs_truncate(const struct path *path, loff_t length) { diff --git a/fs/read_write.c b/fs/read_write.c -index 75f764b434184..7582bb3fb634b 100644 +index af057c57bdc64..76017f8331fbf 100644 --- a/fs/read_write.c +++ b/fs/read_write.c -@@ -503,6 +503,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) +@@ -492,6 +492,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) inc_syscr(current); return ret; } @@ -829,7 +829,7 @@ index 75f764b434184..7582bb3fb634b 100644 static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) { -@@ -613,6 +614,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ +@@ -602,6 +603,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ file_end_write(file); return ret; } @@ -838,10 +838,10 @@ index 75f764b434184..7582bb3fb634b 100644 /* 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 55b5356262085..c13ac0fbac318 100644 +index 3e6ba363b7775..7c1be373eb7cd 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, +@@ -766,6 +766,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); } @@ -849,7 +849,7 @@ index 55b5356262085..c13ac0fbac318 100644 /* * Attempt to initiate a splice from a file to a pipe. -@@ -787,6 +788,7 @@ long do_splice_to(struct file *in, loff_t *ppos, +@@ -795,6 +796,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); } @@ -870,10 +870,10 @@ index b7b5a0a0df6ff..fa5c7fba7f1ba 100644 /* * Write out and wait upon all dirty data associated with this diff --git a/fs/xattr.c b/fs/xattr.c -index fd57153b1f617..d8e9d0d6853ef 100644 +index 5c8c5175b385c..ff7e9ff774b73 100644 --- a/fs/xattr.c +++ b/fs/xattr.c -@@ -371,6 +371,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value, +@@ -384,6 +384,7 @@ vfs_getxattr_alloc(struct user_namespace *mnt_userns, struct dentry *dentry, *xattr_value = value; return error; } @@ -882,10 +882,10 @@ index fd57153b1f617..d8e9d0d6853ef 100644 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 5c3bff75de111..ff00031462623 100644 +index e0aaf34974df5..d7b737731d4ef 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c -@@ -209,6 +209,7 @@ inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock) +@@ -210,6 +210,7 @@ inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock) */ return lock_classes + class_idx; } @@ -894,19 +894,19 @@ index 5c3bff75de111..ff00031462623 100644 #ifdef CONFIG_LOCK_STAT diff --git a/kernel/task_work.c b/kernel/task_work.c -index 9cde961875c0a..ac8c79dc81813 100644 +index 1698fbe6f0e13..081b05acadf82 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c -@@ -143,3 +143,4 @@ void task_work_run(void) +@@ -167,3 +167,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 7b09cfbae94f7..3e060cc948262 100644 +index 9ffa9e9c5c554..83b533a3fb8e8 100644 --- a/security/security.c +++ b/security/security.c -@@ -1094,6 +1094,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry) +@@ -1147,6 +1147,7 @@ int security_path_rmdir(const struct path *dir, struct dentry *dentry) return 0; return call_int_hook(path_rmdir, 0, dir, dentry); } @@ -914,7 +914,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_path_unlink(const struct path *dir, struct dentry *dentry) { -@@ -1110,6 +1111,7 @@ int security_path_symlink(const struct path *dir, struct dentry *dentry, +@@ -1163,6 +1164,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); } @@ -922,7 +922,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_path_link(struct dentry *old_dentry, const struct path *new_dir, struct dentry *new_dentry) -@@ -1118,6 +1120,7 @@ int security_path_link(struct dentry *old_dentry, const struct path *new_dir, +@@ -1171,6 +1173,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); } @@ -930,7 +930,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_path_rename(const struct path *old_dir, struct dentry *old_dentry, const struct path *new_dir, struct dentry *new_dentry, -@@ -1145,6 +1148,7 @@ int security_path_truncate(const struct path *path) +@@ -1198,6 +1201,7 @@ int security_path_truncate(const struct path *path) return 0; return call_int_hook(path_truncate, 0, path); } @@ -938,7 +938,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_path_chmod(const struct path *path, umode_t mode) { -@@ -1152,6 +1156,7 @@ int security_path_chmod(const struct path *path, umode_t mode) +@@ -1205,6 +1209,7 @@ int security_path_chmod(const struct path *path, umode_t mode) return 0; return call_int_hook(path_chmod, 0, path, mode); } @@ -946,7 +946,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid) { -@@ -1159,6 +1164,7 @@ int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid) +@@ -1212,6 +1217,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); } @@ -954,7 +954,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_path_chroot(const struct path *path) { -@@ -1259,6 +1265,7 @@ int security_inode_permission(struct inode *inode, int mask) +@@ -1312,6 +1318,7 @@ int security_inode_permission(struct inode *inode, int mask) return 0; return call_int_hook(inode_permission, 0, inode, mask); } @@ -962,7 +962,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 int security_inode_setattr(struct dentry *dentry, struct iattr *attr) { -@@ -1451,6 +1458,7 @@ int security_file_permission(struct file *file, int mask) +@@ -1509,6 +1516,7 @@ int security_file_permission(struct file *file, int mask) return fsnotify_perm(file, mask); } @@ -972,7 +972,7 @@ index 7b09cfbae94f7..3e060cc948262 100644 { diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Documentation/ABI/testing/debugfs-aufs --- /usr/share/empty/Documentation/ABI/testing/debugfs-aufs 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/ABI/testing/debugfs-aufs 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/ABI/testing/debugfs-aufs 2021-11-01 23:48:34.199692595 +0100 @@ -0,0 +1,55 @@ +What: /debug/aufs/si_/ +Date: March 2009 @@ -1004,7 +1004,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document + When the aufs mount option 'noxino' is specified, it + will be empty. About XINO files, see the aufs manual. + -+What: /debug/aufs/si_/xi0, xi1 ... xiN and xiN-N ++What: /debug/aufs/si_/xi +Date: March 2009 +Contact: J. R. Okajima +Description: @@ -1031,7 +1031,7 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/debugfs-aufs linux/Document + will be empty. About XINO files, see the aufs manual. diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentation/ABI/testing/sysfs-aufs --- /usr/share/empty/Documentation/ABI/testing/sysfs-aufs 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/ABI/testing/sysfs-aufs 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/ABI/testing/sysfs-aufs 2021-11-01 23:48:34.199692595 +0100 @@ -0,0 +1,31 @@ +What: /sys/fs/aufs/si_/ +Date: March 2009 @@ -1041,14 +1041,14 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentat + per aufs mount, where is a unique id generated + internally. + -+What: /sys/fs/aufs/si_/br0, br1 ... brN ++What: /sys/fs/aufs/si_/br +Date: March 2009 +Contact: J. R. Okajima +Description: + It shows the abolute path of a member directory (which + is called branch) in aufs, and its permission. + -+What: /sys/fs/aufs/si_/brid0, brid1 ... bridN ++What: /sys/fs/aufs/si_/brid +Date: July 2013 +Contact: J. R. Okajima +Description: @@ -1066,10 +1066,10 @@ diff -urN /usr/share/empty/Documentation/ABI/testing/sysfs-aufs linux/Documentat + will be empty. About XINO files, see the aufs manual. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt linux/Documentation/filesystems/aufs/design/01intro.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/01intro.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/01intro.txt 2021-11-01 23:48:34.199692595 +0100 @@ -0,0 +1,171 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1241,10 +1241,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/01intro.txt lin +about it. But currently I have implemented it in kernel space. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt linux/Documentation/filesystems/aufs/design/02struct.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/02struct.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/02struct.txt 2021-11-01 23:48:34.199692595 +0100 @@ -0,0 +1,258 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1503,10 +1503,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/02struct.txt li +For this purpose, use "aumvdown" command in aufs-util.git. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.txt linux/Documentation/filesystems/aufs/design/03atomic_open.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/03atomic_open.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/03atomic_open.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,85 @@ + -+# Copyright (C) 2015-2020 Junjiro R. Okajima ++# Copyright (C) 2015-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1592,10 +1592,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03atomic_open.t + be implemented in aufs, but not all I am afraid. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt linux/Documentation/filesystems/aufs/design/03lookup.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/03lookup.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/03lookup.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,113 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1709,10 +1709,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/03lookup.txt li + by over-mounting something (or another method). diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt linux/Documentation/filesystems/aufs/design/04branch.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/04branch.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/04branch.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,74 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1787,10 +1787,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/04branch.txt li + same named entry on the upper branch. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt linux/Documentation/filesystems/aufs/design/05wbr_policy.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/05wbr_policy.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,64 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1855,7 +1855,7 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/05wbr_policy.tx + copyup policy. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.dot linux/Documentation/filesystems/aufs/design/06dirren.dot --- /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.dot 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/06dirren.dot 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/06dirren.dot 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,31 @@ + +// to view this graph, run dot(1) command in GRAPHVIZ. @@ -1890,10 +1890,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.dot li +} diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.txt linux/Documentation/filesystems/aufs/design/06dirren.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/06dirren.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/06dirren.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,102 @@ + -+# Copyright (C) 2017-2020 Junjiro R. Okajima ++# Copyright (C) 2017-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -1996,10 +1996,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06dirren.txt li +equivalen to udba=reval case. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt linux/Documentation/filesystems/aufs/design/06fhsm.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/06fhsm.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/06fhsm.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,120 @@ + -+# Copyright (C) 2011-2020 Junjiro R. Okajima ++# Copyright (C) 2011-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -2120,10 +2120,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06fhsm.txt linu +should restore the original file state after an error happens. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linux/Documentation/filesystems/aufs/design/06mmap.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/06mmap.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/06mmap.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,72 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -2196,10 +2196,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06mmap.txt linu +I have to give up this "looks-smater" approach. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt linux/Documentation/filesystems/aufs/design/06xattr.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/06xattr.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/06xattr.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,96 @@ + -+# Copyright (C) 2014-2020 Junjiro R. Okajima ++# Copyright (C) 2014-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -2296,10 +2296,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/06xattr.txt lin +now, aufs implements the branch attributes to ignore the error. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt linux/Documentation/filesystems/aufs/design/07export.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/07export.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/07export.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,58 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -2358,10 +2358,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/07export.txt li + lookup_one_len(), vfs_getattr(), encode_fh() and others. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linux/Documentation/filesystems/aufs/design/08shwh.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/08shwh.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/08shwh.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,52 @@ + -+# Copyright (C) 2005-2020 Junjiro R. Okajima ++# Copyright (C) 2005-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -2414,10 +2414,10 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/08shwh.txt linu +initramfs will use it to replace the old one at the next boot. diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt linux/Documentation/filesystems/aufs/design/10dynop.txt --- /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt 1970-01-01 01:00:00.000000000 +0100 -+++ linux/Documentation/filesystems/aufs/design/10dynop.txt 2021-02-24 13:33:42.737680181 +0100 ++++ linux/Documentation/filesystems/aufs/design/10dynop.txt 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,47 @@ + -+# Copyright (C) 2010-2020 Junjiro R. Okajima ++# Copyright (C) 2010-2021 Junjiro R. Okajima +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -2465,8 +2465,8 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/design/10dynop.txt lin +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 2021-02-24 13:33:42.737680181 +0100 -@@ -0,0 +1,401 @@ ++++ linux/Documentation/filesystems/aufs/README 2021-11-01 23:48:34.199692595 +0100 +@@ -0,0 +1,396 @@ + +Aufs5 -- advanced multi layered unification filesystem version 5.x +http://aufs.sf.net @@ -2651,6 +2651,16 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta +For aufs5-linux tree, +- enable CONFIG_AUFS_FS. +- set other aufs configurations if necessary. ++- for aufs5.13 and later ++ Because aufs is not only an ordinary filesystem (callee of VFS), but ++ also a caller of VFS functions for branch filesystems, subclassing of ++ the internal locks for LOCKDEP is necessary. LOCKDEP is a debugging ++ feature of linux kernel. If you enable CONFIG_LOCKDEP, then you will ++ need to customize some LOCKDEP numbers. Here are what I use on my ++ test environment. ++ CONFIG_LOCKDEP_BITS=21 ++ CONFIG_LOCKDEP_CHAINS_BITS=21 ++ CONFIG_LOCKDEP_STACK_TRACE_BITS=24 + +For aufs5-standalone tree, +There are several ways to build. @@ -2718,13 +2728,6 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta + Supports a nested loopback mount in a branch-fs. This patch is + unnecessary until aufs produces a message like "you may want to try + another patch for loopback file". -+- proc_mounts.patch -+ When there are many mountpoints and many mount(2)/umount(2) are -+ running, then /proc/mounts may not show the all mountpoints. This -+ patch makes /proc/mounts always show the full mountpoints list. -+ If you don't want to apply this patch and meet such problem, then you -+ need to increase the value of 'ProcMounts_Times' make-variable in -+ aufs-util.git as a second best solution. +- vfs-ino.patch + Modifies a system global kernel internal function get_next_ino() in + order to stop assigning 0 for an inode-number. Not directly related to @@ -2735,14 +2738,6 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta + duplication of inode number, which is important for backup tools and + other utilities. When you find aufs XINO files for tmpfs branch + growing too much, try this patch. -+- lockdep-debug.patch -+ Because aufs is not only an ordinary filesystem (callee of VFS), but -+ also a caller of VFS functions for branch filesystems, subclassing of -+ the internal locks for LOCKDEP is necessary. LOCKDEP is a debugging -+ feature of linux kernel. If you enable CONFIG_LOCKDEP, then you will -+ need to apply this debug patch to expand several constant values. -+ If you don't know what LOCKDEP is, then you don't have apply this -+ patch. + + +4. Usage @@ -2870,11 +2865,11 @@ diff -urN /usr/share/empty/Documentation/filesystems/aufs/README linux/Documenta +# End: ; diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h --- /usr/share/empty/fs/aufs/aufs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/aufs.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/aufs.h 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -2936,11 +2931,11 @@ diff -urN /usr/share/empty/fs/aufs/aufs.h linux/fs/aufs/aufs.h +#endif /* __AUFS_H__ */ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c --- /usr/share/empty/fs/aufs/branch.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/branch.c 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/branch.c 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,1427 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -4367,11 +4362,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.c linux/fs/aufs/branch.c +} diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h --- /usr/share/empty/fs/aufs/branch.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/branch.h 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,364 @@ ++++ linux/fs/aufs/branch.h 2021-11-01 23:48:34.203025928 +0100 +@@ -0,0 +1,375 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -4517,6 +4512,11 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h + return br->br_path.dentry; +} + ++static inline struct user_namespace *au_br_userns(struct au_branch *br) ++{ ++ return mnt_user_ns(br->br_path.mnt); ++} ++ +static inline struct super_block *au_br_sb(struct au_branch *br) +{ + return au_br_mnt(br)->mnt_sb; @@ -4676,6 +4676,12 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h +} + +static inline ++struct user_namespace *au_sbr_userns(struct super_block *sb, aufs_bindex_t bindex) ++{ ++ return au_br_userns(au_sbr(sb, bindex)); ++} ++ ++static inline +struct super_block *au_sbr_sb(struct super_block *sb, aufs_bindex_t bindex) +{ + return au_br_sb(au_sbr(sb, bindex)); @@ -4735,7 +4741,7 @@ diff -urN /usr/share/empty/fs/aufs/branch.h linux/fs/aufs/branch.h +#endif /* __AUFS_BRANCH_H__ */ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk --- /usr/share/empty/fs/aufs/conf.mk 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/conf.mk 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/conf.mk 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: GPL-2.0 + @@ -4779,11 +4785,11 @@ diff -urN /usr/share/empty/fs/aufs/conf.mk linux/fs/aufs/conf.mk +-include ${srctree}/${src}/conf_priv.mk diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c --- /usr/share/empty/fs/aufs/cpup.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/cpup.c 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,1445 @@ ++++ linux/fs/aufs/cpup.c 2021-11-01 23:48:34.203025928 +0100 +@@ -0,0 +1,1459 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -4947,7 +4953,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c +}; + +static noinline_for_stack -+int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src, ++int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct path *h_src, + struct au_cpup_reg_attr *h_src_attr) +{ + int err, sbits, icex; @@ -4959,11 +4965,11 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + struct kstat *h_st; + struct au_branch *br; + -+ h_path.dentry = au_h_dptr(dst, bindex); -+ h_idst = d_inode(h_path.dentry); + br = au_sbr(dst->d_sb, bindex); + h_path.mnt = au_br_mnt(br); -+ h_isrc = d_inode(h_src); ++ h_path.dentry = au_h_dptr(dst, bindex); ++ h_idst = d_inode(h_path.dentry); ++ h_isrc = d_inode(h_src->dentry); + ia.ia_valid = ATTR_FORCE | ATTR_UID | ATTR_GID + | ATTR_ATIME | ATTR_MTIME + | ATTR_ATIME_SET | ATTR_MTIME_SET; @@ -5007,7 +5013,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + if (!err) { + mnt_flags = au_mntflags(dst->d_sb); + verbose = !!au_opt_test(mnt_flags, VERBOSE); -+ err = au_cpup_xattr(h_path.dentry, h_src, icex, verbose); ++ err = au_cpup_xattr(&h_path, h_src, icex, verbose); + } + + return err; @@ -5377,16 +5383,18 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + int err; + struct dentry *h_dentry; + struct inode *h_inode; ++ struct user_namespace *h_userns; + ++ h_userns = mnt_user_ns(h_path->mnt); + h_dentry = h_path->dentry; + h_inode = d_inode(h_dentry); + /* forget_all_cached_acls(h_inode)); */ -+ err = vfsub_removexattr(h_dentry, XATTR_NAME_POSIX_ACL_ACCESS); ++ err = vfsub_removexattr(h_userns, h_dentry, XATTR_NAME_POSIX_ACL_ACCESS); + AuTraceErr(err); + if (err == -EOPNOTSUPP) + err = 0; + if (!err) -+ err = vfsub_acl_chmod(h_inode, mode); ++ err = vfsub_acl_chmod(h_userns, h_inode, mode); + + AuTraceErr(err); + return err; @@ -5397,8 +5405,11 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c +{ + int err; + struct inode *dir, *inode; ++ struct user_namespace *h_userns; + -+ err = vfsub_removexattr(h_path->dentry, XATTR_NAME_POSIX_ACL_DEFAULT); ++ h_userns = mnt_user_ns(h_path->mnt); ++ err = vfsub_removexattr(h_userns, h_path->dentry, ++ XATTR_NAME_POSIX_ACL_DEFAULT); + AuTraceErr(err); + if (err == -EOPNOTSUPP) + err = 0; @@ -5523,11 +5534,13 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c +{ + int err; + struct dentry *dentry, *h_dentry, *h_parent, *parent; ++ struct path h_ppath; + struct inode *h_dir; + aufs_bindex_t bdst; + + dentry = cpg->dentry; + bdst = cpg->bdst; ++ h_ppath.mnt = au_sbr_mnt(dentry->d_sb, bdst); + h_dentry = au_h_dptr(dentry, bdst); + if (!au_ftest_cpup(cpg->flags, OVERWRITE)) { + dget(h_dentry); @@ -5539,9 +5552,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + } else { + err = 0; + parent = dget_parent(dentry); -+ h_parent = au_h_dptr(parent, bdst); ++ h_ppath.dentry = au_h_dptr(parent, bdst); + dput(parent); -+ h_path->dentry = vfsub_lkup_one(&dentry->d_name, h_parent); ++ h_path->dentry = vfsub_lkup_one(&dentry->d_name, &h_ppath); + if (IS_ERR(h_path->dentry)) + err = PTR_ERR(h_path->dentry); + } @@ -5579,6 +5592,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + struct inode *dst_inode, *h_dir, *inode, *delegated, *src_inode; + struct super_block *sb; + struct au_branch *br; ++ struct path h_src_path; + /* to reduce stack size */ + struct { + struct au_dtime dt; @@ -5670,7 +5684,9 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + /* todo: necessary? */ + /* au_pin_hdir_unlock(cpg->pin); */ + -+ err = cpup_iattr(cpg->dentry, cpg->bdst, h_src, &a->h_src_attr); ++ h_src_path.dentry = h_src; ++ h_src_path.mnt = au_sbr_mnt(sb, cpg->bsrc); ++ err = cpup_iattr(cpg->dentry, cpg->bdst, &h_src_path, &a->h_src_attr); + if (unlikely(err)) { + /* todo: necessary? */ + /* au_pin_hdir_relock(cpg->pin); */ /* ignore an error */ @@ -5872,6 +5888,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + struct dentry *dentry, *parent; + struct file *h_file; + struct inode *h_dir; ++ struct user_namespace *h_userns; + + dentry = cpg->dentry; + h_file = NULL; @@ -5885,7 +5902,8 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + + parent = dget_parent(dentry); + h_dir = au_h_iptr(d_inode(parent), cpg->bdst); -+ if (!au_test_h_perm_sio(h_dir, MAY_EXEC | MAY_WRITE) ++ h_userns = au_sbr_userns(dentry->d_sb, cpg->bdst); ++ if (!au_test_h_perm_sio(h_userns, h_dir, MAY_EXEC | MAY_WRITE) + && !au_cpup_sio_test(cpg->pin, d_inode(dentry)->i_mode)) + err = au_cpup_simple(cpg); + else { @@ -6055,6 +6073,7 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + struct inode *dir, *h_dir, *h_tmpdir; + struct au_wbr *wbr; + struct au_pin wh_pin, *pin_orig; ++ struct user_namespace *h_userns; + + dentry = cpg->dentry; + bdst = cpg->bdst; @@ -6083,7 +6102,8 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c + cpg->pin = &wh_pin; + } + -+ if (!au_test_h_perm_sio(h_tmpdir, MAY_EXEC | MAY_WRITE) ++ h_userns = au_sbr_userns(dentry->d_sb, bdst); ++ if (!au_test_h_perm_sio(h_userns, h_tmpdir, MAY_EXEC | MAY_WRITE) + && !au_cpup_sio_test(cpg->pin, d_inode(dentry)->i_mode)) + err = au_cpup_wh(cpg, file); + else { @@ -6228,11 +6248,11 @@ diff -urN /usr/share/empty/fs/aufs/cpup.c linux/fs/aufs/cpup.c +} diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h --- /usr/share/empty/fs/aufs/cpup.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/cpup.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/cpup.h 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -6332,11 +6352,11 @@ diff -urN /usr/share/empty/fs/aufs/cpup.h linux/fs/aufs/cpup.h +#endif /* __AUFS_CPUP_H__ */ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c --- /usr/share/empty/fs/aufs/dbgaufs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dbgaufs.c 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dbgaufs.c 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,526 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -6862,11 +6882,11 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.c linux/fs/aufs/dbgaufs.c +} diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h --- /usr/share/empty/fs/aufs/dbgaufs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dbgaufs.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dbgaufs.h 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -6919,11 +6939,11 @@ diff -urN /usr/share/empty/fs/aufs/dbgaufs.h linux/fs/aufs/dbgaufs.h +#endif /* __DBGAUFS_H__ */ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c --- /usr/share/empty/fs/aufs/dcsub.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dcsub.c 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dcsub.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,225 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -7148,11 +7168,11 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.c linux/fs/aufs/dcsub.c +} diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h --- /usr/share/empty/fs/aufs/dcsub.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dcsub.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dcsub.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -7289,11 +7309,11 @@ diff -urN /usr/share/empty/fs/aufs/dcsub.h linux/fs/aufs/dcsub.h +#endif /* __AUFS_DCSUB_H__ */ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c --- /usr/share/empty/fs/aufs/debug.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/debug.c 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,441 @@ ++++ linux/fs/aufs/debug.c 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,444 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -7676,7 +7696,10 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c + AuDbgDentry(dentry); + AuDbgInode(inode); + au_debug_off(); -+ BUG(); ++ if (au_test_fuse(h_inode->i_sb)) ++ WARN_ON_ONCE(1); ++ else ++ BUG(); + } + } +} @@ -7734,11 +7757,11 @@ diff -urN /usr/share/empty/fs/aufs/debug.c linux/fs/aufs/debug.c +} diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h --- /usr/share/empty/fs/aufs/debug.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/debug.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/debug.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,226 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -7964,11 +7987,11 @@ diff -urN /usr/share/empty/fs/aufs/debug.h linux/fs/aufs/debug.h +#endif /* __AUFS_DEBUG_H__ */ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c --- /usr/share/empty/fs/aufs/dentry.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dentry.c 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,1154 @@ ++++ linux/fs/aufs/dentry.c 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,1169 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -8003,6 +8026,8 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + struct dentry *h_dentry; + struct inode *h_inode; + struct au_branch *br; ++ struct user_namespace *h_userns; ++ struct path h_path; + int wh_found, opq; + unsigned char wh_able; + const unsigned char allow_neg = !!au_ftest_lkup(args->flags, ALLOW_NEG); @@ -8011,9 +8036,13 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + + wh_found = 0; + 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); + wh_able = !!au_br_whable(br->br_perm); + if (wh_able) -+ wh_found = au_wh_test(h_parent, &args->whname, ignore_perm); ++ wh_found = au_wh_test(h_userns, &h_path, &args->whname, ++ ignore_perm); + h_dentry = ERR_PTR(wh_found); + if (!wh_found) + goto real_lookup; @@ -8028,9 +8057,9 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + +real_lookup: + if (!ignore_perm) -+ h_dentry = vfsub_lkup_one(args->name, h_parent); ++ h_dentry = vfsub_lkup_one(args->name, &h_path); + else -+ h_dentry = au_sio_lkup_one(args->name, h_parent); ++ h_dentry = au_sio_lkup_one(h_userns, args->name, &h_path); + if (IS_ERR(h_dentry)) { + if (PTR_ERR(h_dentry) == -ENAMETOOLONG + && !allow_neg) @@ -8064,8 +8093,9 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + || (d_really_is_positive(dentry) && !d_is_dir(dentry))) + goto out; /* success */ + ++ h_path.dentry = h_dentry; + inode_lock_shared_nested(h_inode, AuLsc_I_CHILD); -+ opq = au_diropq_test(h_dentry); ++ opq = au_diropq_test(h_userns, &h_path); + inode_unlock_shared(h_inode); + if (opq > 0) + au_set_dbdiropq(dentry, bindex); @@ -8210,18 +8240,19 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + return err; +} + -+struct dentry *au_sio_lkup_one(struct qstr *name, struct dentry *parent) ++struct dentry *au_sio_lkup_one(struct user_namespace *userns, struct qstr *name, ++ struct path *ppath) +{ + struct dentry *dentry; + int wkq_err; + -+ if (!au_test_h_perm_sio(d_inode(parent), MAY_EXEC)) -+ dentry = vfsub_lkup_one(name, parent); ++ if (!au_test_h_perm_sio(userns, d_inode(ppath->dentry), MAY_EXEC)) ++ dentry = vfsub_lkup_one(name, ppath); + else { + struct vfsub_lkup_one_args args = { + .errp = &dentry, + .name = name, -+ .parent = parent ++ .ppath = ppath + }; + + wkq_err = au_wkq_wait(vfsub_call_lkup_one, &args); @@ -8238,16 +8269,20 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c +int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex, int wh) +{ + int err; -+ struct dentry *parent, *h_parent, *h_dentry; ++ struct dentry *parent, *h_dentry; + struct au_branch *br; ++ struct user_namespace *h_userns; ++ struct path h_ppath; + + parent = dget_parent(dentry); -+ h_parent = au_h_dptr(parent, bindex); + 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); + if (wh) -+ h_dentry = au_whtmp_lkup(h_parent, br, &dentry->d_name); ++ h_dentry = au_whtmp_lkup(h_ppath.dentry, br, &dentry->d_name); + else -+ h_dentry = au_sio_lkup_one(&dentry->d_name, h_parent); ++ h_dentry = au_sio_lkup_one(h_userns, &dentry->d_name, &h_ppath); + err = PTR_ERR(h_dentry); + if (IS_ERR(h_dentry)) + goto out; @@ -8322,6 +8357,7 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + struct inode *h_inode; + struct dentry *h_d; + struct super_block *h_sb; ++ struct path h_ppath; + + err = 0; + memset(&ia, -1, sizeof(ia)); @@ -8336,7 +8372,9 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c + goto out; + + /* main purpose is namei.c:cached_lookup() and d_revalidate */ -+ h_d = vfsub_lkup_one(&h_dentry->d_name, h_parent); ++ h_ppath.dentry = h_parent; ++ h_ppath.mnt = au_br_mnt(br); ++ h_d = vfsub_lkup_one(&h_dentry->d_name, &h_ppath); + err = PTR_ERR(h_d); + if (IS_ERR(h_d)) + goto out; @@ -9122,11 +9160,11 @@ diff -urN /usr/share/empty/fs/aufs/dentry.c linux/fs/aufs/dentry.c +}; diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h --- /usr/share/empty/fs/aufs/dentry.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dentry.h 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,268 @@ ++++ linux/fs/aufs/dentry.h 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,269 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -9199,7 +9237,8 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h +/* dentry.c */ +extern const struct dentry_operations aufs_dop, aufs_dop_noreval; +struct au_branch; -+struct dentry *au_sio_lkup_one(struct qstr *name, struct dentry *parent); ++struct dentry *au_sio_lkup_one(struct user_namespace *userns, 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); + @@ -9394,11 +9433,11 @@ diff -urN /usr/share/empty/fs/aufs/dentry.h linux/fs/aufs/dentry.h +#endif /* __AUFS_DENTRY_H__ */ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c --- /usr/share/empty/fs/aufs/dinfo.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dinfo.c 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dinfo.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,554 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -9952,11 +9991,11 @@ diff -urN /usr/share/empty/fs/aufs/dinfo.c linux/fs/aufs/dinfo.c +} diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c --- /usr/share/empty/fs/aufs/dir.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dir.c 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,763 @@ ++++ linux/fs/aufs/dir.c 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,765 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -10593,12 +10632,14 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c + int err, wkq_err; + struct dentry *h_dentry; + struct inode *h_inode; ++ struct user_namespace *h_userns; + ++ h_userns = au_sbr_userns(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_inode, MAY_EXEC | MAY_READ); ++ err = au_test_h_perm_sio(h_userns, h_inode, MAY_EXEC | MAY_READ); + inode_unlock_shared(h_inode); + if (!err) + err = do_test_empty(dentry, arg); @@ -10719,11 +10760,11 @@ diff -urN /usr/share/empty/fs/aufs/dir.c linux/fs/aufs/dir.c +}; diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h --- /usr/share/empty/fs/aufs/dir.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dir.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dir.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,134 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -10857,11 +10898,11 @@ diff -urN /usr/share/empty/fs/aufs/dir.h linux/fs/aufs/dir.h +#endif /* __AUFS_DIR_H__ */ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c --- /usr/share/empty/fs/aufs/dirren.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dirren.c 2021-02-24 13:33:42.741013619 +0100 -@@ -0,0 +1,1316 @@ ++++ linux/fs/aufs/dirren.c 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,1315 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2017-2020 Junjiro R. Okajima ++ * Copyright (C) 2017-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -11124,7 +11165,8 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c + dir = d_inode(path->dentry); + inode_lock_nested(dir, AuLsc_I_CHILD); + } -+ hinopath.dentry = vfsub_lkup_one(&hinoname, path->dentry); ++ hinopath.mnt = path->mnt; ++ hinopath.dentry = vfsub_lkup_one(&hinoname, (struct path *)path); + err = PTR_ERR(hinopath.dentry); + if (IS_ERR(hinopath.dentry)) + goto out_unlock; @@ -11158,7 +11200,6 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c + } + flags = O_WRONLY; + } -+ hinopath.mnt = path->mnt; + hinofile = vfsub_dentry_open(&hinopath, flags); + if (suspend) + au_hn_inode_unlock(hdir); @@ -11480,7 +11521,7 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c + AuDebugOn(elm + && memcmp(elm, page_address(ZERO_PAGE(0)), sizeof(*elm))); + -+ infopath.dentry = vfsub_lookup_one_len(w->whname, w->h_ppath.dentry, ++ infopath.dentry = vfsub_lookup_one_len(w->whname, &w->h_ppath, + w->whnamelen); + AuTraceErrPtr(infopath.dentry); + if (IS_ERR(infopath.dentry)) { @@ -11864,8 +11905,7 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c + unlocked = 0; + h_dir = d_inode(h_ppath->dentry); + inode_lock_shared_nested(h_dir, AuLsc_I_PARENT); -+ infopath.dentry = vfsub_lookup_one_len(whname, h_ppath->dentry, -+ whnamelen); ++ infopath.dentry = vfsub_lookup_one_len(whname, h_ppath, whnamelen); + if (IS_ERR(infopath.dentry)) { + drinfo = (void *)infopath.dentry; + goto out; @@ -12177,11 +12217,11 @@ diff -urN /usr/share/empty/fs/aufs/dirren.c linux/fs/aufs/dirren.c +} diff -urN /usr/share/empty/fs/aufs/dirren.h linux/fs/aufs/dirren.h --- /usr/share/empty/fs/aufs/dirren.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dirren.h 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/dirren.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,140 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2017-2020 Junjiro R. Okajima ++ * Copyright (C) 2017-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -12321,11 +12361,11 @@ diff -urN /usr/share/empty/fs/aufs/dirren.h linux/fs/aufs/dirren.h +#endif /* __AUFS_DIRREN_H__ */ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c --- /usr/share/empty/fs/aufs/dynop.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dynop.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/dynop.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2010-2020 Junjiro R. Okajima ++ * Copyright (C) 2010-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -12693,11 +12733,11 @@ diff -urN /usr/share/empty/fs/aufs/dynop.c linux/fs/aufs/dynop.c +} diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h --- /usr/share/empty/fs/aufs/dynop.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/dynop.h 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/dynop.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2010-2020 Junjiro R. Okajima ++ * Copyright (C) 2010-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -12774,11 +12814,11 @@ diff -urN /usr/share/empty/fs/aufs/dynop.h linux/fs/aufs/dynop.h +#endif /* __AUFS_DYNOP_H__ */ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c --- /usr/share/empty/fs/aufs/export.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/export.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,837 @@ ++++ linux/fs/aufs/export.c 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,831 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -13184,7 +13224,7 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c + + /* do not call vfsub_lkup_one() */ + dir = d_inode(parent); -+ dentry = vfsub_lookup_one_len_unlocked(arg.name, parent, arg.namelen); ++ dentry = vfsub_lookup_one_len_unlocked(arg.name, path, arg.namelen); + AuTraceErrPtr(dentry); + if (IS_ERR(dentry)) + goto out_name; @@ -13572,14 +13612,8 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c + f = h_inode->i_sb->s_export_op->commit_metadata; + if (f) + err = f(h_inode); -+ else { -+ struct writeback_control wbc = { -+ .sync_mode = WB_SYNC_ALL, -+ .nr_to_write = 0 /* metadata only */ -+ }; -+ -+ err = sync_inode(h_inode, &wbc); -+ } ++ else ++ err = sync_inode_metadata(h_inode, /*wait*/1); + + au_cpup_attr_timesizes(inode); + ii_write_unlock(inode); @@ -13615,11 +13649,11 @@ diff -urN /usr/share/empty/fs/aufs/export.c linux/fs/aufs/export.c +} diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c --- /usr/share/empty/fs/aufs/fhsm.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/fhsm.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/fhsm.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,427 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2011-2020 Junjiro R. Okajima ++ * Copyright (C) 2011-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -14046,11 +14080,11 @@ diff -urN /usr/share/empty/fs/aufs/fhsm.c linux/fs/aufs/fhsm.c +} diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c --- /usr/share/empty/fs/aufs/file.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/file.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/file.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,863 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -14913,11 +14947,11 @@ diff -urN /usr/share/empty/fs/aufs/file.c linux/fs/aufs/file.c +}; diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h --- /usr/share/empty/fs/aufs/file.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/file.h 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/file.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,342 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -15259,11 +15293,11 @@ diff -urN /usr/share/empty/fs/aufs/file.h linux/fs/aufs/file.h +#endif /* __AUFS_FILE_H__ */ diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c --- /usr/share/empty/fs/aufs/finfo.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/finfo.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/finfo.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -15412,11 +15446,11 @@ diff -urN /usr/share/empty/fs/aufs/finfo.c linux/fs/aufs/finfo.c +} diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c --- /usr/share/empty/fs/aufs/f_op.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/f_op.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,762 @@ ++++ linux/fs/aufs/f_op.c 2021-11-01 23:48:34.206359262 +0100 +@@ -0,0 +1,771 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -15775,6 +15809,15 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c + return err; +} + ++/* ++ * We may be able to remove aufs_splice_{read,write}() since almost all FSes ++ * don't have their own .splice_{read,write} implimentations, and they use ++ * generic_file_splice_read() and iter_file_splice_write() who can act like the ++ * simple converters to f_op->iter_read() and ->iter_write(). ++ * But we keep our own implementations because some non-mainlined FSes may have ++ * their own .splice_{read,write} implimentations and aufs doesn't want to take ++ * away an opportunity to co-work with aufs from them. ++ */ +static ssize_t aufs_splice_read(struct file *file, loff_t *ppos, + struct pipe_inode_info *pipe, size_t len, + unsigned int flags) @@ -16178,11 +16221,11 @@ diff -urN /usr/share/empty/fs/aufs/f_op.c linux/fs/aufs/f_op.c +}; diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h --- /usr/share/empty/fs/aufs/fstype.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/fstype.h 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/fstype.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,401 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -16583,11 +16626,11 @@ diff -urN /usr/share/empty/fs/aufs/fstype.h linux/fs/aufs/fstype.h +#endif /* __AUFS_FSTYPE_H__ */ diff -urN /usr/share/empty/fs/aufs/hbl.h linux/fs/aufs/hbl.h --- /usr/share/empty/fs/aufs/hbl.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/hbl.h 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/hbl.h 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2017-2020 Junjiro R. Okajima ++ * Copyright (C) 2017-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -16652,11 +16695,11 @@ diff -urN /usr/share/empty/fs/aufs/hbl.h linux/fs/aufs/hbl.h +#endif /* __AUFS_HBL_H__ */ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c --- /usr/share/empty/fs/aufs/hfsnotify.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/hfsnotify.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/hfsnotify.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,288 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -16944,11 +16987,11 @@ diff -urN /usr/share/empty/fs/aufs/hfsnotify.c linux/fs/aufs/hfsnotify.c +}; diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c --- /usr/share/empty/fs/aufs/hfsplus.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/hfsplus.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/hfsplus.c 2021-11-01 23:48:34.206359262 +0100 @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2010-2020 Junjiro R. Okajima ++ * Copyright (C) 2010-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -17008,11 +17051,11 @@ diff -urN /usr/share/empty/fs/aufs/hfsplus.c linux/fs/aufs/hfsplus.c +} diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c --- /usr/share/empty/fs/aufs/hnotify.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/hnotify.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/hnotify.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,715 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -17727,11 +17770,11 @@ diff -urN /usr/share/empty/fs/aufs/hnotify.c linux/fs/aufs/hnotify.c +} diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c --- /usr/share/empty/fs/aufs/iinfo.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/iinfo.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/iinfo.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,286 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -18017,11 +18060,11 @@ diff -urN /usr/share/empty/fs/aufs/iinfo.c linux/fs/aufs/iinfo.c +} diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c --- /usr/share/empty/fs/aufs/inode.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/inode.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,529 @@ ++++ linux/fs/aufs/inode.c 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,531 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -18533,28 +18576,30 @@ diff -urN /usr/share/empty/fs/aufs/inode.c linux/fs/aufs/inode.c + return err; +} + -+int au_test_h_perm(struct inode *h_inode, int mask) ++int au_test_h_perm(struct user_namespace *h_userns, struct inode *h_inode, ++ int mask) +{ + if (uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) + return 0; -+ return inode_permission(h_inode, mask); ++ return inode_permission(h_userns, h_inode, mask); +} + -+int au_test_h_perm_sio(struct inode *h_inode, int mask) ++int au_test_h_perm_sio(struct user_namespace *h_userns, 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_inode, mask); ++ return au_test_h_perm(h_userns, 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 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,698 @@ ++++ linux/fs/aufs/inode.h 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,705 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -18691,8 +18736,10 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h +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 inode *h_inode, int mask); -+int au_test_h_perm_sio(struct inode *h_inode, int mask); ++int au_test_h_perm(struct user_namespace *h_userns, struct inode *h_inode, ++ int mask); ++int au_test_h_perm_sio(struct user_namespace *h_userns, struct inode *h_inode, ++ int mask); + +static inline int au_wh_ino(struct super_block *sb, aufs_bindex_t bindex, + ino_t h_ino, unsigned int d_type, ino_t *ino) @@ -18767,18 +18814,21 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h +/* 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 inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t dev); -+int aufs_symlink(struct inode *dir, struct dentry *dentry, const char *symname); -+int aufs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ bool want_excl); ++int aufs_mknod(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode, dev_t dev); ++int aufs_symlink(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, const char *symname); ++int aufs_create(struct user_namespace *userns, 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 inode *dir, struct dentry *dentry, umode_t mode); ++int aufs_tmpfile(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode); +int aufs_link(struct dentry *src_dentry, struct inode *dir, + struct dentry *dentry); -+int aufs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); ++int aufs_mkdir(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode); + +/* i_op_del.c */ +int au_wr_dir_need_wh(struct dentry *dentry, int isdir, aufs_bindex_t *bcpup); @@ -18789,9 +18839,10 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h + +/* i_op_ren.c */ +int au_wbr(struct dentry *dentry, aufs_bindex_t btgt); -+int aufs_rename(struct inode *src_dir, struct dentry *src_dentry, -+ struct inode *dir, struct dentry *dentry, -+ unsigned int flags); ++int aufs_rename(struct user_namespace *userns, ++ struct inode *_src_dir, struct dentry *_src_dentry, ++ struct inode *_dst_dir, struct dentry *_dst_dentry, ++ unsigned int _flags); + +/* iinfo.c */ +struct inode *au_h_iptr(struct inode *inode, aufs_bindex_t bindex); @@ -18861,19 +18912,20 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h + +#ifdef CONFIG_AUFS_XATTR +/* xattr.c */ -+int au_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, int ignore_flags, ++int au_cpup_xattr(struct path *h_dst, struct path *h_src, int ignore_flags, + unsigned int verbose); +ssize_t aufs_listxattr(struct dentry *dentry, char *list, size_t size); +void au_xattr_init(struct super_block *sb); +#else -+AuStubInt0(au_cpup_xattr, struct dentry *h_dst, struct dentry *h_src, ++AuStubInt0(au_cpup_xattr, struct path *h_dst, struct path *h_src, + int ignore_flags, unsigned int verbose); +AuStubVoid(au_xattr_init, struct super_block *sb); +#endif + +#ifdef CONFIG_FS_POSIX_ACL -+struct posix_acl *aufs_get_acl(struct inode *inode, int type); -+int aufs_set_acl(struct inode *inode, struct posix_acl *acl, int type); ++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 *acl, int type); +#endif + +#if IS_ENABLED(CONFIG_AUFS_XATTR) || IS_ENABLED(CONFIG_FS_POSIX_ACL) @@ -19252,11 +19304,11 @@ diff -urN /usr/share/empty/fs/aufs/inode.h linux/fs/aufs/inode.h +#endif /* __AUFS_INODE_H__ */ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c --- /usr/share/empty/fs/aufs/ioctl.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/ioctl.c 2021-02-24 13:33:42.744347058 +0100 ++++ linux/fs/aufs/ioctl.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,220 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -19476,11 +19528,11 @@ diff -urN /usr/share/empty/fs/aufs/ioctl.c linux/fs/aufs/ioctl.c +#endif diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c --- /usr/share/empty/fs/aufs/i_op_add.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/i_op_add.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,936 @@ ++++ linux/fs/aufs/i_op_add.c 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,941 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -19846,8 +19898,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + return err; +} + -+int aufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t dev) ++int aufs_mknod(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode, dev_t dev) +{ + struct simple_arg arg = { + .type = Mknod, @@ -19859,7 +19911,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + return add_simple(dir, dentry, &arg); +} + -+int aufs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) ++int aufs_symlink(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, const char *symname) +{ + struct simple_arg arg = { + .type = Symlink, @@ -19868,8 +19921,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + return add_simple(dir, dentry, &arg); +} + -+int aufs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ bool want_excl) ++int aufs_create(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode, bool want_excl) +{ + struct simple_arg arg = { + .type = Creat, @@ -19896,7 +19949,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + return add_simple(dir, dentry, &arg); +} + -+int aufs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) ++int aufs_tmpfile(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode) +{ + int err; + aufs_bindex_t bindex; @@ -19904,6 +19958,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + struct dentry *parent, *h_parent, *h_dentry; + struct inode *h_dir, *inode; + struct vfsmount *h_mnt; ++ struct user_namespace *h_userns; + struct au_wr_dir_args wr_dir_args = { + .force_btgt = -1, + .flags = AuWrDir_TMPFILE @@ -19950,8 +20005,9 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + 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_parent, mode, /*open_flag*/0); ++ h_dentry = vfs_tmpfile(h_userns, h_parent, mode, /*open_flag*/0); + if (IS_ERR(h_dentry)) { + err = PTR_ERR(h_dentry); + goto out_mnt; @@ -20307,7 +20363,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c + return err; +} + -+int aufs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ++int aufs_mkdir(struct user_namespace *userns, struct inode *dir, ++ struct dentry *dentry, umode_t mode) +{ + int err, rerr; + aufs_bindex_t bindex; @@ -20416,11 +20473,11 @@ diff -urN /usr/share/empty/fs/aufs/i_op_add.c linux/fs/aufs/i_op_add.c +} diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c --- /usr/share/empty/fs/aufs/i_op.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/i_op.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,1502 @@ ++++ linux/fs/aufs/i_op.c 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,1513 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -20452,6 +20509,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c +{ + int err; + const unsigned char write_mask = !!(mask & (MAY_WRITE | MAY_APPEND)); ++ struct user_namespace *h_userns; + + err = -EPERM; + if (write_mask && IS_IMMUTABLE(h_inode)) @@ -20471,19 +20529,21 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + * - 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); + 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_inode, mask); ++ err = generic_permission(h_userns, h_inode, mask); + if (err == -EOPNOTSUPP && au_test_nfs_noacl(h_inode)) -+ err = h_inode->i_op->permission(h_inode, mask); ++ err = h_inode->i_op->permission(h_userns, h_inode, ++ mask); + AuTraceErr(err); + } else { + /* AuLabel(h_inode->permission); */ -+ err = h_inode->i_op->permission(h_inode, mask); ++ err = h_inode->i_op->permission(h_userns, h_inode, mask); + AuTraceErr(err); + } + @@ -20496,7 +20556,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + return err; +} + -+static int aufs_permission(struct inode *inode, int mask) ++static int aufs_permission(struct user_namespace *userns, struct inode *inode, ++ int mask) +{ + int err; + aufs_bindex_t bindex, bbot; @@ -21344,18 +21405,20 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + return err; +} + -+static int aufs_setattr(struct dentry *dentry, struct iattr *ia) ++static int aufs_setattr(struct user_namespace *userns, struct dentry *dentry, ++ struct iattr *ia) +{ + int err; + struct inode *inode, *delegated; + struct super_block *sb; + struct file *file; + struct au_icpup_args *a; ++ struct user_namespace *h_userns; + + inode = d_inode(dentry); + IMustLock(inode); + -+ err = setattr_prepare(dentry, ia); ++ err = setattr_prepare(userns, dentry, ia); + if (unlikely(err)) + goto out; + @@ -21448,8 +21511,10 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + * regardless aufs 'acl' option setting. + * why don't all acl-aware fs call this func from their ->setattr()? + */ -+ if (!err && (ia->ia_valid & ATTR_MODE)) -+ err = vfsub_acl_chmod(a->h_inode, ia->ia_mode); ++ 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); ++ } + if (!err) + au_cpup_attr_changeable(inode); + @@ -21511,6 +21576,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + struct super_block *sb; + struct au_icpup_args *a; + struct inode *h_inode; ++ struct user_namespace *h_userns; + + IMustLock(inode); + @@ -21529,23 +21595,25 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + 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); + + inode_unlock(a->h_inode); + switch (arg->type) { + case AU_XATTR_SET: + AuDebugOn(d_is_negative(h_path.dentry)); -+ err = vfsub_setxattr(h_path.dentry, ++ err = vfsub_setxattr(h_userns, h_path.dentry, + arg->u.set.name, arg->u.set.value, + arg->u.set.size, arg->u.set.flags); + break; + case AU_ACL_SET: + err = -EOPNOTSUPP; + h_inode = d_inode(h_path.dentry); -+ if (h_inode->i_op->set_acl) ++ if (h_inode->i_op->set_acl) { + /* this will call posix_acl_update_mode */ -+ err = h_inode->i_op->set_acl(h_inode, ++ err = h_inode->i_op->set_acl(h_userns, h_inode, + arg->u.acl_set.acl, + arg->u.acl_set.type); ++ } + break; + } + if (!err) @@ -21676,8 +21744,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + return err; +} + -+static int aufs_getattr(const struct path *path, struct kstat *st, -+ u32 request, unsigned int query) ++static int aufs_getattr(struct user_namespace *userns, const struct path *path, ++ struct kstat *st, u32 request, unsigned int query) +{ + int err; + unsigned char positive; @@ -21714,7 +21782,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c + goto out_di; + +out_fill: -+ generic_fillattr(inode, st); ++ generic_fillattr(userns, inode, st); +out_di: + di_read_unlock(dentry, AuLock_IR); +out_si: @@ -21922,11 +21990,11 @@ diff -urN /usr/share/empty/fs/aufs/i_op.c linux/fs/aufs/i_op.c +}; diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c --- /usr/share/empty/fs/aufs/i_op_del.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/i_op_del.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,513 @@ ++++ linux/fs/aufs/i_op_del.c 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,522 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -22020,6 +22088,10 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c + umode_t h_mode; + struct dentry *h_dentry, *h_latest; + struct inode *h_inode; ++ struct path h_ppath; ++ struct super_block *sb; ++ struct au_branch *br; ++ struct user_namespace *h_userns; + + h_dentry = au_h_dptr(dentry, bindex); + if (d_really_is_positive(dentry)) { @@ -22057,12 +22129,17 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c + * let's try heavy test. + */ + err = -EACCES; -+ if (unlikely(!au_opt_test(au_mntflags(dentry->d_sb), DIRPERM1) -+ && au_test_h_perm(d_inode(h_parent), ++ sb = dentry->d_sb; ++ br = au_sbr(sb, bindex); ++ h_userns = au_br_userns(br); ++ if (unlikely(!au_opt_test(au_mntflags(sb), DIRPERM1) ++ && au_test_h_perm(h_userns, d_inode(h_parent), + MAY_EXEC | MAY_WRITE))) + goto out; + -+ h_latest = au_sio_lkup_one(&dentry->d_name, h_parent); ++ 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); + err = -EIO; + if (IS_ERR(h_latest)) + goto out; @@ -22439,11 +22516,11 @@ diff -urN /usr/share/empty/fs/aufs/i_op_del.c linux/fs/aufs/i_op_del.c +} diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c --- /usr/share/empty/fs/aufs/i_op_ren.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/i_op_ren.c 2021-02-24 13:33:42.744347058 +0100 -@@ -0,0 +1,1250 @@ ++++ linux/fs/aufs/i_op_ren.c 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,1257 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -22593,9 +22670,12 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c +{ + int rerr; + struct inode *delegated; ++ struct path h_ppath = { ++ .dentry = a->src_h_parent, ++ .mnt = a->h_path.mnt ++ }; + -+ a->h_path.dentry = vfsub_lkup_one(&a->src_dentry->d_name, -+ a->src_h_parent); ++ a->h_path.dentry = vfsub_lkup_one(&a->src_dentry->d_name, &h_ppath); + rerr = PTR_ERR(a->h_path.dentry); + if (IS_ERR(a->h_path.dentry)) { + RevertFailure("lkup one %pd", a->src_dentry); @@ -22622,9 +22702,12 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c +{ + int rerr; + struct inode *delegated; ++ struct path h_ppath = { ++ .dentry = a->dst_h_parent, ++ .mnt = a->h_path.mnt ++ }; + -+ a->h_path.dentry = vfsub_lkup_one(&a->dst_dentry->d_name, -+ a->dst_h_parent); ++ a->h_path.dentry = vfsub_lkup_one(&a->dst_dentry->d_name, &h_ppath); + rerr = PTR_ERR(a->h_path.dentry); + if (IS_ERR(a->h_path.dentry)) { + RevertFailure("lkup one %pd", a->dst_dentry); @@ -23396,7 +23479,8 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c + +/* ---------------------------------------------------------------------- */ + -+int aufs_rename(struct inode *_src_dir, struct dentry *_src_dentry, ++int aufs_rename(struct user_namespace *userns, ++ struct inode *_src_dir, struct dentry *_src_dentry, + struct inode *_dst_dir, struct dentry *_dst_dentry, + unsigned int _flags) +{ @@ -23693,7 +23777,7 @@ diff -urN /usr/share/empty/fs/aufs/i_op_ren.c linux/fs/aufs/i_op_ren.c +} diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig --- /usr/share/empty/fs/aufs/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/Kconfig 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/Kconfig 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,199 @@ +# SPDX-License-Identifier: GPL-2.0 +config AUFS_FS @@ -23896,11 +23980,11 @@ diff -urN /usr/share/empty/fs/aufs/Kconfig linux/fs/aufs/Kconfig +endif diff -urN /usr/share/empty/fs/aufs/lcnt.h linux/fs/aufs/lcnt.h --- /usr/share/empty/fs/aufs/lcnt.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/lcnt.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/lcnt.h 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,186 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2018-2020 Junjiro R. Okajima ++ * Copyright (C) 2018-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -24086,11 +24170,11 @@ diff -urN /usr/share/empty/fs/aufs/lcnt.h linux/fs/aufs/lcnt.h +#endif /* __AUFS_LCNT_H__ */ diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c --- /usr/share/empty/fs/aufs/loop.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/loop.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/loop.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -24238,11 +24322,11 @@ diff -urN /usr/share/empty/fs/aufs/loop.c linux/fs/aufs/loop.c +} diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h --- /usr/share/empty/fs/aufs/loop.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/loop.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/loop.h 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -24297,7 +24381,7 @@ diff -urN /usr/share/empty/fs/aufs/loop.h linux/fs/aufs/loop.h +#endif /* __AUFS_LOOP_H__ */ diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk --- /usr/share/empty/fs/aufs/magic.mk 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/magic.mk 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/magic.mk 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0 + @@ -24332,7 +24416,7 @@ diff -urN /usr/share/empty/fs/aufs/magic.mk linux/fs/aufs/magic.mk +endif diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile --- /usr/share/empty/fs/aufs/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/Makefile 2021-02-24 13:33:42.741013619 +0100 ++++ linux/fs/aufs/Makefile 2021-11-01 23:48:34.203025928 +0100 @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-2.0 + @@ -24382,11 +24466,11 @@ diff -urN /usr/share/empty/fs/aufs/Makefile linux/fs/aufs/Makefile +aufs-$(CONFIG_AUFS_MAGIC_SYSRQ) += sysrq.o diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c --- /usr/share/empty/fs/aufs/module.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/module.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/module.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -24659,11 +24743,11 @@ diff -urN /usr/share/empty/fs/aufs/module.c linux/fs/aufs/module.c +module_exit(aufs_exit); diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h --- /usr/share/empty/fs/aufs/module.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/module.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/module.h 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,166 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -24760,7 +24844,7 @@ diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h +static inline int au_kmidx_sub(size_t sz, size_t new_sz) +{ +#ifndef CONFIG_SLOB -+ return kmalloc_index(sz) - kmalloc_index(new_sz); ++ return __kmalloc_index(sz, false) - __kmalloc_index(new_sz, false); +#else + return -1; /* SLOB is untested */ +#endif @@ -24829,11 +24913,11 @@ diff -urN /usr/share/empty/fs/aufs/module.h linux/fs/aufs/module.h +#endif /* __AUFS_MODULE_H__ */ diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c --- /usr/share/empty/fs/aufs/mvdown.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/mvdown.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/mvdown.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,706 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2011-2020 Junjiro R. Okajima ++ * Copyright (C) 2011-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -25539,11 +25623,11 @@ diff -urN /usr/share/empty/fs/aufs/mvdown.c linux/fs/aufs/mvdown.c +} diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c --- /usr/share/empty/fs/aufs/opts.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/opts.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/opts.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,1880 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -27423,11 +27507,11 @@ diff -urN /usr/share/empty/fs/aufs/opts.c linux/fs/aufs/opts.c +} diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h --- /usr/share/empty/fs/aufs/opts.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/opts.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/opts.h 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,225 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -27652,11 +27736,11 @@ diff -urN /usr/share/empty/fs/aufs/opts.h linux/fs/aufs/opts.h +#endif /* __AUFS_OPTS_H__ */ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c --- /usr/share/empty/fs/aufs/plink.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/plink.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/plink.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,516 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -27862,35 +27946,35 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c +struct au_do_plink_lkup_args { + struct dentry **errp; + struct qstr *tgtname; -+ struct dentry *h_parent; -+ struct au_branch *br; ++ struct path *h_ppath; +}; + +static struct dentry *au_do_plink_lkup(struct qstr *tgtname, -+ struct dentry *h_parent, -+ struct au_branch *br) ++ struct path *h_ppath) +{ + struct dentry *h_dentry; + struct inode *h_inode; + -+ h_inode = d_inode(h_parent); ++ h_inode = d_inode(h_ppath->dentry); + inode_lock_shared_nested(h_inode, AuLsc_I_CHILD2); -+ h_dentry = vfsub_lkup_one(tgtname, h_parent); ++ h_dentry = vfsub_lkup_one(tgtname, h_ppath); + inode_unlock_shared(h_inode); ++ + return h_dentry; +} + +static void au_call_do_plink_lkup(void *args) +{ + struct au_do_plink_lkup_args *a = args; -+ *a->errp = au_do_plink_lkup(a->tgtname, a->h_parent, a->br); ++ *a->errp = au_do_plink_lkup(a->tgtname, a->h_ppath); +} + +/* lookup the plink-ed @inode under the branch at @bindex */ +struct dentry *au_plink_lkup(struct inode *inode, aufs_bindex_t bindex) +{ -+ struct dentry *h_dentry, *h_parent; ++ struct dentry *h_dentry; + struct au_branch *br; ++ struct path h_ppath; + int wkq_err; + char a[PLINK_NAME_LEN]; + struct qstr tgtname = QSTR_INIT(a, 0); @@ -27898,40 +27982,39 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c + AuDebugOn(au_plink_maint(inode->i_sb, AuLock_NOPLM)); + + br = au_sbr(inode->i_sb, bindex); -+ h_parent = br->br_wbr->wbr_plink; ++ h_ppath.dentry = br->br_wbr->wbr_plink; ++ h_ppath.mnt = au_br_mnt(br); + tgtname.len = plink_name(a, sizeof(a), inode, bindex); + + if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) { + struct au_do_plink_lkup_args args = { + .errp = &h_dentry, + .tgtname = &tgtname, -+ .h_parent = h_parent, -+ .br = br ++ .h_ppath = &h_ppath + }; + + wkq_err = au_wkq_wait(au_call_do_plink_lkup, &args); + if (unlikely(wkq_err)) + h_dentry = ERR_PTR(wkq_err); + } else -+ h_dentry = au_do_plink_lkup(&tgtname, h_parent, br); ++ h_dentry = au_do_plink_lkup(&tgtname, &h_ppath); + + return h_dentry; +} + +/* create a pseudo-link */ -+static int do_whplink(struct qstr *tgt, struct dentry *h_parent, -+ struct dentry *h_dentry, struct au_branch *br) ++static int do_whplink(struct qstr *tgt, struct path *h_ppath, ++ struct dentry *h_dentry) +{ + int err; -+ struct path h_path = { -+ .mnt = au_br_mnt(br) -+ }; ++ struct path h_path; + struct inode *h_dir, *delegated; + -+ h_dir = d_inode(h_parent); ++ h_dir = d_inode(h_ppath->dentry); + inode_lock_nested(h_dir, AuLsc_I_CHILD2); ++ h_path.mnt = h_ppath->mnt; +again: -+ h_path.dentry = vfsub_lkup_one(tgt, h_parent); ++ h_path.dentry = vfsub_lkup_one(tgt, h_ppath); + err = PTR_ERR(h_path.dentry); + if (IS_ERR(h_path.dentry)) + goto out; @@ -27972,28 +28055,30 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c +struct do_whplink_args { + int *errp; + struct qstr *tgt; -+ struct dentry *h_parent; ++ struct path *h_ppath; + struct dentry *h_dentry; -+ struct au_branch *br; +}; + +static void call_do_whplink(void *args) +{ + struct do_whplink_args *a = args; -+ *a->errp = do_whplink(a->tgt, a->h_parent, a->h_dentry, a->br); ++ *a->errp = do_whplink(a->tgt, a->h_ppath, a->h_dentry); +} + +static int whplink(struct dentry *h_dentry, struct inode *inode, -+ aufs_bindex_t bindex, struct au_branch *br) ++ aufs_bindex_t bindex) +{ + int err, wkq_err; ++ struct au_branch *br; + struct au_wbr *wbr; -+ struct dentry *h_parent; ++ struct path h_ppath; + char a[PLINK_NAME_LEN]; + struct qstr tgtname = QSTR_INIT(a, 0); + -+ wbr = au_sbr(inode->i_sb, bindex)->br_wbr; -+ h_parent = wbr->wbr_plink; ++ br = au_sbr(inode->i_sb, bindex); ++ wbr = br->br_wbr; ++ h_ppath.dentry = wbr->wbr_plink; ++ h_ppath.mnt = au_br_mnt(br); + tgtname.len = plink_name(a, sizeof(a), inode, bindex); + + /* always superio. */ @@ -28001,15 +28086,14 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c + struct do_whplink_args args = { + .errp = &err, + .tgt = &tgtname, -+ .h_parent = h_parent, -+ .h_dentry = h_dentry, -+ .br = br ++ .h_ppath = &h_ppath, ++ .h_dentry = h_dentry + }; + wkq_err = au_wkq_wait(call_do_whplink, &args); + if (unlikely(wkq_err)) + err = wkq_err; + } else -+ err = do_whplink(&tgtname, h_parent, h_dentry, br); ++ err = do_whplink(&tgtname, &h_ppath, h_dentry); + + return err; +} @@ -28059,7 +28143,7 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c + if (cnt > AUFS_PLINK_WARN) + AuWarn1(msg ", %d\n", cnt); +#undef msg -+ err = whplink(h_dentry, inode, bindex, au_sbr(sb, bindex)); ++ err = whplink(h_dentry, inode, bindex); + if (unlikely(err)) { + pr_warn("err %d, damaged pseudo link.\n", err); + au_hbl_del(&icntnr->plink, hbl); @@ -28172,11 +28256,11 @@ diff -urN /usr/share/empty/fs/aufs/plink.c linux/fs/aufs/plink.c +} diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c --- /usr/share/empty/fs/aufs/poll.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/poll.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/poll.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -28227,11 +28311,11 @@ diff -urN /usr/share/empty/fs/aufs/poll.c linux/fs/aufs/poll.c +} 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 2021-02-24 13:33:42.747680497 +0100 -@@ -0,0 +1,105 @@ ++++ linux/fs/aufs/posix_acl.c 2021-11-01 23:48:34.209692595 +0100 +@@ -0,0 +1,111 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2014-2020 Junjiro R. Okajima ++ * Copyright (C) 2014-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -28254,7 +28338,7 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c +#include +#include "aufs.h" + -+struct posix_acl *aufs_get_acl(struct inode *inode, int type) ++struct posix_acl *aufs_get_acl(struct inode *inode, int type, bool rcu) +{ + struct posix_acl *acl; + int err; @@ -28262,12 +28346,16 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c + struct inode *h_inode; + struct super_block *sb; + ++ acl = ERR_PTR(-ECHILD); ++ if (rcu) ++ goto out; ++ + acl = NULL; + sb = inode->i_sb; + si_read_lock(sb, AuLock_FLUSH); + ii_read_lock_child(inode); + if (!(sb->s_flags & SB_POSIXACL)) -+ goto out; ++ goto unlock; + + bindex = au_ibtop(inode); + h_inode = au_h_iptr(inode, bindex); @@ -28276,7 +28364,7 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c + != (inode->i_mode & S_IFMT)))) { + err = au_busy_or_stale(); + acl = ERR_PTR(err); -+ goto out; ++ goto unlock; + } + + /* always topmost only */ @@ -28286,15 +28374,17 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c + else + set_cached_acl(inode, type, acl); + -+out: ++unlock: + ii_read_unlock(inode); + si_read_unlock(sb); + ++out: + AuTraceErrPtr(acl); + return acl; +} + -+int aufs_set_acl(struct inode *inode, struct posix_acl *acl, int type) ++int aufs_set_acl(struct user_namespace *userns, struct inode *inode, ++ struct posix_acl *acl, int type) +{ + int err; + ssize_t ssz; @@ -28336,11 +28426,11 @@ diff -urN /usr/share/empty/fs/aufs/posix_acl.c linux/fs/aufs/posix_acl.c +} diff -urN /usr/share/empty/fs/aufs/procfs.c linux/fs/aufs/procfs.c --- /usr/share/empty/fs/aufs/procfs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/procfs.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/procfs.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2010-2020 Junjiro R. Okajima ++ * Copyright (C) 2010-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -28510,11 +28600,11 @@ 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 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/rdu.c 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,384 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -28898,11 +28988,11 @@ diff -urN /usr/share/empty/fs/aufs/rdu.c linux/fs/aufs/rdu.c +#endif diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h --- /usr/share/empty/fs/aufs/rwsem.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/rwsem.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/rwsem.h 2021-11-01 23:48:34.209692595 +0100 @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -28987,11 +29077,11 @@ diff -urN /usr/share/empty/fs/aufs/rwsem.h linux/fs/aufs/rwsem.h +#endif /* __AUFS_RWSEM_H__ */ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c --- /usr/share/empty/fs/aufs/sbinfo.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/sbinfo.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/sbinfo.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,314 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -29305,11 +29395,11 @@ diff -urN /usr/share/empty/fs/aufs/sbinfo.c linux/fs/aufs/sbinfo.c +} diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c --- /usr/share/empty/fs/aufs/super.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/super.c 2021-02-24 13:33:42.747680497 +0100 -@@ -0,0 +1,1047 @@ ++++ linux/fs/aufs/super.c 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,1050 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -30348,7 +30438,10 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c +struct file_system_type aufs_fs_type = { + .name = AUFS_FSTYPE, + /* a race between rename and others */ -+ .fs_flags = FS_RENAME_DOES_D_MOVE, ++ .fs_flags = FS_RENAME_DOES_D_MOVE ++ /* untested */ ++ /*| FS_ALLOW_IDMAP*/ ++ , + .mount = aufs_mount, + .kill_sb = aufs_kill_sb, + /* no need to __module_get() and module_put(). */ @@ -30356,11 +30449,11 @@ diff -urN /usr/share/empty/fs/aufs/super.c linux/fs/aufs/super.c +}; diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h --- /usr/share/empty/fs/aufs/super.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/super.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/super.h 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,587 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -30947,11 +31040,11 @@ diff -urN /usr/share/empty/fs/aufs/super.h linux/fs/aufs/super.h +#endif /* __AUFS_SUPER_H__ */ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c --- /usr/share/empty/fs/aufs/sysaufs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/sysaufs.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/sysaufs.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -31044,11 +31137,11 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.c linux/fs/aufs/sysaufs.c +} diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h --- /usr/share/empty/fs/aufs/sysaufs.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/sysaufs.h 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/sysaufs.h 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,102 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -31150,11 +31243,11 @@ diff -urN /usr/share/empty/fs/aufs/sysaufs.h linux/fs/aufs/sysaufs.h +#endif /* __SYSAUFS_H__ */ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c --- /usr/share/empty/fs/aufs/sysfs.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/sysfs.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/sysfs.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,374 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -31528,11 +31621,11 @@ diff -urN /usr/share/empty/fs/aufs/sysfs.c linux/fs/aufs/sysfs.c +} diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c --- /usr/share/empty/fs/aufs/sysrq.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/sysrq.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/sysrq.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -31681,11 +31774,11 @@ diff -urN /usr/share/empty/fs/aufs/sysrq.c linux/fs/aufs/sysrq.c +} diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c --- /usr/share/empty/fs/aufs/vdir.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/vdir.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/vdir.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,896 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -32581,11 +32674,11 @@ diff -urN /usr/share/empty/fs/aufs/vdir.c linux/fs/aufs/vdir.c +} diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c --- /usr/share/empty/fs/aufs/vfsub.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/vfsub.c 2021-02-24 13:33:42.747680497 +0100 -@@ -0,0 +1,885 @@ ++++ linux/fs/aufs/vfsub.c 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,919 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -32643,6 +32736,11 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + struct kstat st; + struct super_block *h_sb; + ++ /* ++ * Always needs h_path->mnt for LSM or FUSE branch. ++ */ ++ AuDebugOn(!h_path->mnt); ++ + /* for remote fs, leave work for its getattr or d_revalidate */ + /* for bad i_attr fs, handle them in aufs_getattr() */ + /* still some fs may acquire i_mutex. we need to skip them */ @@ -32751,38 +32849,38 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +} + +struct dentry *vfsub_lookup_one_len_unlocked(const char *name, -+ struct dentry *parent, int len) ++ struct path *ppath, int len) +{ -+ struct path path = { -+ .mnt = NULL -+ }; ++ struct path path; + -+ path.dentry = lookup_one_len_unlocked(name, parent, len); ++ path.dentry = lookup_one_len_unlocked(name, ppath->dentry, len); + if (IS_ERR(path.dentry)) + goto out; -+ if (d_is_positive(path.dentry)) ++ if (d_is_positive(path.dentry)) { ++ path.mnt = ppath->mnt; + vfsub_update_h_iattr(&path, /*did*/NULL); /*ignore*/ ++ } + +out: + AuTraceErrPtr(path.dentry); + return path.dentry; +} + -+struct dentry *vfsub_lookup_one_len(const char *name, struct dentry *parent, ++struct dentry *vfsub_lookup_one_len(const char *name, struct path *ppath, + int len) +{ -+ struct path path = { -+ .mnt = NULL -+ }; ++ struct path path; + + /* VFS checks it too, but by WARN_ON_ONCE() */ -+ IMustLock(d_inode(parent)); ++ IMustLock(d_inode(ppath->dentry)); + -+ path.dentry = lookup_one_len(name, parent, len); ++ path.dentry = lookup_one_len(name, ppath->dentry, len); + if (IS_ERR(path.dentry)) + goto out; -+ if (d_is_positive(path.dentry)) ++ if (d_is_positive(path.dentry)) { ++ path.mnt = ppath->mnt; + vfsub_update_h_iattr(&path, /*did*/NULL); /*ignore*/ ++ } + +out: + AuTraceErrPtr(path.dentry); @@ -32792,7 +32890,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +void vfsub_call_lkup_one(void *args) +{ + struct vfsub_lkup_one_args *a = args; -+ *a->errp = vfsub_lkup_one(a->name, a->parent); ++ *a->errp = vfsub_lkup_one(a->name, a->ppath); +} + +/* ---------------------------------------------------------------------- */ @@ -32829,6 +32927,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + int err; + struct dentry *d; ++ struct user_namespace *userns; + + IMustLock(dir); + @@ -32838,9 +32937,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + path->dentry = d; + if (unlikely(err)) + goto out; ++ userns = mnt_user_ns(path->mnt); + + lockdep_off(); -+ err = vfs_create(dir, path->dentry, mode, want_excl); ++ err = vfs_create(userns, dir, path->dentry, mode, want_excl); + lockdep_on(); + if (!err) { + struct path tmp = *path; @@ -32862,6 +32962,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + int err; + struct dentry *d; ++ struct user_namespace *userns; + + IMustLock(dir); + @@ -32871,9 +32972,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + path->dentry = d; + if (unlikely(err)) + goto out; ++ userns = mnt_user_ns(path->mnt); + + lockdep_off(); -+ err = vfs_symlink(dir, path->dentry, symname); ++ err = vfs_symlink(userns, dir, path->dentry, symname); + lockdep_on(); + if (!err) { + struct path tmp = *path; @@ -32895,6 +32997,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + int err; + struct dentry *d; ++ struct user_namespace *userns; + + IMustLock(dir); + @@ -32904,9 +33007,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + path->dentry = d; + if (unlikely(err)) + goto out; ++ userns = mnt_user_ns(path->mnt); + + lockdep_off(); -+ err = vfs_mknod(dir, path->dentry, mode, dev); ++ err = vfs_mknod(userns, dir, path->dentry, mode, dev); + lockdep_on(); + if (!err) { + struct path tmp = *path; @@ -32939,6 +33043,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + int err; + struct dentry *d; ++ struct user_namespace *userns; + + IMustLock(dir); + @@ -32953,9 +33058,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + path->dentry = d; + if (unlikely(err)) + goto out; ++ userns = mnt_user_ns(path->mnt); + + lockdep_off(); -+ err = vfs_link(src_dentry, dir, path->dentry, delegated_inode); ++ err = vfs_link(src_dentry, userns, dir, path->dentry, delegated_inode); + lockdep_on(); + if (!err) { + struct path tmp = *path; @@ -32981,6 +33087,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + struct inode **delegated_inode, unsigned int flags) +{ + int err; ++ struct renamedata rd; + struct path tmp = { + .mnt = path->mnt + }; @@ -32997,9 +33104,16 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + if (unlikely(err)) + goto out; + ++ rd.old_mnt_userns = mnt_user_ns(path->mnt); ++ rd.old_dir = src_dir; ++ rd.old_dentry = src_dentry; ++ rd.new_mnt_userns = rd.old_mnt_userns; ++ rd.new_dir = dir; ++ rd.new_dentry = path->dentry; ++ rd.delegated_inode = delegated_inode; ++ rd.flags = flags; + lockdep_off(); -+ err = vfs_rename(src_dir, src_dentry, dir, path->dentry, -+ delegated_inode, flags); ++ err = vfs_rename(&rd); + lockdep_on(); + if (!err) { + int did; @@ -33023,6 +33137,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + int err; + struct dentry *d; ++ struct user_namespace *userns; + + IMustLock(dir); + @@ -33032,9 +33147,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + path->dentry = d; + if (unlikely(err)) + goto out; ++ userns = mnt_user_ns(path->mnt); + + lockdep_off(); -+ err = vfs_mkdir(dir, path->dentry, mode); ++ err = vfs_mkdir(userns, dir, path->dentry, mode); + lockdep_on(); + if (!err) { + struct path tmp = *path; @@ -33056,6 +33172,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + int err; + struct dentry *d; ++ struct user_namespace *userns; + + IMustLock(dir); + @@ -33065,9 +33182,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + path->dentry = d; + if (unlikely(err)) + goto out; ++ userns = mnt_user_ns(path->mnt); + + lockdep_off(); -+ err = vfs_rmdir(dir, path->dentry); ++ err = vfs_rmdir(userns, dir, path->dentry); + lockdep_on(); + if (!err) { + struct path tmp = { @@ -33225,6 +33343,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + int err; + struct inode *h_inode; + struct super_block *h_sb; ++ struct user_namespace *h_userns; + + if (!h_file) { + err = vfsub_truncate(h_path, length); @@ -33236,12 +33355,12 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + lockdep_off(); + sb_start_write(h_sb); + lockdep_on(); -+ err = locks_verify_truncate(h_inode, h_file, length); -+ if (!err) -+ err = security_path_truncate(h_path); ++ err = security_path_truncate(h_path); + if (!err) { ++ h_userns = mnt_user_ns(h_path->mnt); + lockdep_off(); -+ err = do_truncate(h_path->dentry, length, attr, h_file); ++ err = do_truncate(h_userns, h_path->dentry, length, attr, ++ h_file); + lockdep_on(); + } + lockdep_off(); @@ -33270,8 +33389,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +int vfsub_sio_mkdir(struct inode *dir, struct path *path, int mode) +{ + int err, do_sio, wkq_err; ++ struct user_namespace *userns; + -+ do_sio = au_test_h_perm_sio(dir, MAY_EXEC | MAY_WRITE); ++ userns = mnt_user_ns(path->mnt); ++ do_sio = au_test_h_perm_sio(userns, dir, MAY_EXEC | MAY_WRITE); + if (!do_sio) { + lockdep_off(); + err = vfsub_mkdir(dir, path, mode); @@ -33306,8 +33427,10 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +int vfsub_sio_rmdir(struct inode *dir, struct path *path) +{ + int err, do_sio, wkq_err; ++ struct user_namespace *userns; + -+ do_sio = au_test_h_perm_sio(dir, MAY_EXEC | MAY_WRITE); ++ userns = mnt_user_ns(path->mnt); ++ do_sio = au_test_h_perm_sio(userns, dir, MAY_EXEC | MAY_WRITE); + if (!do_sio) { + lockdep_off(); + err = vfsub_rmdir(dir, path); @@ -33339,14 +33462,16 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +{ + struct notify_change_args *a = args; + struct inode *h_inode; ++ struct user_namespace *userns; + + 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); + lockdep_off(); -+ *a->errp = notify_change(a->path->dentry, a->ia, ++ *a->errp = notify_change(userns, a->path->dentry, a->ia, + a->delegated_inode); + lockdep_on(); + if (!*a->errp) @@ -33403,6 +33528,7 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + struct unlink_args *a = args; + struct dentry *d = a->path->dentry; + struct inode *h_inode; ++ struct user_namespace *userns; + const int stop_sillyrename = (au_test_nfs(d->d_sb) + && au_dcount(d) == 1); + @@ -33422,8 +33548,9 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c + ihold(h_inode); + } + ++ userns = mnt_user_ns(a->path->mnt); + lockdep_off(); -+ *a->errp = vfs_unlink(a->dir, d, a->delegated_inode); ++ *a->errp = vfs_unlink(userns, a->dir, d, a->delegated_inode); + lockdep_on(); + if (!*a->errp) { + struct path tmp = { @@ -33470,11 +33597,11 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.c linux/fs/aufs/vfsub.c +} diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h --- /usr/share/empty/fs/aufs/vfsub.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/vfsub.h 2021-02-24 13:33:42.747680497 +0100 -@@ -0,0 +1,354 @@ ++++ linux/fs/aufs/vfsub.h 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,358 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -33577,20 +33704,20 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h +int vfsub_kern_path(const char *name, unsigned int flags, struct path *path); + +struct dentry *vfsub_lookup_one_len_unlocked(const char *name, -+ struct dentry *parent, int len); -+struct dentry *vfsub_lookup_one_len(const char *name, struct dentry *parent, ++ struct path *ppath, int len); ++struct dentry *vfsub_lookup_one_len(const char *name, struct path *ppath, + int len); + +struct vfsub_lkup_one_args { + struct dentry **errp; + struct qstr *name; -+ struct dentry *parent; ++ struct path *ppath; +}; + +static inline struct dentry *vfsub_lkup_one(struct qstr *name, -+ struct dentry *parent) ++ struct path *ppath) +{ -+ return vfsub_lookup_one_len(name->name, parent, name->len); ++ return vfsub_lookup_one_len(name->name, ppath, name->len); +} + +void vfsub_call_lkup_one(void *args); @@ -33708,17 +33835,19 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h +} + +#ifdef CONFIG_FS_POSIX_ACL -+static inline int vfsub_acl_chmod(struct inode *h_inode, umode_t h_mode) ++static inline int vfsub_acl_chmod(struct user_namespace *h_userns, ++ struct inode *h_inode, umode_t h_mode) +{ + int err; + -+ err = posix_acl_chmod(h_inode, h_mode); ++ err = posix_acl_chmod(h_userns, h_inode, h_mode); + if (err == -EOPNOTSUPP) + err = 0; + return err; +} +#else -+AuStubInt0(vfsub_acl_chmod, struct inode *h_inode, umode_t h_mode); ++AuStubInt0(vfsub_acl_chmod, struct user_namespace *h_userns, ++ struct inode *h_inode, umode_t h_mode); +#endif + +long vfsub_splice_to(struct file *in, loff_t *ppos, @@ -33801,24 +33930,26 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h + +/* ---------------------------------------------------------------------- */ + -+static inline int vfsub_setxattr(struct dentry *dentry, const char *name, ++static inline int vfsub_setxattr(struct user_namespace *userns, ++ struct dentry *dentry, const char *name, + const void *value, size_t size, int flags) +{ + int err; + + lockdep_off(); -+ err = vfs_setxattr(dentry, name, value, size, flags); ++ err = vfs_setxattr(userns, dentry, name, value, size, flags); + lockdep_on(); + + return err; +} + -+static inline int vfsub_removexattr(struct dentry *dentry, const char *name) ++static inline int vfsub_removexattr(struct user_namespace *userns, ++ struct dentry *dentry, const char *name) +{ + int err; + + lockdep_off(); -+ err = vfs_removexattr(dentry, name); ++ err = vfs_removexattr(userns, dentry, name); + lockdep_on(); + + return err; @@ -33828,11 +33959,11 @@ diff -urN /usr/share/empty/fs/aufs/vfsub.h linux/fs/aufs/vfsub.h +#endif /* __AUFS_VFSUB_H__ */ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c --- /usr/share/empty/fs/aufs/wbr_policy.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/wbr_policy.c 2021-02-24 13:33:42.747680497 +0100 ++++ linux/fs/aufs/wbr_policy.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,830 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -34662,11 +34793,11 @@ diff -urN /usr/share/empty/fs/aufs/wbr_policy.c linux/fs/aufs/wbr_policy.c +}; diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c --- /usr/share/empty/fs/aufs/whout.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/whout.c 2021-02-24 13:33:42.751013936 +0100 -@@ -0,0 +1,1062 @@ ++++ linux/fs/aufs/whout.c 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,1072 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -34727,18 +34858,19 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c +/* ---------------------------------------------------------------------- */ + +/* -+ * test if the @wh_name exists under @h_parent. ++ * test if the @wh_name exists under @h_ppath. + * @try_sio specifies the necessary of super-io. + */ -+int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio) ++int au_wh_test(struct user_namespace *h_userns, struct path *h_ppath, ++ struct qstr *wh_name, int try_sio) +{ + int err; + struct dentry *wh_dentry; + + if (!try_sio) -+ wh_dentry = vfsub_lkup_one(wh_name, h_parent); ++ wh_dentry = vfsub_lkup_one(wh_name, h_ppath); + else -+ wh_dentry = au_sio_lkup_one(wh_name, h_parent); ++ wh_dentry = au_sio_lkup_one(h_userns, wh_name, h_ppath); + err = PTR_ERR(wh_dentry); + if (IS_ERR(wh_dentry)) { + if (err == -ENAMETOOLONG) @@ -34765,16 +34897,16 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c +} + +/* -+ * test if the @h_dentry sets opaque or not. ++ * test if the @h_path->dentry sets opaque or not. + */ -+int au_diropq_test(struct dentry *h_dentry) ++int au_diropq_test(struct user_namespace *h_userns, struct path *h_path) +{ + int err; + struct inode *h_dir; + -+ h_dir = d_inode(h_dentry); -+ err = au_wh_test(h_dentry, &diropq_name, -+ au_test_h_perm_sio(h_dir, MAY_EXEC)); ++ 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)); + return err; +} + @@ -34791,6 +34923,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + /* strict atomic_t is unnecessary here */ + static unsigned short cnt; + struct qstr qs; ++ struct path h_ppath; ++ struct user_namespace *h_userns; + + BUILD_BUG_ON(sizeof(cnt) * 2 > AUFS_WH_TMP_LEN); + @@ -34814,10 +34948,13 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + *p++ = '.'; + AuDebugOn(name + qs.len + 1 - p <= AUFS_WH_TMP_LEN); + ++ h_ppath.dentry = h_parent; ++ h_ppath.mnt = au_br_mnt(br); ++ h_userns = au_br_userns(br); + qs.name = name; + for (i = 0; i < 3; i++) { + sprintf(p, "%.*x", AUFS_WH_TMP_LEN, cnt++); -+ dentry = au_sio_lkup_one(&qs, h_parent); ++ dentry = au_sio_lkup_one(h_userns, &qs, &h_ppath); + if (IS_ERR(dentry) || d_is_negative(dentry)) + goto out_name; + dput(dentry); @@ -34911,21 +35048,20 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + return err; +} + -+static int unlink_wh_name(struct dentry *h_parent, struct qstr *wh, -+ struct au_branch *br) ++static int unlink_wh_name(struct path *h_ppath, struct qstr *wh) +{ + int err; -+ struct path h_path = { -+ .mnt = au_br_mnt(br) -+ }; ++ struct path h_path; + + err = 0; -+ h_path.dentry = vfsub_lkup_one(wh, h_parent); ++ h_path.dentry = vfsub_lkup_one(wh, h_ppath); + if (IS_ERR(h_path.dentry)) + err = PTR_ERR(h_path.dentry); + else { -+ if (d_is_reg(h_path.dentry)) -+ err = do_unlink_wh(d_inode(h_parent), &h_path); ++ if (d_is_reg(h_path.dentry)) { ++ h_path.mnt = h_ppath->mnt; ++ err = do_unlink_wh(d_inode(h_ppath->dentry), &h_path); ++ } + dput(h_path.dentry); + } + @@ -35365,15 +35501,17 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c +static struct dentry *do_diropq(struct dentry *dentry, aufs_bindex_t bindex, + unsigned int flags) +{ -+ struct dentry *opq_dentry, *h_dentry; ++ struct dentry *opq_dentry; + struct super_block *sb; + struct au_branch *br; ++ struct path h_path; + int err; + + sb = dentry->d_sb; + br = au_sbr(sb, bindex); -+ h_dentry = au_h_dptr(dentry, bindex); -+ opq_dentry = vfsub_lkup_one(&diropq_name, h_dentry); ++ h_path.dentry = au_h_dptr(dentry, bindex); ++ h_path.mnt = au_br_mnt(br); ++ opq_dentry = vfsub_lkup_one(&diropq_name, &h_path); + if (IS_ERR(opq_dentry)) + goto out; + @@ -35384,11 +35522,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + goto out; /* success */ + } + } else { -+ struct path tmp = { -+ .dentry = opq_dentry, -+ .mnt = au_br_mnt(br) -+ }; -+ err = do_unlink_wh(au_h_iptr(d_inode(dentry), bindex), &tmp); ++ h_path.dentry = opq_dentry; ++ err = do_unlink_wh(au_h_iptr(d_inode(dentry), bindex), &h_path); + if (!err) + au_set_dbdiropq(dentry, -1); + } @@ -35416,9 +35551,12 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + unsigned int flags) +{ + struct dentry *diropq, *h_dentry; ++ struct user_namespace *h_userns; + ++ h_userns = au_sbr_userns(dentry->d_sb, bindex); + h_dentry = au_h_dptr(dentry, bindex); -+ if (!au_test_h_perm_sio(d_inode(h_dentry), MAY_EXEC | MAY_WRITE)) ++ if (!au_test_h_perm_sio(h_userns, d_inode(h_dentry), ++ MAY_EXEC | MAY_WRITE)) + diropq = do_diropq(dentry, bindex, flags); + else { + int wkq_err; @@ -35451,11 +35589,14 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + int err; + struct qstr wh_name; + struct dentry *wh_dentry; ++ struct path h_path; + + err = au_wh_name_alloc(&wh_name, base_name); + wh_dentry = ERR_PTR(err); + if (!err) { -+ wh_dentry = vfsub_lkup_one(&wh_name, h_parent); ++ h_path.dentry = h_parent; ++ h_path.mnt = au_br_mnt(br); ++ wh_dentry = vfsub_lkup_one(&wh_name, &h_path); + au_kfree_try_rcu(wh_name.name); + } + return wh_dentry; @@ -35490,8 +35631,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c +/* ---------------------------------------------------------------------- */ + +/* Delete all whiteouts in this directory on branch bindex. */ -+static int del_wh_children(struct dentry *h_dentry, struct au_nhash *whlist, -+ aufs_bindex_t bindex, struct au_branch *br) ++static int del_wh_children(struct path *h_path, struct au_nhash *whlist, ++ aufs_bindex_t bindex) +{ + int err; + unsigned long ul, n; @@ -35521,7 +35662,7 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + if (str->len + AUFS_WH_PFX_LEN <= PATH_MAX) { + memcpy(p, str->name, str->len); + wh_name.len = AUFS_WH_PFX_LEN + str->len; -+ err = unlink_wh_name(h_dentry, &wh_name, br); ++ err = unlink_wh_name(h_path, &wh_name); + if (!err) + continue; + break; @@ -35540,16 +35681,15 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + +struct del_wh_children_args { + int *errp; -+ struct dentry *h_dentry; ++ struct path *h_path; + struct au_nhash *whlist; + aufs_bindex_t bindex; -+ struct au_branch *br; +}; + +static void call_del_wh_children(void *args) +{ + struct del_wh_children_args *a = args; -+ *a->errp = del_wh_children(a->h_dentry, a->whlist, a->bindex, a->br); ++ *a->errp = del_wh_children(a->h_path, a->whlist, a->bindex); +} + +/* ---------------------------------------------------------------------- */ @@ -35601,14 +35741,18 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c +{ + int err; + unsigned int h_nlink; -+ struct path h_tmp; ++ struct path wh_path; + struct inode *wh_inode, *h_dir; + struct au_branch *br; ++ struct user_namespace *h_userns; + + 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); + wh_inode = d_inode(wh_dentry); + inode_lock_nested(wh_inode, AuLsc_I_CHILD); + @@ -35616,16 +35760,15 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + * 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(wh_inode, MAY_EXEC | MAY_WRITE)) -+ err = del_wh_children(wh_dentry, whlist, bindex, br); ++ if (!au_test_h_perm_sio(h_userns, wh_inode, MAY_EXEC | MAY_WRITE)) ++ err = del_wh_children(&wh_path, whlist, bindex); + else { + int wkq_err; + struct del_wh_children_args args = { + .errp = &err, -+ .h_dentry = wh_dentry, ++ .h_path = &wh_path, + .whlist = whlist, -+ .bindex = bindex, -+ .br = br ++ .bindex = bindex + }; + + wkq_err = au_wkq_wait(call_del_wh_children, &args); @@ -35635,10 +35778,8 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c + inode_unlock(wh_inode); + + if (!err) { -+ h_tmp.dentry = wh_dentry; -+ h_tmp.mnt = au_br_mnt(br); + h_nlink = h_dir->i_nlink; -+ err = vfsub_rmdir(h_dir, &h_tmp); ++ err = vfsub_rmdir(h_dir, &wh_path); + /* some fs doesn't change the parent nlink in some cases */ + h_nlink -= h_dir->i_nlink; + } @@ -35728,11 +35869,11 @@ diff -urN /usr/share/empty/fs/aufs/whout.c linux/fs/aufs/whout.c +} diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h --- /usr/share/empty/fs/aufs/whout.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/whout.h 2021-02-24 13:33:42.751013936 +0100 -@@ -0,0 +1,86 @@ ++++ linux/fs/aufs/whout.h 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,87 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -35761,8 +35902,9 @@ diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h + +/* whout.c */ +int au_wh_name_alloc(struct qstr *wh, const struct qstr *name); -+int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio); -+int au_diropq_test(struct dentry *h_dentry); ++int au_wh_test(struct user_namespace *h_userns, struct path *h_ppath, ++ struct qstr *wh_name, int try_sio); ++int au_diropq_test(struct user_namespace *h_userns, struct path *h_path); +struct au_branch; +struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br, + struct qstr *prefix); @@ -35818,11 +35960,11 @@ diff -urN /usr/share/empty/fs/aufs/whout.h linux/fs/aufs/whout.h +#endif /* __AUFS_WHOUT_H__ */ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c --- /usr/share/empty/fs/aufs/wkq.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/wkq.c 2021-02-24 13:33:42.751013936 +0100 ++++ linux/fs/aufs/wkq.c 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,372 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -36194,11 +36336,11 @@ diff -urN /usr/share/empty/fs/aufs/wkq.c linux/fs/aufs/wkq.c +} diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h --- /usr/share/empty/fs/aufs/wkq.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/wkq.h 2021-02-24 13:33:42.751013936 +0100 ++++ linux/fs/aufs/wkq.h 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -36287,11 +36429,11 @@ diff -urN /usr/share/empty/fs/aufs/wkq.h linux/fs/aufs/wkq.h +#endif /* __AUFS_WKQ_H__ */ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c --- /usr/share/empty/fs/aufs/xattr.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/xattr.c 2021-02-24 13:33:42.751013936 +0100 -@@ -0,0 +1,356 @@ ++++ linux/fs/aufs/xattr.c 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,368 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2014-2020 Junjiro R. Okajima ++ * Copyright (C) 2014-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -36355,21 +36497,26 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c + +static const int au_xattr_out_of_list = AuBrAttr_ICEX_OTH << 1; + -+static int au_do_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, ++static int au_do_cpup_xattr(struct path *h_dst, struct path *h_src, + char *name, char **buf, unsigned int ignore_flags, + unsigned int verbose) +{ + int err; + ssize_t ssz; + struct inode *h_idst; ++ struct dentry *h_dst_dentry, *h_src_dentry; ++ struct user_namespace *h_dst_userns, *h_src_userns; + -+ ssz = vfs_getxattr_alloc(h_src, name, buf, 0, GFP_NOFS); ++ h_src_userns = mnt_user_ns(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)) ++ || (au_test_nfs_noacl(d_inode(h_src_dentry)) + && (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS) + || !strcmp(name, + XATTR_NAME_POSIX_ACL_DEFAULT)))) @@ -36381,9 +36528,12 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c + } + + /* unlock it temporary */ -+ h_idst = d_inode(h_dst); ++ h_dst_userns = mnt_user_ns(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, name, *buf, ssz, /*flags*/0); ++ err = vfsub_setxattr(h_dst_userns, h_dst_dentry, name, *buf, ssz, ++ /*flags*/0); + inode_lock_nested(h_idst, AuLsc_I_CHILD2); + if (unlikely(err)) { + if (verbose || au_debug_test()) @@ -36395,25 +36545,28 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c + return err; +} + -+int au_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, int ignore_flags, ++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; + ssize_t ssz; ++ struct dentry *h_dst_dentry, *h_src_dentry; + struct inode *h_isrc, *h_idst; + char *value, *p, *o, *e; + + /* try stopping to update the source inode while we are referencing */ + /* there should not be the parent-child relationship between them */ -+ h_isrc = d_inode(h_src); -+ h_idst = d_inode(h_dst); ++ h_dst_dentry = h_dst->dentry; ++ h_idst = d_inode(h_dst_dentry); ++ h_src_dentry = h_src->dentry; ++ h_isrc = d_inode(h_src_dentry); + inode_unlock(h_idst); + inode_lock_shared_nested(h_isrc, AuLsc_I_CHILD); + inode_lock_nested(h_idst, AuLsc_I_CHILD2); + unlocked = 0; + + /* some filesystems don't list POSIX ACL, for example tmpfs */ -+ ssz = vfs_listxattr(h_src, NULL, 0); ++ ssz = vfs_listxattr(h_src_dentry, NULL, 0); + err = ssz; + if (unlikely(err < 0)) { + AuTraceErr(err); @@ -36432,7 +36585,7 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c + o = p; + if (unlikely(!p)) + goto out; -+ err = vfs_listxattr(h_src, p, ssz); ++ err = vfs_listxattr(h_src_dentry, p, ssz); + } + inode_unlock_shared(h_isrc); + unlocked = 1; @@ -36546,7 +36699,7 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c + break; + case AU_XATTR_GET: + AuDebugOn(d_is_negative(h_path.dentry)); -+ err = vfs_getxattr(h_path.dentry, ++ err = vfs_getxattr(mnt_user_ns(h_path.mnt), h_path.dentry, + arg->u.get.name, arg->u.get.value, + arg->u.get.size); + break; @@ -36618,6 +36771,7 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c +} + +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) @@ -36647,11 +36801,11 @@ diff -urN /usr/share/empty/fs/aufs/xattr.c linux/fs/aufs/xattr.c +} diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c --- /usr/share/empty/fs/aufs/xino.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux/fs/aufs/xino.c 2021-02-24 13:33:42.751013936 +0100 -@@ -0,0 +1,1925 @@ ++++ linux/fs/aufs/xino.c 2021-11-01 23:48:34.213025928 +0100 +@@ -0,0 +1,1926 @@ +// SPDX-License-Identifier: GPL-2.0 +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -36886,22 +37040,23 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c + struct file *copy_src) +{ + struct file *file; -+ struct dentry *dentry, *parent; ++ struct dentry *dentry; + struct inode *dir, *delegated; + struct qstr *name; -+ struct path path; ++ struct path ppath, path; + int err, do_unlock; + struct au_xino_lock_dir ldir; + + do_unlock = 1; + au_xino_lock_dir(sb, base, &ldir); + dentry = base->dentry; -+ parent = dentry->d_parent; /* dir inode is locked */ -+ dir = d_inode(parent); ++ ppath.dentry = dentry->d_parent; /* dir inode is locked */ ++ ppath.mnt = base->mnt; ++ dir = d_inode(ppath.dentry); + IMustLock(dir); + + name = &dentry->d_name; -+ path.dentry = vfsub_lookup_one_len(name->name, parent, name->len); ++ path.dentry = vfsub_lookup_one_len(name->name, &ppath, name->len); + if (IS_ERR(path.dentry)) { + file = (void *)path.dentry; + pr_err("%pd lookup err %ld\n", dentry, PTR_ERR(path.dentry)); @@ -36909,7 +37064,7 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c + } + + /* no need to mnt_want_write() since we call dentry_open() later */ -+ err = vfs_create(dir, path.dentry, 0666, NULL); ++ err = vfs_create(mnt_user_ns(base->mnt), dir, path.dentry, 0666, NULL); + if (unlikely(err)) { + file = ERR_PTR(err); + pr_err("%pd create err %d\n", dentry, err); @@ -38576,11 +38731,11 @@ diff -urN /usr/share/empty/fs/aufs/xino.c linux/fs/aufs/xino.c +} 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 2021-02-24 13:33:42.751013936 +0100 ++++ linux/include/uapi/linux/aufs_type.h 2021-11-01 23:48:34.213025928 +0100 @@ -0,0 +1,452 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* -+ * Copyright (C) 2005-2020 Junjiro R. Okajima ++ * Copyright (C) 2005-2021 Junjiro R. Okajima + * + * This program, aufs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -38620,7 +38775,7 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin +#include +#endif /* __KERNEL__ */ + -+#define AUFS_VERSION "5.11-20210222" ++#define AUFS_VERSION "5.x-rcN-20211018" + +/* todo? move this to linux-2.6.19/include/magic.h */ +#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's') @@ -39031,13 +39186,13 @@ diff -urN /usr/share/empty/include/uapi/linux/aufs_type.h linux/include/uapi/lin + +#endif /* __AUFS_TYPE_H__ */ SPDX-License-Identifier: GPL-2.0 -aufs5.11 loopback patch +aufs5.x-rcN loopback patch diff --git a/drivers/block/loop.c b/drivers/block/loop.c -index 39d539df0349d..4109efe2f6a3a 100644 +index a62b132cbd551..79cf20555c2b1 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c -@@ -646,6 +646,15 @@ static inline void loop_update_dio(struct loop_device *lo) +@@ -685,6 +685,15 @@ static inline void loop_update_dio(struct loop_device *lo) lo->use_dio); } @@ -39050,28 +39205,28 @@ index 39d539df0349d..4109efe2f6a3a 100644 + return f; +} + - static void loop_reread_partitions(struct loop_device *lo, - struct block_device *bdev) + static void loop_reread_partitions(struct loop_device *lo) { -@@ -701,6 +710,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, - unsigned int arg) + int rc; +@@ -742,6 +751,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, { - struct file *file = NULL, *old_file; -+ struct file *f, *virt_file = NULL, *old_virt_file; - int error; - bool partscan; - -@@ -720,12 +730,19 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, - file = fget(arg); - if (!file) + struct file *file = fget(arg); + struct file *old_file; ++ struct file *f, *virt_file = NULL, *old_virt_file; + int error; + bool partscan; + bool is_loop; +@@ -761,11 +771,19 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, + if (!(lo->lo_flags & LO_FLAGS_READ_ONLY)) goto out_err; + + f = loop_real_file(file); + if (f) { + virt_file = file; + file = f; + get_file(file); + } - ++ error = loop_validate_file(file, bdev); if (error) goto out_err; @@ -39081,7 +39236,7 @@ index 39d539df0349d..4109efe2f6a3a 100644 error = -EINVAL; -@@ -737,6 +754,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, +@@ -778,6 +796,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, blk_mq_freeze_queue(lo->lo_queue); mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask); lo->lo_backing_file = file; @@ -39089,47 +39244,47 @@ index 39d539df0349d..4109efe2f6a3a 100644 lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping); mapping_set_gfp_mask(file->f_mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); -@@ -750,6 +768,8 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, +@@ -800,6 +819,8 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, * dependency. */ fput(old_file); + if (old_virt_file) + fput(old_virt_file); if (partscan) - loop_reread_partitions(lo, bdev); + loop_reread_partitions(lo); return 0; -@@ -758,6 +778,8 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, - mutex_unlock(&lo->lo_mutex); - if (file) - fput(file); +@@ -808,6 +829,8 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, + loop_global_unlock(lo, is_loop); + out_putf: + fput(file); + if (virt_file) + fput(virt_file); return error; } -@@ -1084,7 +1106,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, - struct block_device *bdev, +@@ -1208,6 +1231,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, const struct loop_config *config) { -- struct file *file; -+ struct file *file, *f, *virt_file = NULL; - struct inode *inode; + struct file *file = fget(config->fd); ++ struct file *f, *virt_file = NULL; + struct inode *inode; struct address_space *mapping; - int error; -@@ -1099,6 +1121,12 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, - file = fget(config->fd); - if (!file) - goto out; + int error; +@@ -1223,6 +1247,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) { + virt_file = file; + file = f; + get_file(file); + } - ++ /* * If we don't hold exclusive handle for the device, upgrade to it -@@ -1153,6 +1181,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, + * here to avoid changing device under exclusive owner. +@@ -1288,6 +1319,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO; lo->lo_device = bdev; lo->lo_backing_file = file; @@ -39137,16 +39292,16 @@ index 39d539df0349d..4109efe2f6a3a 100644 lo->old_gfp_mask = mapping_gfp_mask(mapping); mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); -@@ -1203,6 +1232,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, +@@ -1338,6 +1370,8 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, bd_abort_claiming(bdev, loop_configure); out_putf: fput(file); + if (virt_file) + fput(virt_file); - out: /* This is safe: open() is still holding a reference. */ module_put(THIS_MODULE); -@@ -1212,6 +1243,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, + return error; +@@ -1346,6 +1380,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, static int __loop_clr_fd(struct loop_device *lo, bool release) { struct file *filp = NULL; @@ -39154,7 +39309,7 @@ index 39d539df0349d..4109efe2f6a3a 100644 gfp_t gfp = lo->old_gfp_mask; struct block_device *bdev = lo->lo_device; int err = 0; -@@ -1235,6 +1267,7 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) +@@ -1397,6 +1432,7 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) spin_lock_irq(&lo->lo_lock); lo->lo_backing_file = NULL; @@ -39162,7 +39317,7 @@ index 39d539df0349d..4109efe2f6a3a 100644 spin_unlock_irq(&lo->lo_lock); loop_release_xfer(lo); -@@ -1317,6 +1350,8 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) +@@ -1477,6 +1513,8 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) */ if (filp) fput(filp); @@ -39172,7 +39327,7 @@ index 39d539df0349d..4109efe2f6a3a 100644 } diff --git a/drivers/block/loop.h b/drivers/block/loop.h -index af75a5ee40944..1d847cb194ff6 100644 +index 04c88dd6eabd6..0ff3ba22ee170 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h @@ -46,7 +46,7 @@ struct loop_device { @@ -39185,7 +39340,7 @@ index af75a5ee40944..1d847cb194ff6 100644 void *key_data; diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c -index 5ef279a59bb14..6447c37f98756 100644 +index 99ceca1440449..e49dfe8550329 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) @@ -39198,7 +39353,7 @@ index 5ef279a59bb14..6447c37f98756 100644 if (file->f_mapping != h_file->f_mapping) { file->f_mapping = h_file->f_mapping; diff --git a/fs/aufs/loop.c b/fs/aufs/loop.c -index a8b63acc62045..9d97c3af5686a 100644 +index 74347bd75b380..5ef888a1d53f4 100644 --- a/fs/aufs/loop.c +++ b/fs/aufs/loop.c @@ -133,3 +133,19 @@ void au_loopback_fin(void) @@ -39222,7 +39377,7 @@ index a8b63acc62045..9d97c3af5686a 100644 + return f; +} diff --git a/fs/aufs/loop.h b/fs/aufs/loop.h -index 94f4f80ae33bf..ca1194354aff4 100644 +index 7293bee427f96..3345c098d0d47 100644 --- a/fs/aufs/loop.h +++ b/fs/aufs/loop.h @@ -26,6 +26,8 @@ void au_warn_loopback(struct super_block *h_sb); @@ -39244,7 +39399,7 @@ index 94f4f80ae33bf..ca1194354aff4 100644 #endif /* __KERNEL__ */ diff --git a/fs/aufs/super.c b/fs/aufs/super.c -index 589dd01220201..801e0a7faec59 100644 +index ae38857541533..af32f0960e595 100644 --- a/fs/aufs/super.c +++ b/fs/aufs/super.c @@ -844,7 +844,10 @@ static const struct super_operations aufs_sop = { @@ -39260,10 +39415,10 @@ index 589dd01220201..801e0a7faec59 100644 /* ---------------------------------------------------------------------- */ diff --git a/include/linux/fs.h b/include/linux/fs.h -index 91f3fbe5b57ff..ad1b2e44d538b 100644 +index 376ddf1965aa2..adb8c854de599 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h -@@ -1965,6 +1965,10 @@ struct super_operations { +@@ -2226,6 +2226,10 @@ struct super_operations { struct shrink_control *); long (*free_cached_objects)(struct super_block *, struct shrink_control *);