linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Chengguang Xu <cgxu519@mykernel.net>
Cc: ericvh@gmail.com, lucho@ionkov.net,
	v9fs-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] 9p: create writeback fid on shared mmap
Date: Sun, 6 Dec 2020 10:16:18 +0100	[thread overview]
Message-ID: <20201206091618.GA22629@nautica> (raw)
In-Reply-To: <20201205130904.518104-1-cgxu519@mykernel.net>

Chengguang Xu wrote on Sat, Dec 05, 2020:
> 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.

Hm, I guess it makes sense.

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

Will test later and add it to next then, might be a bit.


>  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
-- 
Dominique

       reply	other threads:[~2020-12-06  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201205130904.518104-1-cgxu519@mykernel.net>
2020-12-06  9:16 ` Dominique Martinet [this message]
2020-12-06 20:53   ` [V9fs-developer] [RFC PATCH] 9p: create writeback fid on shared mmap Dominique Martinet
2020-12-07  6:02     ` Chengguang Xu
2020-12-07 11:24       ` Dominique Martinet
2020-12-07 13:13         ` Chengguang Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201206091618.GA22629@nautica \
    --to=asmadeus@codewreck.org \
    --cc=cgxu519@mykernel.net \
    --cc=ericvh@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).