wok-backports view linux/stuff/aufs3-proc_map.patch @ rev 55

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 27 17:46:33 2019 +0100 (2019-02-27)
parents
children
line source
1 aufs3.2 proc_map patch
3 diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
4 index b1822dd..8b29ab7 100644
5 --- a/fs/proc/nommu.c
6 +++ b/fs/proc/nommu.c
7 @@ -46,6 +46,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
9 if (file) {
10 struct inode *inode = region->vm_file->f_path.dentry->d_inode;
11 + if (region->vm_prfile) {
12 + file = region->vm_prfile;
13 + inode = file->f_path.dentry->d_inode;
14 + }
15 dev = inode->i_sb->s_dev;
16 ino = inode->i_ino;
17 }
18 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
19 index e418c5a..53efe92 100644
20 --- a/fs/proc/task_mmu.c
21 +++ b/fs/proc/task_mmu.c
22 @@ -222,6 +222,10 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
24 if (file) {
25 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
26 + if (vma->vm_prfile) {
27 + file = vma->vm_prfile;
28 + inode = file->f_path.dentry->d_inode;
29 + }
30 dev = inode->i_sb->s_dev;
31 ino = inode->i_ino;
32 pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
33 @@ -1033,6 +1037,8 @@ static int show_numa_map(struct seq_file *m, void *v)
35 if (file) {
36 seq_printf(m, " file=");
37 + if (vma->vm_prfile)
38 + file = vma->vm_prfile;
39 seq_path(m, &file->f_path, "\n\t= ");
40 } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) {
41 seq_printf(m, " heap");
42 diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
43 index 980de54..4ee031f 100644
44 --- a/fs/proc/task_nommu.c
45 +++ b/fs/proc/task_nommu.c
46 @@ -148,6 +148,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
48 if (file) {
49 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
50 + if (vma->vm_prfile) {
51 + file = vma->vm_prfile;
52 + inode = file->f_path.dentry->d_inode;
53 + }
54 dev = inode->i_sb->s_dev;
55 ino = inode->i_ino;
56 pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
57 diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
58 index 5b42f1b..a49a07e 100644
59 --- a/include/linux/mm_types.h
60 +++ b/include/linux/mm_types.h
61 @@ -186,6 +186,7 @@ struct vm_region {
62 unsigned long vm_top; /* region allocated to here */
63 unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */
64 struct file *vm_file; /* the backing file or NULL */
65 + struct file *vm_prfile; /* the virtual backing file or NULL */
67 int vm_usage; /* region usage count (access under nommu_region_sem) */
68 bool vm_icache_flushed : 1; /* true if the icache has been flushed for
69 @@ -245,6 +246,7 @@ struct vm_area_struct {
70 unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
71 units, *not* PAGE_CACHE_SIZE */
72 struct file * vm_file; /* File we map to (can be NULL). */
73 + struct file *vm_prfile; /* shadow of vm_file */
74 void * vm_private_data; /* was vm_pte (shared mem) */
76 #ifndef CONFIG_MMU
77 diff --git a/kernel/fork.c b/kernel/fork.c
78 index da4a6a1..3d19191 100644
79 --- a/kernel/fork.c
80 +++ b/kernel/fork.c
81 @@ -376,6 +376,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
82 struct address_space *mapping = file->f_mapping;
84 get_file(file);
85 + if (tmp->vm_prfile)
86 + get_file(tmp->vm_prfile);
87 if (tmp->vm_flags & VM_DENYWRITE)
88 atomic_dec(&inode->i_writecount);
89 mutex_lock(&mapping->i_mmap_mutex);
90 diff --git a/mm/memory.c b/mm/memory.c
91 index 829d437..3c1b28f12 100644
92 --- a/mm/memory.c
93 +++ b/mm/memory.c
94 @@ -2622,6 +2622,8 @@ reuse:
95 /* file_update_time outside page_lock */
96 if (vma->vm_file)
97 file_update_time(vma->vm_file);
98 + if (vma->vm_prfile)
99 + file_update_time(vma->vm_prfile);
101 return ret;
102 }
103 @@ -3307,6 +3309,8 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
104 /* file_update_time outside page_lock */
105 if (vma->vm_file)
106 file_update_time(vma->vm_file);
107 + if (vma->vm_prfile)
108 + file_update_time(vma->vm_prfile);
109 } else {
110 unlock_page(vmf.page);
111 if (anon)
112 diff --git a/mm/mmap.c b/mm/mmap.c
113 index eae90af..c182f23 100644
114 --- a/mm/mmap.c
115 +++ b/mm/mmap.c
116 @@ -232,6 +232,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
117 vma->vm_ops->close(vma);
118 if (vma->vm_file) {
119 fput(vma->vm_file);
120 + if (vma->vm_prfile)
121 + fput(vma->vm_prfile);
122 if (vma->vm_flags & VM_EXECUTABLE)
123 removed_exe_file_vma(vma->vm_mm);
124 }
125 @@ -619,6 +621,8 @@ again: remove_next = 1 + (end > next->vm_end);
126 if (remove_next) {
127 if (file) {
128 fput(file);
129 + if (vma->vm_prfile)
130 + fput(vma->vm_prfile);
131 if (next->vm_flags & VM_EXECUTABLE)
132 removed_exe_file_vma(mm);
133 }
134 @@ -1965,6 +1969,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
136 if (new->vm_file) {
137 get_file(new->vm_file);
138 + if (new->vm_prfile)
139 + get_file(new->vm_prfile);
140 if (vma->vm_flags & VM_EXECUTABLE)
141 added_exe_file_vma(mm);
142 }
143 @@ -1989,6 +1995,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
144 if (vma->vm_flags & VM_EXECUTABLE)
145 removed_exe_file_vma(mm);
146 fput(new->vm_file);
147 + if (new->vm_prfile)
148 + fput(new->vm_prfile);
149 }
150 unlink_anon_vmas(new);
151 out_free_mpol:
152 @@ -2356,6 +2364,8 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
153 new_vma->vm_pgoff = pgoff;
154 if (new_vma->vm_file) {
155 get_file(new_vma->vm_file);
156 + if (new_vma->vm_prfile)
157 + get_file(new_vma->vm_prfile);
158 if (vma->vm_flags & VM_EXECUTABLE)
159 added_exe_file_vma(mm);
160 }
161 diff --git a/mm/nommu.c b/mm/nommu.c
162 index b982290..42fbe0e 100644
163 --- a/mm/nommu.c
164 +++ b/mm/nommu.c
165 @@ -633,6 +633,8 @@ static void __put_nommu_region(struct vm_region *region)
167 if (region->vm_file)
168 fput(region->vm_file);
169 + if (region->vm_prfile)
170 + fput(region->vm_prfile);
172 /* IO memory and memory shared directly out of the pagecache
173 * from ramfs/tmpfs mustn't be released here */
174 @@ -789,6 +791,8 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma)
175 vma->vm_ops->close(vma);
176 if (vma->vm_file) {
177 fput(vma->vm_file);
178 + if (vma->vm_prfile)
179 + fput(vma->vm_prfile);
180 if (vma->vm_flags & VM_EXECUTABLE)
181 removed_exe_file_vma(mm);
182 }
183 @@ -1362,6 +1366,8 @@ unsigned long do_mmap_pgoff(struct file *file,
184 }
185 }
186 fput(region->vm_file);
187 + if (region->vm_prfile)
188 + fput(region->vm_prfile);
189 kmem_cache_free(vm_region_jar, region);
190 region = pregion;
191 result = start;
192 @@ -1438,9 +1444,13 @@ error_just_free:
193 error:
194 if (region->vm_file)
195 fput(region->vm_file);
196 + if (region->vm_prfile)
197 + fput(region->vm_prfile);
198 kmem_cache_free(vm_region_jar, region);
199 if (vma->vm_file)
200 fput(vma->vm_file);
201 + if (vma->vm_prfile)
202 + fput(vma->vm_prfile);
203 if (vma->vm_flags & VM_EXECUTABLE)
204 removed_exe_file_vma(vma->vm_mm);
205 kmem_cache_free(vm_area_cachep, vma);