Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1608986pxu; Sun, 6 Dec 2020 01:21:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBCKrWuIcplRMtI80r62hG2kaeHN8otGzGJ5Y1nG6PYfTi05NeRqQkB9wKBOMjafg70FzX X-Received: by 2002:a50:ff0c:: with SMTP id a12mr15219367edu.79.1607246510161; Sun, 06 Dec 2020 01:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607246510; cv=none; d=google.com; s=arc-20160816; b=0gshFpjfSaV/j0m4xQZMpYZPLGciYMY3z+ELdM2Jv665Td6Rh5mNEw6sX/DpUwUMUr P7hxWnWn51tR2zFIhciiIALh5EzljnqUhQ/TKrCntRHO7eMB0V/1oWdWC2ockUJ+i+aF UM7/j0Nm3f9NGs19ykYhfep6hafMvj4qZrtCIKPGLVuSTV3sr3hUtaVhgpnNE4JIdeJD D2Asg5eZovbqgiMd2cJmpV3H9k91U0EPSLA9OSsOMdfv/y1hht5QTY4NGBbpijlcYjlL +d/yYwVDq/R94mpQdkpT4y+Jc360Mdxgld9k5wTV3nIYl0fHSUSaaWwSkz/06NXeu5tI eYhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zugEn14CrYV0HZH2U2Zour1PG68Rh0TUCnI+4h4RKWk=; b=oofVoDwDGuiqpHon3MK+H2+iQaW7uIY0axw+BpjgyiHWmdWDACJFvCH4qWM9ViP+wm pV4pRCYtK5uy2N4nNLOWnnZs/TQr8LhmCFuk224pY3dsv51vW/S9Fa8NPRrC070NAwKv 3G88nZh8mg5nWptErRyOMH1HLn+IOEwbtjuMt4jwZ1kcf6GVXJNcxD6Id2QMWqaKdD82 5OfUNvUmmZmssVkPBJzUFn6kkFH36apUR+t/kJWivmNksM7PO9ASjS1oirsoMvPHROWl iPhjKIBkrWBSJx8ynkcKRh71TMgR8dxMd4fp0zDOJXC/3I7HTpbkatFvtjW+CqNyIc0q QJHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=vGFFE46K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si56462edd.90.2020.12.06.01.21.27; Sun, 06 Dec 2020 01:21:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=vGFFE46K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726216AbgLFJRQ (ORCPT + 99 others); Sun, 6 Dec 2020 04:17:16 -0500 Received: from nautica.notk.org ([91.121.71.147]:45552 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgLFJRQ (ORCPT ); Sun, 6 Dec 2020 04:17:16 -0500 Received: by nautica.notk.org (Postfix, from userid 1001) id C4465C009; Sun, 6 Dec 2020 10:16:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1607246193; bh=zugEn14CrYV0HZH2U2Zour1PG68Rh0TUCnI+4h4RKWk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vGFFE46Kvb23tMS2cazLmKn46t7AyzpRQZi0FOKTQH88faL/MzkJlHSi9pQ2wdWe9 3x98a4S12AZC8AfDdgPbOkFAwgY2MfLtlkfxdCkJe+oslyZ0H6Z5aWVJFwTW41R1O1 fCfktrbiGZjnKejXC/Ne15i41FmIqtV5AN1Y4M2MiIiE0HenOs4lPL0FD/lGvgF6XS U/Q2cr39Iscx0OeSAd3Pnlc6OgaI8Z6XPTKrTMXpTLXmZdOK7gvlqZBmokFMRsjHZM ZeMG1ReVpTwCC86bVf89aWAFPGF3Ih39xKBY1hsadaeR+qekH1I8MNEmbGG29zjdY1 kk5ReJoSaJOPA== Date: Sun, 6 Dec 2020 10:16:18 +0100 From: Dominique Martinet To: Chengguang Xu 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 Message-ID: <20201206091618.GA22629@nautica> References: <20201205130904.518104-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201205130904.518104-1-cgxu519@mykernel.net> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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