Skip to content

Commit 16a56a8

Browse files
Chengguang Xugregkh
authored andcommitted
9p: avoid attaching writeback_fid on mmap with type PRIVATE
[ Upstream commit c87a37e ] 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/[email protected] Signed-off-by: Chengguang Xu <[email protected]> Signed-off-by: Dominique Martinet <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 14793a8 commit 16a56a8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/9p/vfs_file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
528528
v9inode = V9FS_I(inode);
529529
mutex_lock(&v9inode->v_mutex);
530530
if (!v9inode->writeback_fid &&
531+
(vma->vm_flags & VM_SHARED) &&
531532
(vma->vm_flags & VM_WRITE)) {
532533
/*
533534
* clone a fid and add it to writeback_fid
@@ -629,6 +630,8 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma)
629630
(vma->vm_end - vma->vm_start - 1),
630631
};
631632

633+
if (!(vma->vm_flags & VM_SHARED))
634+
return;
632635

633636
p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma);
634637

0 commit comments

Comments
 (0)