Skip to contentSkip to conversation

9p: create writeback fid on shared writable mmap

PATCH New Chengguang Xu 1 participant 1 message Dec 7, 2020 9P file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 9p: create writeback fid on shared writable mmap

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.

---
 fs/9p/vfs_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_file.c +1 -1
index b177fd3b1eb3..e4256dbcb754 100644
@@ -517,7 +517,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma)
 	mutex_lock(&v9inode->v_mutex);
 	if (!v9inode->writeback_fid &&
 	    (vma->vm_flags & VM_SHARED) &&
-	    (vma->vm_flags & VM_WRITE)) {
+	    (vma->vm_flags & VM_MAYWRITE)) {
 		/*
 		 * clone a fid and add it to writeback_fid
 		 * we do it during mmap instead of
Signature · 1 line
2.26.2