diff options
author | Chengguang Xu <cgxu519@zoho.com.cn> | 2019-08-20 06:03:25 -0400 |
---|---|---|
committer | Dominique Martinet <dominique.martinet@cea.fr> | 2019-09-03 06:56:32 -0400 |
commit | c87a37ebd40b889178664c2c09cc187334146292 (patch) | |
tree | b22de8286db49fc7416431010267f6267c161da4 /fs/9p | |
parent | 089cf7f6ecb266b6a4164919a2e69bd2f938374a (diff) |
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.cn
Signed-off-by: Chengguang Xu <cgxu519@zoho.com.cn>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/vfs_file.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 4cc966a31cb3..fe7f0bd2048e 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -513,6 +513,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma) | |||
513 | v9inode = V9FS_I(inode); | 513 | v9inode = V9FS_I(inode); |
514 | mutex_lock(&v9inode->v_mutex); | 514 | mutex_lock(&v9inode->v_mutex); |
515 | if (!v9inode->writeback_fid && | 515 | if (!v9inode->writeback_fid && |
516 | (vma->vm_flags & VM_SHARED) && | ||
516 | (vma->vm_flags & VM_WRITE)) { | 517 | (vma->vm_flags & VM_WRITE)) { |
517 | /* | 518 | /* |
518 | * clone a fid and add it to writeback_fid | 519 | * 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 | (vma->vm_end - vma->vm_start - 1), | 615 | (vma->vm_end - vma->vm_start - 1), |
615 | }; | 616 | }; |
616 | 617 | ||
618 | if (!(vma->vm_flags & VM_SHARED)) | ||
619 | return; | ||
617 | 620 | ||
618 | p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma); | 621 | p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma); |
619 | 622 | ||