Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1360402pxu; Sat, 5 Dec 2020 13:09:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDWRoxFmt7cTrfLTRq8ri02UHkUFzzWSRAZQNpRInAiCVQXAoE1HHjFb/jm+16kktjn2zw X-Received: by 2002:a17:906:8c7:: with SMTP id o7mr13334995eje.413.1607202590651; Sat, 05 Dec 2020 13:09:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1607202590; cv=pass; d=google.com; s=arc-20160816; b=ZIbUmK55OCUAdqhoBJxeiHGeawfESxVS2Q4vX07p3SDNifO/8kWkYvA8xNgo+3gCUK AW9XlkEZVonC2J0m8FPp/rFURDgG1X+pO+jNIis3W6BELKNlbyZARtllCmW3sJo4kat4 Pi+BHJmVPRvWH4HT0fNcCL9iglwWh8HQu0H3c34jNPRdSWqFBLur0Np+EFoSAHu1WO0v fhjlp599a09e5RD5N3FGAwK2YImbFXN1k3LrWEaDxdG6E88fuip9ayAGQacepMi849s8 zevgT3TLFUWHSfBGVUFcqXRtJvxBj+c6B79KLzgXs0YCzQUMwCwAz0beqWwYNmZtV8Y8 FTsA== 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=tHxG5co5xvuUjGQ5Eh70UR6wHrLHoiLCPbQX5DiQRrY=; b=J6kRUwya+T6Q9IP9ArIn+UakL4Tecb0sobssq9CTXJ4mGogsXqMdlL1OBZlKxLBbAj 1YPzl+sWT+WQuUgJNsRhigTBUFGUVk0UyhJXdRwtuPCZh2habNgtW0KK9GgqwBMvVT1W Plx+AP6N5xpa9SxdVYZTr4izL/jYzpdWitkEIGSTpKE0WgSJFK4mlcVEH+EZf2bGPwih cKvCI18UZdZnsSOW4DuSXmDTOdUX/ZNi2Vi7YbsRqW0OKiP42BaixGHw1PBl7guP7Yec EQsCwdSE3Lr10e/0FlmQm1bmFWPQ5WZSTTTc6H/Pj2Lizlk4++WpBC5bTaoZM42Syl6G RM8A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=ZcjEWzaY; 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 lx8si3630073ejb.559.2020.12.05.13.09.27; Sat, 05 Dec 2020 13:09: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=@mykernel.net header.s=zohomail header.b=ZcjEWzaY; 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 S1726298AbgLEVH6 (ORCPT + 99 others); Sat, 5 Dec 2020 16:07:58 -0500 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17142 "EHLO sender2-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgLEVH5 (ORCPT ); Sat, 5 Dec 2020 16:07:57 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1607173756; cv=none; d=zoho.com.cn; s=zohoarc; b=Fa5o5qvaV3+NAcvHEK9/sD7Gt2+TEJvCTssVhm9qwqM1/SAM0cfg27F7uQxp9rTZvAlZsM0BwRZ4rqCe2bQ8XKUk4M07cCVNkiZuiO19/66yXuyj8qBdXi8j5NHWVwq1N56OVD/RTv+ob5CV4jSi/jFUI9N78+YFsWadJqGyMYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1607173756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=tHxG5co5xvuUjGQ5Eh70UR6wHrLHoiLCPbQX5DiQRrY=; b=GudFEi8NTdFPYfbPhjgU4Q63vwdxmupFNfTfoX62CpVWhfqa+p6kaSKC++MGzsSoEi2hMo3DxMIYxAVKtEQict5IKF2S+jv58bo5tE6WLHWs4LDQt2gL9s47Hg1eRaRgSdy3lO4UOqc0XLyGfaOzs+zHNz+Rbxxx3SB0tBJEmpI= 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=1607173756; 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=tHxG5co5xvuUjGQ5Eh70UR6wHrLHoiLCPbQX5DiQRrY=; b=ZcjEWzaY6FIh68kUQhmOmpeB9GXZcBzOvKzuBjgx7FnyJm56OVzoQ6tG32JMqvDx 5HoqCnpjq/7g2IKUHIzJnjlRA8GXnUyTa4CxYsQOBQErUjj6m6DcZthn9v8z0KozTTW FJAsJu0Kzaz+DxmHH0R9j3ZZOoeM+KlfyBOZsO1o= Received: from localhost.localdomain (113.87.90.239 [113.87.90.239]) by mx.zoho.com.cn with SMTPS id 1607173753136251.15710636560402; Sat, 5 Dec 2020 21:09:13 +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: <20201205130904.518104-1-cgxu519@mykernel.net> Subject: [RFC PATCH] 9p: create writeback fid on shared mmap Date: Sat, 5 Dec 2020 21:09:04 +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 --- 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_s= truct *vma) =09v9inode =3D V9FS_I(inode); =09mutex_lock(&v9inode->v_mutex); =09if (!v9inode->writeback_fid && -=09 (vma->vm_flags & VM_SHARED) && -=09 (vma->vm_flags & VM_WRITE)) { +=09 mapping_writably_mapped(filp->f_mapping)) { =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