summaryrefslogtreecommitdiff
path: root/fs/9p
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@zoho.com.cn>2019-08-20 18:03:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-11 18:18:38 +0200
commit338aec3e9d33e4947bd4f6c29a5ee9259dc21ec7 (patch)
tree13bb836639c827dc1464a2c1bad14455d2b4d429 /fs/9p
parent576a47e933cfd267953d54f99a647fb22fd014e8 (diff)
9p: avoid attaching writeback_fid on mmap with type PRIVATE
[ Upstream commit c87a37ebd40b889178664c2c09cc187334146292 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 89e69904976a..2651192f0166 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -528,6 +528,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
v9inode = V9FS_I(inode);
mutex_lock(&v9inode->v_mutex);
if (!v9inode->writeback_fid &&
+ (vma->vm_flags & VM_SHARED) &&
(vma->vm_flags & VM_WRITE)) {
/*
* clone a fid and add it to writeback_fid
@@ -629,6 +630,8 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma)
(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);