aufs5.6 base patch
authorJ. R. Okajima <hooanon05@yahoo.co.jp>
Tue, 7 Apr 2020 13:14:47 +0000 (22:14 +0900)
committerSalvatore Bonaccorso <carnil@debian.org>
Sat, 5 Sep 2020 14:52:44 +0000 (15:52 +0100)
Origin: https://github.com/sfjro/aufs5-standalone/tree/7c07d9737e9de058981f020d66ac0d4407a80899
Bug-Debian: https://bugs.debian.org/541828

Patch headers added by debian/bin/genpatch-aufs

SPDX-License-Identifier: GPL-2.0
aufs5.6 base patch

Gbp-Pq: Topic features/all/aufs5
Gbp-Pq: Name aufs5-base.patch

14 files changed:
MAINTAINERS
drivers/block/loop.c
fs/dcache.c
fs/fcntl.c
fs/inode.c
fs/namespace.c
fs/read_write.c
fs/splice.c
fs/sync.c
include/linux/fs.h
include/linux/lockdep.h
include/linux/mnt_namespace.h
include/linux/splice.h
kernel/locking/lockdep.c

index 4e2698cc7e23960a5102f6abe34ac215e88bdb87..491f32f3b072720e839558501512ab855bf0dbdf 100644 (file)
@@ -2984,6 +2984,19 @@ F:       include/linux/audit.h
 F:     include/uapi/linux/audit.h
 F:     kernel/audit*
 
+AUFS (advanced multi layered unification filesystem) FILESYSTEM
+M:     "J. R. Okajima" <hooanon05g@gmail.com>
+L:     aufs-users@lists.sourceforge.net (members only)
+L:     linux-unionfs@vger.kernel.org
+W:     http://aufs.sourceforge.net
+T:     git://github.com/sfjro/aufs4-linux.git
+S:     Supported
+F:     Documentation/filesystems/aufs/
+F:     Documentation/ABI/testing/debugfs-aufs
+F:     Documentation/ABI/testing/sysfs-aufs
+F:     fs/aufs/
+F:     include/uapi/linux/aufs_type.h
+
 AUXILIARY DISPLAY DRIVERS
 M:     Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
 S:     Maintained
index 84433922aed162b38a9fe02e7ea00bf13edd9b31..93a02eff7dcfa004318dc9df2f9af668182093c6 100644 (file)
@@ -763,6 +763,24 @@ out_err:
        return error;
 }
 
