Skip to content

Commit c87a37e

Browse files
Chengguang XuDominique Martinet
authored andcommitted
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/[email protected] Signed-off-by: Chengguang Xu <[email protected]> Signed-off-by: Dominique Martinet <[email protected]>
1 parent 089cf7f commit c87a37e

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
@@ -513,6 +513,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
513513
v9inode = V9FS_I(inode);
514514
mutex_lock(&v9inode->v_mutex);
515515
if (!v9inode->writeback_fid &&
516+
(vma->vm_flags & VM_SHARED) &&
516517
(vma->vm_flags & VM_WRITE)) {
517518
/*
518519
* clone a fid and add it to writeback_fid
@@ -614,6 +615,8 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma)
614615
(vma->vm_end - vma->vm_start - 1),
615616
};
616617

618+
if (!(vma->vm_flags & VM_SHARED))
619+
return;
617620

618621
p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma);
619622

0 commit comments

Comments
 (0)