Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2435949pxu; Mon, 7 Dec 2020 06:38:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsUKoNszeaPoWQF4i7U/4DYMIfaHS4cp1XZI2eUIu/XwZEroyJfrFSWf4Kz0GMeqUdt7F+ X-Received: by 2002:a05:6402:4cf:: with SMTP id n15mr20242490edw.241.1607351893116; Mon, 07 Dec 2020 06:38:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1607351893; cv=pass; d=google.com; s=arc-20160816; b=XFbvyg+YcpCynjb14kP2ps4vcoixnqeD9u5HUwWWQxIw7TNWaFEV98vMvBfwFBNX6O jeTB5VYa/YcspNz8xPMWpl+ymPIjO5WGG+B6DDs3JdcykS5Dkpc4R7aIAr9BBBnUXVlq BZRUR28HPwvc7HGFgTpCNLT9aa62ZUiYNXMq/Vh8c15GPiYluMTsiLP9UUbhRSOuHUD3 ehDSdF8A82t/qjv4cN4PZfii41mj/9vtsDOiWFav6LgdLYk7T+Dhsko81oN+j/7DIzXU tyGuT0pr15NIgMvw3BQ/MkiKt9cODOCvvZZCoXEcHAXowf1fKPwXENDR+DpiNHvnxJss JwqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :subject:message-id:cc:to:from:dkim-signature; bh=qAszKcLYs9jvnFBEg3/CMi/T/+x65cdwThphUbpHziw=; b=EdfTVgsrpEczadklu1NGLUL+/8U9khv1Z3myV53LUCJezNiJj5CQkp/CUMa+qWg+LM x5N7CT/NtKPBO84AuGXvCq7MO9FX6l62K6XTTeLIPTk/Kwl6Bx6Ys2WCgMnZK1k79Ui2 ir8cl23MHxyFsEwRUZo4SL6If0584EafRQpaEt7EZhjpzsK5iGSzfK8TXfWOHqhoyKni h8MRfJi4tZAfyvE03XXgBMV/mQqbg7zpXXkwyYQnHzReHKpmE4u7FORTsSyZaiaTJHpu mbSkFnwg+CFx1c3ekIFCBWoe+b9k6kmQeT3a+0hKlJ2dEI57ww1rx5ZS9WeJG+1y4LZ/ yB2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b="dj/a+CSI"; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si6589957ejq.297.2020.12.07.06.37.48; Mon, 07 Dec 2020 06:38:13 -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=@mykernel.net header.s=zohomail header.b="dj/a+CSI"; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726207AbgLGOgE (ORCPT + 99 others); Mon, 7 Dec 2020 09:36:04 -0500 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17183 "EHLO sender2-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbgLGOgE (ORCPT ); Mon, 7 Dec 2020 09:36:04 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1607351632; cv=none; d=zoho.com.cn; s=zohoarc; b=YIBQJTwK0P3P0O06iqP9RoOLLaL7I0s38rXyqtZ3FREMhcy7N7WIB8WC6UFYRg+ntrjBHsXQedtiRsSB7FbxIDH8CjiqFx3Tc5k+NNkXmq/FJNW+sLpORTNMDFO0nQhl8KBsPp/DG0l1gYbTMCzyOc8zkGWLVanj2cBBH+Yn61Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1607351632; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=qAszKcLYs9jvnFBEg3/CMi/T/+x65cdwThphUbpHziw=; b=m7Y8iGDX+2yJwHy7Cvwk9SJ8uKBpQet+FYjkPGdd/7OPPuwCtPPSiv2IHhB2v9lhnL214Yn470oMo3KngUSZLr1nB1dVdTA4UUx2+6NHyKhko7wSfGuk9eoLKjjub3I4LZBVFfWUK6L6B4SzSuyq5LQEZ6qZWQxiBd2v37ej7NU= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1607351632; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=qAszKcLYs9jvnFBEg3/CMi/T/+x65cdwThphUbpHziw=; b=dj/a+CSIz45qDn8p0Ub+rUaJ31aAS1GSCCT7f+nrgyPUD0yke/zCwNLbGt+fGVue YXl9RC1HctKwEcPvkn769WyDSlxZg3VTk3zGEfnDc+IYZALL2EzJGpvY1Zb2I/PQrya C0slcU83tOd7uTeHpwL1mOfAjMDIfjEKUG0fpeTE= Received: from localhost.localdomain (113.116.158.77 [113.116.158.77]) by mx.zoho.com.cn with SMTPS id 16073516292831021.863935117984; Mon, 7 Dec 2020 22:33:49 +0800 (CST) From: Chengguang Xu To: ericvh@gmail.com, lucho@ionkov.net, asmadeus@codewreck.org Cc: v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chengguang Xu Message-ID: <20201207143329.32730-1-cgxu519@mykernel.net> Subject: [V9fs-developer][PATCH v2] 9p: create writeback fid on shared writable mmap Date: Mon, 7 Dec 2020 22:33:29 +0800 X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- fs/9p/vfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index b177fd3b1eb3..e4256dbcb754 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -517,7 +517,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_s= truct *vma) =09mutex_lock(&v9inode->v_mutex); =09if (!v9inode->writeback_fid && =09 (vma->vm_flags & VM_SHARED) && -=09 (vma->vm_flags & VM_WRITE)) { +=09 (vma->vm_flags & VM_MAYWRITE)) { =09=09/* =09=09 * clone a fid and add it to writeback_fid =09=09 * we do it during mmap instead of --=20 2.26.2