+/*
+ * for AUFS
+ * no get/put for file.
+ */
+struct file *loop_backing_file(struct super_block *sb)
+{
+       struct file *ret;
+       struct loop_device *l;
+
+       ret = NULL;
+       if (MAJOR(sb->s_dev) == LOOP_MAJOR) {
+               l = sb->s_bdev->bd_disk->private_data;
+               ret = l->lo_backing_file;
+       }
+       return ret;
+}
+EXPORT_SYMBOL_GPL(loop_backing_file);
+
 /* loop sysfs attributes */
 
 static ssize_t loop_attr_show(struct device *dev, char *page,
index 361ea7ab30ea7d95ef00b9b3060e61d4275501c9..3cd36474f302cacbbeddcb8172761b3fbbf183e2 100644 (file)
@@ -1285,7 +1285,7 @@ enum d_walk_ret {
  *
  * The @enter() callbacks are called with d_lock held.
  */
-static void d_walk(struct dentry *parent, void *data,
+void d_walk(struct dentry *parent, void *data,
                   enum d_walk_ret (*enter)(void *, struct dentry *))
 {
        struct dentry *this_parent;
index 2e4c0fa2074b00c7b4ea43715647368bf680d804..0b28a37f7e5058b3da5881dc94bc31f5c09ce4f8 100644 (file)
@@ -32,7 +32,7 @@
 
 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
 
-static int setfl(int fd, struct file * filp, unsigned long arg)
+int setfl(int fd, struct file *filp, unsigned long arg)
 {
        struct inode * inode = file_inode(filp);
        int error = 0;
@@ -63,6 +63,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
 
        if (filp->f_op->check_flags)
                error = filp->f_op->check_flags(arg);
+       if (!error && filp->f_op->setfl)
+               error = filp->f_op->setfl(filp, arg);
        if (error)
                return error;
 
index 72c4c347afb702a36141be3935142e71a1dd45ef..a7ff2099c2efa5b2c7b830d231c20743942f7fcf 100644 (file)
@@ -1768,7 +1768,7 @@ EXPORT_SYMBOL(generic_update_time);
  * This does the actual work of updating an inodes time or version.  Must have
  * had called mnt_want_write() before calling this.
  */
-static int update_time(struct inode *inode, struct timespec64 *time, int flags)
+int update_time(struct inode *inode, struct timespec64 *time, int flags)
 {
        if (inode->i_op->update_time)
                return inode->i_op->update_time(inode, time, flags);
index 4a0f600a3328595d6630491e3077ee4209521adc..12edf29ab2badb552f10fc27d559e07b5c9ce9da 100644 (file)
@@ -792,6 +792,12 @@ static inline int check_mnt(struct mount *mnt)
        return mnt->mnt_ns == current->nsproxy->mnt_ns;
 }
 
+/* for aufs, CONFIG_AUFS_BR_FUSE */
+int is_current_mnt_ns(struct vfsmount *mnt)
+{
+       return check_mnt(real_mount(mnt));
+}
+
 /*
  * vfsmount lock must be held for write
  */
index 4fb797822567a6b3500f61820d7b76ed22942635..744831cd0094e216e8557234b2c64b4750535869 100644 (file)
@@ -507,6 +507,28 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
        return ret;
 }
 
+vfs_readf_t vfs_readf(struct file *file)
+{
+       const struct file_operations *fop = file->f_op;
+
+       if (fop->read)
+               return fop->read;
+       if (fop->read_iter)
+               return new_sync_read;
+       return ERR_PTR(-ENOSYS); /* doesn't have ->read(|_iter)() op */
+}
+
+vfs_writef_t vfs_writef(struct file *file)
+{
+       const struct file_operations *fop = file->f_op;
+
+       if (fop->write)
+               return fop->write;
+       if (fop->write_iter)
+               return new_sync_write;
+       return ERR_PTR(-ENOSYS); /* doesn't have ->write(|_iter)() op */
+}
+
 /* caller is responsible for file_start_write/file_end_write */
 ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
 {
index d7c8a7c4db07fff8cfc54a83adefba53207691a0..f0b625e27554dad3e6c4f9a9412f2df54239d43e 100644 (file)
@@ -839,8 +839,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
 /*
  * Attempt to initiate a splice from pipe to file.
  */
-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
-                          loff_t *ppos, size_t len, unsigned int flags)
+long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+                   loff_t *ppos, size_t len, unsigned int flags)
 {
        if (out->f_op->splice_write)
                return out->f_op->splice_write(pipe, out, ppos, len, flags);
@@ -850,9 +850,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 /*
  * Attempt to initiate a splice from a file to a pipe.
  */
-static long do_splice_to(struct file *in, loff_t *ppos,
-                        struct pipe_inode_info *pipe, size_t len,
-                        unsigned int flags)
+long do_splice_to(struct file *in, loff_t *ppos,
+                 struct pipe_inode_info *pipe, size_t len,
+                 unsigned int flags)
 {
        int ret;
 
index 1373a610dc784e4d2ee5742e3af0847666eca92d..b7b5a0a0df6ffe08aff998c06e1e0a1dfdbe5546 100644 (file)
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -28,7 +28,7 @@
  * wait == 1 case since in that case write_inode() functions do
  * sync_dirty_buffer() and thus effectively write one block at a time.
  */
-static int __sync_filesystem(struct super_block *sb, int wait)
+int __sync_filesystem(struct super_block *sb, int wait)
 {
        if (wait)
                sync_inodes_sb(sb);
index ac1e89872db4f3a475eadcb080060b3fd48672a4..94b9fa80ced2a521d9c30c8083c8897d7822166d 100644 (file)
@@ -1370,6 +1370,7 @@ extern void fasync_free(struct fasync_struct *);
 /* can be called from interrupts */
 extern void kill_fasync(struct fasync_struct **, int, int);
 
+extern int setfl(int fd, struct file *filp, unsigned long arg);
 extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
 extern int f_setown(struct file *filp, unsigned long arg, int force);
 extern void f_delown(struct file *filp);
@@ -1858,6 +1859,7 @@ struct file_operations {
        ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
        unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
        int (*check_flags)(int);
+       int (*setfl)(struct file *, unsigned long);
        int (*flock) (struct file *, int, struct file_lock *);
        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
        ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
@@ -1928,6 +1930,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
                              struct iovec *fast_pointer,
                              struct iovec **ret_pointer);
 
+typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
+typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
+                               loff_t *);
+vfs_readf_t vfs_readf(struct file *file);
+vfs_writef_t vfs_writef(struct file *file);
+
 extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
 extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
 extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
@@ -2366,6 +2374,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);
+extern int update_time(struct inode *, struct timespec64 *, int);
 
 /* /sys/fs */
 extern struct kobject *fs_kobj;
@@ -2647,6 +2656,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
        return false;
 }
 #endif
+extern int __sync_filesystem(struct super_block *, int);
 extern int sync_filesystem(struct super_block *);
 extern const struct file_operations def_blk_fops;
 extern const struct file_operations def_chr_fops;
index 8fce5c98a4b0ecadee49f08a1d3addae1254a08c..c1a3f172e97a22e4595275a252cd0aebc2bc34cd 100644 (file)
@@ -395,6 +395,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock,
        return lock->key == key;
 }
 
+struct lock_class *lockdep_hlock_class(struct held_lock *hlock);
+
 /*
  * Acquire a lock.
  *
@@ -540,6 +542,7 @@ struct lockdep_map { };
 
 #define lockdep_depth(tsk)     (0)
 
+#define lockdep_is_held(lock)                  (1)
 #define lockdep_is_held_type(l, r)             (1)
 
 #define lockdep_assert_held(l)                 do { (void)(l); } while (0)
index 8f882f5881e8797d72bd38c9e693899cc25d1d22..6b9808f0984351a53046cbc409087e6c94ee6efd 100644 (file)
@@ -7,12 +7,15 @@ struct mnt_namespace;
 struct fs_struct;
 struct user_namespace;
 struct ns_common;
+struct vfsmount;
 
 extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
                struct user_namespace *, struct fs_struct *);
 extern void put_mnt_ns(struct mnt_namespace *ns);
 extern struct ns_common *from_mnt_ns(struct mnt_namespace *);
 
+extern int is_current_mnt_ns(struct vfsmount *mnt);
+
 extern const struct file_operations proc_mounts_operations;
 extern const struct file_operations proc_mountinfo_operations;
 extern const struct file_operations proc_mountstats_operations;
index 5c47013f708e6d622bdce11d746ff7e44da52d50..fef6c59ed92aba1fc893994487dc7cf8986c63db 100644 (file)
@@ -93,4 +93,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *);
 
 extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
 extern const struct pipe_buf_operations default_pipe_buf_ops;
+
+extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+                          loff_t *ppos, size_t len, unsigned int flags);
+extern long do_splice_to(struct file *in, loff_t *ppos,
+                        struct pipe_inode_info *pipe, size_t len,
+                        unsigned int flags);
 #endif
index 29a8de4c50b90e8f7b5593f5d781f796e8a5e186..6cfff5e18c841aa4292d676d177dc6cfcb752fc7 100644 (file)
@@ -169,7 +169,7 @@ static
 struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
 static DECLARE_BITMAP(lock_classes_in_use, MAX_LOCKDEP_KEYS);
 
-static inline struct lock_class *hlock_class(struct held_lock *hlock)
+inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock)
 {
        unsigned int class_idx = hlock->class_idx;
 
@@ -190,6 +190,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
         */
        return lock_classes + class_idx;
 }
+#define hlock_class(hlock) lockdep_hlock_class(hlock)
 
 #ifdef CONFIG_LOCK_STAT
 static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats);