aufs4-base.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. SPDX-License-Identifier: GPL-2.0
  2. aufs4.14 base patch
  3. diff --git a/MAINTAINERS b/MAINTAINERS
  4. index 2811a21..02b6deb 100644
  5. --- a/MAINTAINERS
  6. +++ b/MAINTAINERS
  7. @@ -2465,6 +2465,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: linux-unionfs@vger.kernel.org
  13. +L: aufs-users@lists.sourceforge.net (members only)
  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. W: http://miguelojeda.es/auxdisplay.htm
  26. diff --git a/drivers/block/loop.c b/drivers/block/loop.c
  27. index 85de673..d44de9d 100644
  28. --- a/drivers/block/loop.c
  29. +++ b/drivers/block/loop.c
  30. @@ -686,6 +686,24 @@ static inline int is_loop_device(struct file *file)
  31. return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
  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 f901413..e3719a5 100644
  55. --- a/fs/dcache.c
  56. +++ b/fs/dcache.c
  57. @@ -1197,7 +1197,7 @@ enum d_walk_ret {
  58. *
  59. * The @enter() and @finish() 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. void (*finish)(void *))
  65. {
  66. diff --git a/fs/fcntl.c b/fs/fcntl.c
  67. index 8d78ffd..cffefab 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 d1e35b5..f7800d6 100644
  86. --- a/fs/inode.c
  87. +++ b/fs/inode.c
  88. @@ -1655,7 +1655,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 timespec *time, int flags)
  93. +int update_time(struct inode *inode, struct timespec *time, int flags)
  94. {
  95. int (*update_time)(struct inode *, struct timespec *, int);
  96. diff --git a/fs/namespace.c b/fs/namespace.c
  97. index d18deb4..e5a4a7f 100644
  98. --- a/fs/namespace.c
  99. +++ b/fs/namespace.c
  100. @@ -846,6 +846,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 0046d72..2388284 100644
  114. --- a/fs/read_write.c
  115. +++ b/fs/read_write.c
  116. @@ -484,6 +484,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count,
  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 f3084cc..eb888c6 100644
  146. --- a/fs/splice.c
  147. +++ b/fs/splice.c
  148. @@ -837,8 +837,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. @@ -854,9 +854,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 83ac79a..fe15900 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/file.h b/include/linux/file.h
  186. index 279720d..76e38ea 100644
  187. --- a/include/linux/file.h
  188. +++ b/include/linux/file.h
  189. @@ -20,6 +20,7 @@ struct dentry;
  190. struct path;
  191. extern struct file *alloc_file(const struct path *, fmode_t mode,
  192. const struct file_operations *fop);
  193. +extern struct file *get_empty_filp(void);
  194. static inline void fput_light(struct file *file, int fput_needed)
  195. {
  196. diff --git a/include/linux/fs.h b/include/linux/fs.h
  197. index 885266a..e489e42 100644
  198. --- a/include/linux/fs.h
  199. +++ b/include/linux/fs.h
  200. @@ -1265,6 +1265,7 @@ extern void fasync_free(struct fasync_struct *);
  201. /* can be called from interrupts */
  202. extern void kill_fasync(struct fasync_struct **, int, int);
  203. +extern int setfl(int fd, struct file * filp, unsigned long arg);
  204. extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
  205. extern int f_setown(struct file *filp, unsigned long arg, int force);
  206. extern void f_delown(struct file *filp);
  207. @@ -1711,6 +1712,7 @@ struct file_operations {
  208. ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
  209. unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
  210. int (*check_flags)(int);
  211. + int (*setfl)(struct file *, unsigned long);
  212. int (*flock) (struct file *, int, struct file_lock *);
  213. ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
  214. ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
  215. @@ -1781,6 +1783,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
  216. struct iovec *fast_pointer,
  217. struct iovec **ret_pointer);
  218. +typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *);
  219. +typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t,
  220. + loff_t *);
  221. +vfs_readf_t vfs_readf(struct file *file);
  222. +vfs_writef_t vfs_writef(struct file *file);
  223. +
  224. extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
  225. extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
  226. extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
  227. @@ -2183,6 +2191,7 @@ extern int current_umask(void);
  228. extern void ihold(struct inode * inode);
  229. extern void iput(struct inode *);
  230. extern int generic_update_time(struct inode *, struct timespec *, int);
  231. +extern int update_time(struct inode *, struct timespec *, int);
  232. /* /sys/fs */
  233. extern struct kobject *fs_kobj;
  234. @@ -2463,6 +2472,7 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
  235. return false;
  236. }
  237. #endif
  238. +extern int __sync_filesystem(struct super_block *, int);
  239. extern int sync_filesystem(struct super_block *);
  240. extern const struct file_operations def_blk_fops;
  241. extern const struct file_operations def_chr_fops;
  242. diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
  243. index f301d31..c26f5b4 100644
  244. --- a/include/linux/lockdep.h
  245. +++ b/include/linux/lockdep.h
  246. @@ -406,6 +406,8 @@ static inline int lockdep_match_key(struct lockdep_map *lock,
  247. return lock->key == key;
  248. }
  249. +struct lock_class *lockdep_hlock_class(struct held_lock *hlock);
  250. +
  251. /*
  252. * Acquire a lock.
  253. *
  254. @@ -530,6 +532,7 @@ struct lock_class_key { };
  255. #define lockdep_depth(tsk) (0)
  256. +#define lockdep_is_held(lock) (1)
  257. #define lockdep_is_held_type(l, r) (1)
  258. #define lockdep_assert_held(l) do { (void)(l); } while (0)
  259. diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
  260. index 3594208..24f5fd1 100644
  261. --- a/include/linux/mnt_namespace.h
  262. +++ b/include/linux/mnt_namespace.h
  263. @@ -6,11 +6,14 @@
  264. struct mnt_namespace;
  265. struct fs_struct;
  266. struct user_namespace;
  267. +struct vfsmount;
  268. extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
  269. struct user_namespace *, struct fs_struct *);
  270. extern void put_mnt_ns(struct mnt_namespace *ns);
  271. +extern int is_current_mnt_ns(struct vfsmount *mnt);
  272. +
  273. extern const struct file_operations proc_mounts_operations;
  274. extern const struct file_operations proc_mountinfo_operations;
  275. extern const struct file_operations proc_mountstats_operations;
  276. diff --git a/include/linux/splice.h b/include/linux/splice.h
  277. index 74b4911..19789fb 100644
  278. --- a/include/linux/splice.h
  279. +++ b/include/linux/splice.h
  280. @@ -87,4 +87,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *);
  281. extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
  282. extern const struct pipe_buf_operations default_pipe_buf_ops;
  283. +
  284. +extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
  285. + loff_t *ppos, size_t len, unsigned int flags);
  286. +extern long do_splice_to(struct file *in, loff_t *ppos,
  287. + struct pipe_inode_info *pipe, size_t len,
  288. + unsigned int flags);
  289. #endif
  290. diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
  291. index e36e652..bc97a97 100644
  292. --- a/kernel/locking/lockdep.c
  293. +++ b/kernel/locking/lockdep.c
  294. @@ -144,7 +144,7 @@ static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES];
  295. unsigned long nr_lock_classes;
  296. static struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
  297. -static inline struct lock_class *hlock_class(struct held_lock *hlock)
  298. +inline struct lock_class *lockdep_hlock_class(struct held_lock *hlock)
  299. {
  300. if (!hlock->class_idx) {
  301. /*
  302. @@ -155,6 +155,7 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
  303. }
  304. return lock_classes + hlock->class_idx - 1;
  305. }
  306. +#define hlock_class(hlock) lockdep_hlock_class(hlock)
  307. #ifdef CONFIG_LOCK_STAT
  308. static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], cpu_lock_stats);