1
1
SPDX-License-Identifier: GPL-2.0
2
- aufs6.1 mmap patch
2
+ aufs6.2 mmap patch
3
3
4
4
diff --git a/fs/proc/base.c b/fs/proc/base.c
5
5
index 9e479d7d202b..986c2ae12f8b 100644
@@ -31,10 +31,10 @@ index 4d3493579458..42edd9a42c78 100644
31
31
ino = inode->i_ino;
32
32
}
33
33
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
34
- index 8a74cdcc9af0..c05071b53f5b 100644
34
+ index af1c49ae11b1..cd6a4e461763 100644
35
35
--- a/fs/proc/task_mmu.c
36
36
+++ b/fs/proc/task_mmu.c
37
- @@ -284 ,7 +284 ,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
37
+ @@ -285 ,7 +285 ,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
38
38
const char *name = NULL;
39
39
40
40
if (file) {
@@ -46,7 +46,7 @@ index 8a74cdcc9af0..c05071b53f5b 100644
46
46
dev = inode->i_sb->s_dev;
47
47
ino = inode->i_ino;
48
48
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
49
- @@ -1934 ,7 +1937 ,7 @@ static int show_numa_map(struct seq_file *m, void *v)
49
+ @@ -1940 ,7 +1943 ,7 @@ static int show_numa_map(struct seq_file *m, void *v)
50
50
struct proc_maps_private *proc_priv = &numa_priv->proc_maps;
51
51
struct vm_area_struct *vma = v;
52
52
struct numa_maps *md = &numa_priv->md;
@@ -72,14 +72,14 @@ index 2fd06f52b6a4..b01030da424f 100644
72
72
ino = inode->i_ino;
73
73
pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
74
74
diff --git a/include/linux/mm.h b/include/linux/mm.h
75
- index 974ccca609d2..f5f4fc5e0565 100644
75
+ index f13f20258ce9..25f4878a0835 100644
76
76
--- a/include/linux/mm.h
77
77
+++ b/include/linux/mm.h
78
- @@ -1954 ,6 +1954 ,43 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
78
+ @@ -2065 ,6 +2065 ,43 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
79
79
unmap_mapping_range(mapping, holebegin, holelen, 0);
80
80
}
81
81
82
- + #if IS_ENABLED(CONFIG_AUFS_FS)
82
+ + #if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
83
83
+ extern void vma_do_file_update_time(struct vm_area_struct *, const char[], int);
84
84
+ extern struct file *vma_do_pr_or_file(struct vm_area_struct *, const char[],
85
85
+ int);
@@ -120,34 +120,34 @@ index 974ccca609d2..f5f4fc5e0565 100644
120
120
void *buf, int len, unsigned int gup_flags);
121
121
extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
122
122
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
123
- index 500e536796ca..ad766e2110ca 100644
123
+ index 9757067c3053..b6a0f30cd722 100644
124
124
--- a/include/linux/mm_types.h
125
125
+++ b/include/linux/mm_types.h
126
- @@ -413 ,6 +413 ,9 @@ struct vm_region {
126
+ @@ -504 ,6 +504 ,9 @@ struct vm_region {
127
127
unsigned long vm_top; /* region allocated to here */
128
128
unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */
129
129
struct file *vm_file; /* the backing file or NULL */
130
- + #if IS_ENABLED(CONFIG_AUFS_FS)
130
+ + #if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
131
131
+ struct file *vm_prfile; /* the virtual backing file or NULL */
132
132
+ #endif
133
133
134
134
int vm_usage; /* region usage count (access under nommu_region_sem) */
135
135
bool vm_icache_flushed : 1; /* true if the icache has been flushed for
136
- @@ -494 ,6 +497 ,9 @@ struct vm_area_struct {
136
+ @@ -575 ,6 +578 ,9 @@ struct vm_area_struct {
137
137
unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
138
138
units */
139
139
struct file * vm_file; /* File we map to (can be NULL). */
140
- + #if IS_ENABLED(CONFIG_AUFS_FS)
140
+ + #if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
141
141
+ struct file *vm_prfile; /* shadow of vm_file */
142
142
+ #endif
143
143
void * vm_private_data; /* was vm_pte (shared mem) */
144
144
145
- #ifdef CONFIG_SWAP
145
+ #ifdef CONFIG_ANON_VMA_NAME
146
146
diff --git a/kernel/fork.c b/kernel/fork.c
147
- index 08969f5aa38d..61871700033a 100644
147
+ index 9f7fe3541897..f9e44ca88a7d 100644
148
148
--- a/kernel/fork.c
149
149
+++ b/kernel/fork.c
150
- @@ -661 ,7 +661 ,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
150
+ @@ -664 ,7 +664 ,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
151
151
if (file) {
152
152
struct address_space *mapping = file->f_mapping;
153
153
@@ -164,12 +164,12 @@ index 8e105e5b3e29..c218d042dbce 100644
164
164
obj-$(CONFIG_HAVE_BOOTMEM_INFO_NODE) += bootmem_info.o
165
165
obj-$(CONFIG_GENERIC_IOREMAP) += ioremap.o
166
166
obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o
167
- + obj-$(CONFIG_AUFS_FS:m=y) += prfile.o
167
+ + obj-y += prfile.o
168
168
diff --git a/mm/filemap.c b/mm/filemap.c
169
- index 08341616ae7a..410ca60fbf39 100644
169
+ index 0e20a8d6dd93..ba1b238d928a 100644
170
170
--- a/mm/filemap.c
171
171
+++ b/mm/filemap.c
172
- @@ -3418 ,7 +3418 ,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
172
+ @@ -3438 ,7 +3438 ,7 @@ vm_fault_t filemap_page_mkwrite(struct vm_fault *vmf)
173
173
vm_fault_t ret = VM_FAULT_LOCKED;
174
174
175
175
sb_start_pagefault(mapping->host->i_sb);
@@ -179,7 +179,7 @@ index 08341616ae7a..410ca60fbf39 100644
179
179
if (folio->mapping != mapping) {
180
180
folio_unlock(folio);
181
181
diff --git a/mm/mmap.c b/mm/mmap.c
182
- index 54abd46e6007..de942692ac82 100644
182
+ index 425a9349e610..004eb9dbd99a 100644
183
183
--- a/mm/mmap.c
184
184
+++ b/mm/mmap.c
185
185
@@ -139,7 +139,7 @@ static void remove_vma(struct vm_area_struct *vma)
@@ -209,7 +209,7 @@ index 54abd46e6007..de942692ac82 100644
209
209
}
210
210
if (next->anon_vma)
211
211
anon_vma_merge(vma, next);
212
- @@ -2224 ,7 +2224 ,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
212
+ @@ -2228 ,7 +2228 ,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
213
213
goto out_free_mpol;
214
214
215
215
if (new->vm_file)
@@ -218,7 +218,7 @@ index 54abd46e6007..de942692ac82 100644
218
218
219
219
if (new->vm_ops && new->vm_ops->open)
220
220
new->vm_ops->open(new);
221
- @@ -2246 ,7 +2246 ,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
221
+ @@ -2250 ,7 +2250 ,7 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
222
222
if (new->vm_ops && new->vm_ops->close)
223
223
new->vm_ops->close(new);
224
224
if (new->vm_file)
@@ -227,7 +227,7 @@ index 54abd46e6007..de942692ac82 100644
227
227
unlink_anon_vmas(new);
228
228
out_free_mpol:
229
229
mpol_put(vma_policy(new));
230
- @@ -2746 ,7 +2746 ,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
230
+ @@ -2750 ,7 +2750 ,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
231
231
if (vma->vm_ops && vma->vm_ops->close)
232
232
vma->vm_ops->close(vma);
233
233
unmap_and_free_vma:
@@ -236,21 +236,21 @@ index 54abd46e6007..de942692ac82 100644
236
236
vma->vm_file = NULL;
237
237
238
238
/* Undo any partial mapping done by a device driver. */
239
- @@ -2813 ,6 +2813 ,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
239
+ @@ -2817 ,6 +2817 ,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
240
240
unsigned long populate = 0;
241
241
unsigned long ret = -EINVAL;
242
242
struct file *file;
243
- + #if IS_ENABLED(CONFIG_AUFS_FS)
243
+ + #if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
244
244
+ struct file *prfile;
245
245
+ #endif
246
246
247
247
pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/mm/remap_file_pages.rst.\n",
248
248
current->comm, current->pid);
249
- @@ -2871 ,10 +2874 ,34 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
249
+ @@ -2875 ,10 +2878 ,34 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
250
250
if (vma->vm_flags & VM_LOCKED)
251
251
flags |= MAP_LOCKED;
252
252
253
- + #if IS_ENABLED(CONFIG_AUFS_FS)
253
+ + #if 1 /* IS_ENABLED(CONFIG_AUFS_FS) */
254
254
+ vma_get_file(vma);
255
255
+ file = vma->vm_file;
256
256
+ prfile = vma->vm_prfile;
@@ -281,7 +281,7 @@ index 54abd46e6007..de942692ac82 100644
281
281
out:
282
282
mmap_write_unlock(mm);
283
283
if (populate)
284
- @@ -3222 ,7 +3249 ,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
284
+ @@ -3226 ,7 +3253 ,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
285
285
if (anon_vma_clone(new_vma, vma))
286
286
goto out_free_mempol;
287
287
if (new_vma->vm_file)
@@ -291,7 +291,7 @@ index 54abd46e6007..de942692ac82 100644
291
291
new_vma->vm_ops->open(new_vma);
292
292
if (vma_link(mm, new_vma))
293
293
diff --git a/mm/nommu.c b/mm/nommu.c
294
- index 214c70e1d059..dccbb939d2a9 100644
294
+ index 5b83938ecb67..59d483b9c3d3 100644
295
295
--- a/mm/nommu.c
296
296
+++ b/mm/nommu.c
297
297
@@ -523,7 +523,7 @@ static void __put_nommu_region(struct vm_region *region)
@@ -321,9 +321,9 @@ index 214c70e1d059..dccbb939d2a9 100644
321
321
kmem_cache_free(vm_region_jar, region);
322
322
region = pregion;
323
323
result = start;
324
- @@ -1241,10 +1241,10 @@ unsigned long do_mmap(struct file *file,
325
- up_write(&nommu_region_sem);
324
+ @@ -1242,10 +1242,10 @@ unsigned long do_mmap(struct file *file,
326
325
error:
326
+ mas_destroy(&mas);
327
327
if (region->vm_file)
328
328
- fput(region->vm_file);
329
329
+ vmr_fput(region);
0 commit comments