mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-11 17:54:37 +08:00
210 lines
6.7 KiB
Diff
210 lines
6.7 KiB
Diff
aufs3.9 proc_map patch
|
|
|
|
diff --git a/fs/buffer.c b/fs/buffer.c
|
|
index b4dcb34..7b6b475 100644
|
|
--- a/fs/buffer.c
|
|
+++ b/fs/buffer.c
|
|
@@ -2390,6 +2390,8 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
|
|
* fault so this update may be superfluous but who really cares...
|
|
*/
|
|
file_update_time(vma->vm_file);
|
|
+ if (vma->vm_prfile)
|
|
+ file_update_time(vma->vm_prfile);
|
|
|
|
ret = __block_page_mkwrite(vma, vmf, get_block);
|
|
sb_end_pagefault(sb);
|
|
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
|
|
index ccfd99b..c09e2cf 100644
|
|
--- a/fs/proc/nommu.c
|
|
+++ b/fs/proc/nommu.c
|
|
@@ -46,6 +46,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region)
|
|
|
|
if (file) {
|
|
struct inode *inode = file_inode(region->vm_file);
|
|
+ if (region->vm_prfile) {
|
|
+ file = region->vm_prfile;
|
|
+ inode = file_inode(file);
|
|
+ }
|
|
dev = inode->i_sb->s_dev;
|
|
ino = inode->i_ino;
|
|
}
|
|
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
|
|
index 3e636d8..1004190 100644
|
|
--- a/fs/proc/task_mmu.c
|
|
+++ b/fs/proc/task_mmu.c
|
|
@@ -272,6 +272,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
|
|
|
|
if (file) {
|
|
struct inode *inode = file_inode(vma->vm_file);
|
|
+ if (vma->vm_prfile) {
|
|
+ file = vma->vm_prfile;
|
|
+ inode = file_inode(file);
|
|
+ }
|
|
dev = inode->i_sb->s_dev;
|
|
ino = inode->i_ino;
|
|
pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
|
|
@@ -1285,6 +1289,8 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
|
|
|
|
if (file) {
|
|
seq_printf(m, " file=");
|
|
+ if (vma->vm_prfile)
|
|
+ file = vma->vm_prfile;
|
|
seq_path(m, &file->f_path, "\n\t= ");
|
|
} else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) {
|
|
seq_printf(m, " heap");
|
|
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
|
|
index 56123a6..b987a88 100644
|
|
--- a/fs/proc/task_nommu.c
|
|
+++ b/fs/proc/task_nommu.c
|
|
@@ -150,6 +150,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
|
|
|
|
if (file) {
|
|
struct inode *inode = file_inode(vma->vm_file);
|
|
+ if (vma->vm_prfile) {
|
|
+ file = vma->vm_prfile;
|
|
+ inode = file_inode(file);
|
|
+ }
|
|
dev = inode->i_sb->s_dev;
|
|
ino = inode->i_ino;
|
|
pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
|
|
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
|
|
index ace9a5f..6636779 100644
|
|
--- a/include/linux/mm_types.h
|
|
+++ b/include/linux/mm_types.h
|
|
@@ -213,6 +213,7 @@ struct vm_region {
|
|
unsigned long vm_top; /* region allocated to here */
|
|
unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */
|
|
struct file *vm_file; /* the backing file or NULL */
|
|
+ struct file *vm_prfile; /* the virtual backing file or NULL */
|
|
|
|
int vm_usage; /* region usage count (access under nommu_region_sem) */
|
|
bool vm_icache_flushed : 1; /* true if the icache has been flushed for
|
|
@@ -281,6 +282,7 @@ struct vm_area_struct {
|
|
unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
|
|
units, *not* PAGE_CACHE_SIZE */
|
|
struct file * vm_file; /* File we map to (can be NULL). */
|
|
+ struct file *vm_prfile; /* shadow of vm_file */
|
|
void * vm_private_data; /* was vm_pte (shared mem) */
|
|
|
|
#ifndef CONFIG_MMU
|
|
diff --git a/kernel/fork.c b/kernel/fork.c
|
|
index 1766d32..c17b93b 100644
|
|
--- a/kernel/fork.c
|
|
+++ b/kernel/fork.c
|
|
@@ -417,6 +417,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
|
|
struct address_space *mapping = file->f_mapping;
|
|
|
|
get_file(file);
|
|
+ if (tmp->vm_prfile)
|
|
+ get_file(tmp->vm_prfile);
|
|
if (tmp->vm_flags & VM_DENYWRITE)
|
|
atomic_dec(&inode->i_writecount);
|
|
mutex_lock(&mapping->i_mmap_mutex);
|
|
diff --git a/mm/memory.c b/mm/memory.c
|
|
index ba94dec..2c87da1 100644
|
|
--- a/mm/memory.c
|
|
+++ b/mm/memory.c
|
|
@@ -3456,6 +3456,8 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
|
|
/* file_update_time outside page_lock */
|
|
if (vma->vm_file && !page_mkwrite)
|
|
file_update_time(vma->vm_file);
|
|
+ if (vma->vm_prfile && !page_mkwrite)
|
|
+ file_update_time(vma->vm_prfile);
|
|
} else {
|
|
unlock_page(vmf.page);
|
|
if (anon)
|
|
diff --git a/mm/mmap.c b/mm/mmap.c
|
|
index 0db0de1..147446c 100644
|
|
--- a/mm/mmap.c
|
|
+++ b/mm/mmap.c
|
|
@@ -243,6 +243,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
|
|
vma->vm_ops->close(vma);
|
|
if (vma->vm_file)
|
|
fput(vma->vm_file);
|
|
+ if (vma->vm_prfile)
|
|
+ fput(vma->vm_prfile);
|
|
mpol_put(vma_policy(vma));
|
|
kmem_cache_free(vm_area_cachep, vma);
|
|
return next;
|
|
@@ -825,6 +827,8 @@ again: remove_next = 1 + (end > next->vm_end);
|
|
if (file) {
|
|
uprobe_munmap(next, next->vm_start, next->vm_end);
|
|
fput(file);
|
|
+ if (vma->vm_prfile)
|
|
+ fput(vma->vm_prfile);
|
|
}
|
|
if (next->anon_vma)
|
|
anon_vma_merge(vma, next);
|
|
@@ -2387,6 +2391,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
|
|
|
|
if (new->vm_file)
|
|
get_file(new->vm_file);
|
|
+ if (new->vm_prfile)
|
|
+ get_file(new->vm_prfile);
|
|
|
|
if (new->vm_ops && new->vm_ops->open)
|
|
new->vm_ops->open(new);
|
|
@@ -2406,6 +2412,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
|
|
new->vm_ops->close(new);
|
|
if (new->vm_file)
|
|
fput(new->vm_file);
|
|
+ if (new->vm_prfile)
|
|
+ fput(new->vm_prfile);
|
|
unlink_anon_vmas(new);
|
|
out_free_mpol:
|
|
mpol_put(pol);
|
|
@@ -2805,6 +2813,8 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
|
|
goto out_free_mempol;
|
|
if (new_vma->vm_file)
|
|
get_file(new_vma->vm_file);
|
|
+ if (new_vma->vm_prfile)
|
|
+ get_file(new_vma->vm_prfile);
|
|
if (new_vma->vm_ops && new_vma->vm_ops->open)
|
|
new_vma->vm_ops->open(new_vma);
|
|
vma_link(mm, new_vma, prev, rb_link, rb_parent);
|
|
diff --git a/mm/nommu.c b/mm/nommu.c
|
|
index e001768..e9f09eb 100644
|
|
--- a/mm/nommu.c
|
|
+++ b/mm/nommu.c
|
|
@@ -650,6 +650,8 @@ static void __put_nommu_region(struct vm_region *region)
|
|
|
|
if (region->vm_file)
|
|
fput(region->vm_file);
|
|
+ if (region->vm_prfile)
|
|
+ fput(region->vm_prfile);
|
|
|
|
/* IO memory and memory shared directly out of the pagecache
|
|
* from ramfs/tmpfs mustn't be released here */
|
|
@@ -808,6 +810,8 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma)
|
|
vma->vm_ops->close(vma);
|
|
if (vma->vm_file)
|
|
fput(vma->vm_file);
|
|
+ if (vma->vm_prfile)
|
|
+ fput(vma->vm_prfile);
|
|
put_nommu_region(vma->vm_region);
|
|
kmem_cache_free(vm_area_cachep, vma);
|
|
}
|
|
@@ -1374,6 +1378,8 @@ unsigned long do_mmap_pgoff(struct file *file,
|
|
}
|
|
}
|
|
fput(region->vm_file);
|
|
+ if (region->vm_prfile)
|
|
+ fput(region->vm_prfile);
|
|
kmem_cache_free(vm_region_jar, region);
|
|
region = pregion;
|
|
result = start;
|
|
@@ -1450,9 +1456,13 @@ error_just_free:
|
|
error:
|
|
if (region->vm_file)
|
|
fput(region->vm_file);
|
|
+ if (region->vm_prfile)
|
|
+ fput(region->vm_prfile);
|
|
kmem_cache_free(vm_region_jar, region);
|
|
if (vma->vm_file)
|
|
fput(vma->vm_file);
|
|
+ if (vma->vm_prfile)
|
|
+ fput(vma->vm_prfile);
|
|
kmem_cache_free(vm_area_cachep, vma);
|
|
kleave(" = %d", ret);
|
|
return ret;
|