Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2381942pxu; Mon, 7 Dec 2020 05:17:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTknEF20cQl/caJSwZ/01QjXHDq1FNP/eMOxgpAPCNVUPgE7N9pcBe7Lk8WOl16Qy0ClKC X-Received: by 2002:a17:906:b143:: with SMTP id bt3mr19006245ejb.318.1607347077107; Mon, 07 Dec 2020 05:17:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1607347077; cv=pass; d=google.com; s=arc-20160816; b=QR6/NVJfQBzZhbv/Den8cKfIKBq3BlaE8Aqd2Ttg7HUm33BQUZ+Sm25IFdGqO4dPU3 qLVKF16ilhDgdPQ9y8TRNq2BLXIYldlSX/g21MN4yyw7kKTSBgoF+sayoGMDEsEi20o6 +6JUP80Aqtk8r/67mLnYGpa9Y5iQfFDMDQ7CZNMBc28+Bw7nlyVE+Orm53V/OHixk1Le 5+z96EHw4bGmviJ5zO+o2l2zdQAOPYMrO6d59f/vLRCYKBjujnG0ii2xGFAiJ23rw/vW gG4PyQvZZgSCwwypkoMjkLHhVaRFMjpllcE36aEuTDzLwH9pGksJgxIIuH9oTyeUckXP uF9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to :reply-to:from:date:dkim-signature; bh=m1EXW9UrNenJ4Drup8QUGkjJFS4dJg1NixP1O1C1HGU=; b=Q9IuxI3f68Hhv+Jwtdqa4YY2/PEk8cIlyyGEd7oA8evGDbjsQaNj7TIn4+lspv9Yfa gSMbFAlFl7jlKx8Zl7PdYTFuKS/FeKbB0v7CPRDfradniQ84ZWCIS+KsawV7QGaRcAO0 2TrHUPmQr6Mverqxj6KGLz9t0IhnHh4LhquecVVA63iTss4DUq9RaQGz0kbkHfaIYH2j cT8qPjVFzgZRuLeQoHNj8fsWGEntCT+ap1I+X29zOI6nSA+Vhiv4ABZZJGLs7as3G8Tv Kefl4taYys4HqxojfZRjOF8zZnoI2Lsb+hEGW5LUfzDH9NkqKrrgSAva84Yrl0YcHTBP H+og== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=VcZxE0Js; 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 y12si764284edp.127.2020.12.07.05.17.32; Mon, 07 Dec 2020 05:17:57 -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=VcZxE0Js; 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 S1726276AbgLGNPi (ORCPT + 99 others); Mon, 7 Dec 2020 08:15:38 -0500 Received: from sender2-pp-o92.zoho.com.cn ([163.53.93.251]:25334 "EHLO sender2-pp-o92.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725850AbgLGNPh (ORCPT ); Mon, 7 Dec 2020 08:15:37 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1607346814; cv=none; d=zoho.com.cn; s=zohoarc; b=EIPjGMUQItKAOjOMk6h5MN62nMJSt2Rj0Bc42jFqzcyRtmnsXXvk8hIqF4NNmJ7w5skB/l9RjvDSUFrBcDlXpv0JZx7Ywozhm66fbQyl8MCP/Qx/gRhZQN9Q8s+jv2gG1YYgq7hpwEoAfrgmhrQE8WJHrd5AOBc0zf5Q9PXkPPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1607346814; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:Reply-To:References:Subject:To; bh=m1EXW9UrNenJ4Drup8QUGkjJFS4dJg1NixP1O1C1HGU=; b=ihF8Uqu+wKoeIggK9To4iz6RgFX1t4n0YOk2icmDotGioXAGV2mO0qVRMhCpmLhDHGNaTXW+Xr3T+MfYctkyi6zyogBnKesdOEx1m4t7CWjcRZpkzmVlnDXFP7AcJ+f3zdwUhdY5GrXjoMMVedkpf6ln1PqsFjBKLFWhXvrHdDg= 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=1607346814; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=Date:From:Reply-To:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=m1EXW9UrNenJ4Drup8QUGkjJFS4dJg1NixP1O1C1HGU=; b=VcZxE0Js8r+IaCwt/2qgxqNYtbB3qZIsCySg+PB2exioCrQk7NrBlD+B0APiFvOM D6JdhltnbIXAk3YUdeW8eiStMEH79Sl68kJTAKXKxxFkaIZ43E5mZZBwG8iuwkah/Tj pxvpeT51S2YrX75fXlwIuXM9Fr2NRGsHMsqx7qGY= Received: from mail.baihui.com by mx.zoho.com.cn with SMTP id 1607346811183256.91092767797534; Mon, 7 Dec 2020 21:13:31 +0800 (CST) Date: Mon, 07 Dec 2020 21:13:31 +0800 From: Chengguang Xu Reply-To: cgxu519@mykernel.net To: "Dominique Martinet" Cc: "ericvh" , "lucho" , "linux-fsdevel" , "linux-kernel" , "v9fs-developer" Message-ID: <1763d55f12b.11abdd4431975.7848752990749710617@mykernel.net> In-Reply-To: <20201207112410.GA26628@nautica> References: <20201205130904.518104-1-cgxu519@mykernel.net> <20201206091618.GA22629@nautica> <20201206205318.GA25257@nautica> <1763bcb5b8e.da1e98e51195.9022463261101254548@mykernel.net> <20201207112410.GA26628@nautica> Subject: Re: [V9fs-developer] [RFC PATCH] 9p: create writeback fid on shared mmap MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: ZohoCN Mail X-Mailer: ZohoCN Mail Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ---- =E5=9C=A8 =E6=98=9F=E6=9C=9F=E4=B8=80, 2020-12-07 19:24:10 Dominique = Martinet =E6=92=B0=E5=86=99 ---- > Chengguang Xu wrote on Mon, Dec 07, 2020: > > > , VM_MAYWRITE is set anytime we have a shared map where file has > > > been opened read-write, which seems to be what you want with regard= s to > > > protecting from mprotect calls. > > >=20 > > > How about simply changing check from WRITE to MAYWRITE? > >=20 > > It would be fine and based on the code in do_mmap(), it seems we even= don't > > need extra check here. The condition (vma->vm_flags & VM_SHARED) will= be enough. > > Am I missing something? >=20 > VM_MAYWRITE is unset if the file hasn't been open for writing (in which > case the mapping can't be mprotect()ed to writable map), so checking it > is a bit more efficient. >=20 > Anyway I'd like to obsolete the writeback fid uses now that fids have a > refcount (this usecase can be a simple refcount increase), in which case > efficiency is less of a problem, but we're not there yet... >=20 > Please resend with MAYWRITE if you want authorship and I'll try to take > some time to test incl. the mprotect usecase. >=20 Thanks for the review, I'll send revised version later. Thanks, Chengguang