All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] 9p: create writeback fid on shared mmap
@ 2020-12-05 13:09 Chengguang Xu
  2020-12-06  9:16 ` Dominique Martinet
  0 siblings, 1 reply; 6+ messages in thread
From: Chengguang Xu @ 2020-12-05 13:09 UTC (permalink / raw)
  To: ericvh, lucho, asmadeus; +Cc: v9fs-developer, linux-kernel, Chengguang Xu

If vma is shared and the file was opened for writing,
we should also create writeback fid because vma may be
mprotected writable even if now readonly.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
Caveat: Only compile tested.

 fs/9p/vfs_file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index b177fd3b1eb3..791839c2dd5c 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -516,8 +516,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)) {
+	    mapping_writably_mapped(filp->f_mapping)) {
 		/*
 		 * clone a fid and add it to writeback_fid
 		 * we do it during mmap instead of
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-07 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-05 13:09 [RFC PATCH] 9p: create writeback fid on shared mmap Chengguang Xu
2020-12-06  9:16 ` Dominique Martinet
2020-12-06 20:53   ` [V9fs-developer] " Dominique Martinet
2020-12-07  6:02     ` Chengguang Xu
2020-12-07 11:24       ` Dominique Martinet
2020-12-07 13:13         ` Chengguang Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.