Commit c87a37eb authored by Chengguang Xu's avatar Chengguang Xu Committed by Dominique Martinet

9p: avoid attaching writeback_fid on mmap with type PRIVATE

Currently on mmap cache policy, we always attach writeback_fid
whether mmap type is SHARED or PRIVATE. However, in the use case
of kata-container which combines 9p(Guest OS) with overlayfs(Host OS),
this behavior will trigger overlayfs' copy-up when excute command
inside container.

Link: http://lkml.kernel.org/r/20190820100325.10313-1-cgxu519@zoho.com.cnSigned-off-by: default avatarChengguang Xu <cgxu519@zoho.com.cn>
Signed-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
parent 089cf7f6
...@@ -513,6 +513,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma) ...@@ -513,6 +513,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
v9inode = V9FS_I(inode); v9inode = V9FS_I(inode);
mutex_lock(&v9inode->v_mutex); mutex_lock(&v9inode->v_mutex);
if (!v9inode->writeback_fid && if (!v9inode->writeback_fid &&
(vma->vm_flags & VM_SHARED) &&
(vma->vm_flags & VM_WRITE)) { (vma->vm_flags & VM_WRITE)) {
/* /*
* clone a fid and add it to writeback_fid * clone a fid and add it to writeback_fid
...@@ -614,6 +615,8 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma) ...@@ -614,6 +615,8 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma)
(vma->vm_end - vma->vm_start - 1), (vma->vm_end - vma->vm_start - 1),
}; };
if (!(vma->vm_flags & VM_SHARED))
return;
p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma); p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment