aufs5-base.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. SPDX-License-Identifier: GPL-2.0
  2. aufs5.1 base patch
  3. diff --git a/MAINTAINERS b/MAINTAINERS
  4. index 2c2fce72e694..f5be2663b01e 100644
  5. --- a/MAINTAINERS
  6. +++ b/MAINTAINERS
  7. @@ -2699,6 +2699,19 @@ F: include/linux/audit.h
  8. F: include/uapi/linux/audit.h
  9. F: kernel/audit*
  10. +AUFS (advanced multi layered unification filesystem) FILESYSTEM
  11. +M: "J. R. Okajima" <hooanon05g@gmail.com>
  12. +L: aufs-users@lists.sourceforge.net (members only)
  13. +L: linux-unionfs@vger.kernel.org
  14. +W: http://aufs.sourceforge.net
  15. +T: git://github.com/sfjro/aufs4-linux.git
  16. +S: Supported
  17. +F: Documentation/filesystems/aufs/
  18. +F: Documentation/ABI/testing/debugfs-aufs
  19. +F: Documentation/ABI/testing/sysfs-aufs
  20. +F: fs/aufs/
  21. +F: include/uapi/linux/aufs_type.h
  22. +
  23. AUXILIARY DISPLAY DRIVERS
  24. M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
  25. S: Maintained
  26. diff --git a/drivers/block/loop.c b/drivers/block/loop.c
  27. index bf1c61cab8eb..7e18c8c72dcc 100644
  28. --- a/drivers/block/loop.c
  29. +++ b/drivers/block/loop.c
  30. @@ -738,6 +738,24 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
  31. return error;
  32. }
  33. +/*
  34. + * for AUFS
  35. + * no get/put for file.
  36. + */
  37. +struct file *loop_backing_file(struct super_block *sb)
  38. +{
  39. + struct file *ret;
  40. + struct loop_device *l;
  41. +
  42. + ret = NULL;
  43. + if (MAJOR(sb->s_dev) == LOOP_MAJOR) {
  44. + l = sb->s_bdev->bd_disk->private_data;
  45. + ret = l->lo_backing_file;
  46. + }
  47. + return ret;
  48. +}
  49. +EXPORT_SYMBOL_GPL(loop_backing_file);
  50. +
  51. /* loop sysfs attributes */
  52. static ssize_t loop_attr_show(struct device *dev, char *page,
  53. diff --git a/fs/dcache.c b/fs/dcache.c
  54. index aac41adf4743..fc18967c2522 100644
  55. --- a/fs/dcache.c
  56. +++ b/fs/dcache.c
  57. @@ -1247,7 +1247,7 @@ enum d_walk_ret {
  58. *
  59. * The @enter() callbacks are called with d_lock held.
  60. */
  61. -static void d_walk(struct dentry *parent, void *data,
  62. +void d_walk(struct dentry *parent, void *data,
  63. enum d_walk_ret (*enter)(void *, struct dentry *))
  64. {
  65. struct dentry *this_parent;
  66. diff --git a/fs/fcntl.c b/fs/fcntl.c
  67. index 083185174c6d..78234ee16784 100644
  68. --- a/fs/fcntl.c
  69. +++ b/fs/fcntl.c
  70. @@ -32,7 +32,7 @@
  71. #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
  72. -static int setfl(int fd, struct file * filp, unsigned long arg)
  73. +int setfl(int fd, struct file * filp, unsigned long arg)
  74. {
  75. struct inode * inode = file_inode(filp);
  76. int error = 0;
  77. @@ -63,6 +63,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
  78. if (filp->f_op->check_flags)
  79. error = filp->f_op->check_flags(arg);
  80. + if (!error && filp->f_op->setfl)
  81. + error = filp->f_op->setfl(filp, arg);
  82. if (error)
  83. return error;
  84. diff --git a/fs/inode.c b/fs/inode.c
  85. index 9a453f3637f8..ee4434cea572 100644
  86. --- a/fs/inode.c
  87. +++ b/fs/inode.c
  88. @@ -1657,7 +1657,7 @@ EXPORT_SYMBOL(generic_update_time);
  89. * This does the actual work of updating an inodes time or version. Must have
  90. * had called mnt_want_write() before calling this.
  91. */
  92. -static int update_time(struct inode *inode, struct timespec64 *time, int flags)
  93. +int update_time(struct inode *inode, struct timespec64 *time, int flags)
  94. {
  95. int (*update_time)(struct inode *, struct timespec64 *, int);
  96. diff --git a/fs/namespace.c b/fs/namespace.c
  97. index c9cab307fa77..e56de0b2bee0 100644
  98. --- a/fs/namespace.c
  99. +++ b/fs/namespace.c
  100. @@ -769,6 +769,12 @@ static inline int check_mnt(struct mount *mnt)
  101. return mnt->mnt_ns == current->nsproxy->mnt_ns;
  102. }
  103. +/* for aufs, CONFIG_AUFS_BR_FUSE */
  104. +int is_current_mnt_ns(struct vfsmount *mnt)
  105. +{
  106. + return check_mnt(real_mount(mnt));
  107. +}
  108. +
  109. /*
  110. * vfsmount lock must be held for write
  111. */
  112. diff --git a/fs/read_write.c b/fs/read_write.c
  113. index 61b43ad7608e..8979e01e9bf0 100644
  114. --- a/fs/read_write.c
  115. +++ b/fs/read_write.c
  116. @@ -489,6 +489,28 @@ static ssize_t __vfs_write(struct file *file, const char __user *p,
  117. return -EINVAL;
  118. }
  119. +vfs_readf_t vfs_readf(struct file *file)
  120. +{
  121. + const struct file_operations *fop = file->f_op;
  122. +
  123. + if (fop->read)
  124. + return fop->read;
  125. + if (fop->read_iter)
  126. + return new_sync_read;
  127. + return ERR_PTR(-ENOSYS);
  128. +}
  129. +
  130. +vfs_writef_t vfs_writef(struct file *file)
  131. +{
  132. + const struct file_operations *fop = file->f_op;
  133. +
  134. + if (fop->write)
  135. + return fop->write;
  136. + if (fop->write_iter)
  137. + return new_sync_write;
  138. + return ERR_PTR(-ENOSYS);
  139. +}
  140. +
  141. ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
  142. {
  143. mm_segment_t old_fs;
  144. diff --git a/fs/splice.c b/fs/splice.c
  145. index 25212dcca2df..9629564ee8f2 100644
  146. --- a/fs/splice.c
  147. +++ b/fs/splice.c
  148. @@ -833,8 +833,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
  149. /*
  150. * Attempt to initiate a splice from pipe to file.
  151. */
  152. -static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  153. - loff_t *ppos, size_t len, unsigned int flags)
  154. +long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  155. + loff_t *ppos, size_t len, unsigned int flags)
  156. {
  157. ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
  158. loff_t *, size_t, unsigned int);
  159. @@ -850,9 +850,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  160. /*
  161. * Attempt to initiate a splice from a file to a pipe.
  162. */
  163. -static long do_splice_to(struct file *in, loff_t *ppos,
  164. - struct pipe_inode_info *pipe, size_t len,
  165. - unsigned int flags)
  166. +long do_splice_to(struct file *in, loff_t *ppos,
  167. + struct pipe_inode_info *pipe, size_t len,
  168. + unsigned int flags)
  169. {
  170. ssize_t (*splice_read)(struct file *, loff_t *,
  171. struct pipe_inode_info *, size_t, unsigned int);
  172. diff --git a/fs/sync.c b/fs/sync.c
  173. index b54e0541ad89..28607828e96f 100644
  174. --- a/fs/sync.c
  175. +++ b/fs/sync.c
  176. @@ -28,7 +28,7 @@
  177. * wait == 1 case since in that case write_inode() functions do
  178. * sync_dirty_buffer() and thus effectively write one block at a time.
  179. */
  180. -static int __sync_filesystem(struct super_block *sb, int wait)
  181. +int __sync_filesystem(struct super_block *sb, int wait)
  182. {
  183. if (wait)
  184. sync_inodes_sb(sb);
  185. diff --git a/include/linux/fs.h b/include/linux/fs.h
  186. index dd28e7679089..77933034b50a 100644
  187. --- a/include/linux/fs.h
  188. +++ b/include/linux/fs.h
  189. @@ -1327,6 +1327,7 @@ extern void fasync_free(struct fasync_struct *);
  190. /* can be called from interrupts */
  191. extern void kill_fasync(struct fasync_struct **, int, int);
  192. +extern int setfl(int fd, struct file * filp, unsigned long arg);
  193. extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
  194. extern int f_setown(struct file *filp, unsigned long arg, int force);
  195. extern void f_delown(struct file *filp);
  196. @@ -1806,6 +1807,7 @@ struct file_operations {
  197. ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
  198. unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
  199. int (*check_flags)(int);
  200. + int (*setfl)(struct file *, unsigned long);
  201. int (*flock) (struct file *, int, struct file_lock *);
  202. ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
  203. ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
  204. @@ -1876,6 +1878,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
  205. struct iovec *fast_pointer,
  206. struct iovec **ret_pointer);
  207. +typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
  208. +typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
  209. + loff_t *);
  210. +vfs_readf_t vfs_readf(struct file *file);
  211. +vfs_writef_t vfs_writef(struct file *file);
  212. +
  213. extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
  214. extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
  215. extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
  216. @@ -2306,6 +2314,7 @@ extern int current_umask(void);
  217. extern void ihold(struct inode * inode);
  218. extern void iput(struct inode *);
  219. extern int generic_update_time(struct inode *, struct timespec64 *, int);
  220. +extern int update_time(struct inode *, struct timespec64 *, int);
  221. /* /sys/fs */
  222. extern struct kobject *fs_kobj;
  223. @@ -2594,6 +2603,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
  224. return false;
  225. }
  226. #endif
  227. +extern int __sync_filesystem(struct super_block *, int);
  228. extern int sync_filesystem(struct super_block *);
  229. extern const struct file_operations def_blk_fops;
  230. extern const struct file_operations def_chr_fops;
  231. diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
  232. index 79c3873d58ac..470795d9f4a2 100644
  233. --- a/include/linux/lockdep.h
  234. +++ b/include/linux/lockdep.h
  235. @@ -320,6 +320,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock,
  236. return lock->key == key;
  237. }
  238. +struct lock_class *lockdep_hlock_class(struct held_lock *hlock);
  239. +
  240. /*
  241. * Acquire a lock.
  242. *
  243. @@ -458,6 +460,7 @@ struct lockdep_map { };
  244. #define lockdep_depth(tsk) (0)
  245. +#define lockdep_is_held(lock) (1)
  246. #define lockdep_is_held_type(l, r) (1)
  247. #define lockdep_assert_held(l) do { (void)(l); } while (0)
  248. diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
  249. index 35942084cd40..24f5fd1a789d 100644
  250. --- a/include/linux/mnt_namespace.h
  251. +++ b/include/linux/mnt_namespace.h
  252. @@ -6,11 +6,14 @@
  253. struct mnt_namespace;
  254. struct fs_struct;
  255. struct user_namespace;
  256. +struct vfsmount;
  257. extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
  258. struct user_namespace *, struct fs_struct *);
  259. extern void put_mnt_ns(struct mnt_namespace *ns);
  260. +extern int is_current_mnt_ns(struct vfsmount *mnt);
  261. +
  262. extern const struct file_operations proc_mounts_operations;
  263. extern const struct file_operations proc_mountinfo_operations;
  264. extern const struct file_operations proc_mountstats_operations;
  265. diff --git a/include/linux/splice.h b/include/linux/splice.h
  266. index 74b4911ac16d..19789fbea567 100644
  267. --- a/include/linux/splice.h
  268. +++ b/include/linux/splice.h
  269. @@ -87,4 +87,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *);
  270. extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
  271. extern const struct pipe_buf_operations default_pipe_buf_ops;
  272. +
  273. +extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  274. + loff_t *ppos, size_t len, unsigned int flags);
  275. +extern long do_splice_to(struct file *in, loff_t *ppos,
  276. + struct pipe_inode_info *pipe, size_t len,
  277. + unsigned int flags);
  278. #endif
  279. diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
  280. index e221be724fe8..c738ac7c3a46 100644
  281. --- a/kernel/locking/lockdep.c
  282. +++ b/kernel/locking/lockdep.c
  283. @@ -151,7 +151,7 @@ static
  284. #endif
  285. struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
  286. -static inline struct lock_class *hlock_class(struct held_lock *hlock)
  287. +inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock)
  288. {
  289. if (!hlock->class_idx) {
  290. /*
  291. @@ -162,6 +162,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
  292. }
  293. return lock_classes + hlock->class_idx - 1;
  294. }
  295. +#define hlock_class(hlock) lockdep_hlock_class(hlock)
  296. #ifdef CONFIG_LOCK_STAT
  297. static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats);