Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3340646pxk; Mon, 21 Sep 2020 11:03:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8kQgjHdDYkCReqC+wgIf/V/0d2Uy7X38j339LjvBtF2NDDQUPUVBu2m5VLRQnFHP3Oewv X-Received: by 2002:a17:906:9389:: with SMTP id l9mr653662ejx.537.1600711422963; Mon, 21 Sep 2020 11:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600711422; cv=none; d=google.com; s=arc-20160816; b=b215kO9Ci9NZkunkbsHllWmx7QVwDxjfioA6ZmrUaKl2sQIOr+/cE0DHZ8sXsw4AjH m9cKmVRrtVWB4Aggib39Y39ssVNhLAqNO9VD5FXZ3PBo/ffb1tS5554Fp+Bui2mPs2FM uspnj4pYJZNt4QJpPFbjQWb1Ku5NtfY51csGYHv/g6eKBicXY0KKURQ4rDp23DGM0XHj E9Y9n3UmewKpovZhXcEiL32AMsOXIbt65RYphyH2Qa4zuwSID8OVQ7V6cpYaclOg0vG8 a0qTUJ2xRFZdwhd1glpJtHw4h31/NtRAR6Ioeg0ciK2AUCk+IdMkBsGk0qgm8gOEy4wL Cvkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EYalxu71FXkhieQDqm3YOx3Lopqwd5EDbAcvH4qgOhs=; b=PuTpatr25Brbh1R9LcaTrkyHN4qtlQnP7DvAxiUiqyo4rrjoe8re8DOL0LueW2iUP+ 3dntMRyok9HuUsGNsBF+8HoVUUTtXaOHmGoMux4e4VqWmSha2bJ6wW2w9yAudppB1rsQ DakvWR3yTdUQRqZ6PRCobbbpxCUn+n0PA+TpqCz1lwwLYy2RsE9aEdECkV4a9XSMXRbb vVG25miiwP5PIu3EMDy2aLVf2MGkxNdKVLRJCGCi8JJxleVJ5rg2WN9HtvEr7WljjpaR 0hT06r34K5ooH1MRAdNkFaEdkTr4I5r80EgccE7ltTJtQ5WOH6QGpFFeUGVtr5mv5t7q xHIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cn1Zppxw; 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 n21si8520157edt.580.2020.09.21.11.03.18; Mon, 21 Sep 2020 11:03:42 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=cn1Zppxw; 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 S1727630AbgIUSAA (ORCPT + 99 others); Mon, 21 Sep 2020 14:00:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgIUSAA (ORCPT ); Mon, 21 Sep 2020 14:00:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04CE5C061755; Mon, 21 Sep 2020 10:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EYalxu71FXkhieQDqm3YOx3Lopqwd5EDbAcvH4qgOhs=; b=cn1ZppxwRY81oXiNm0vRnLyCFs Xl5xURoMhBnqr2NAEHsKV+Yt0xLaL5tT+bhVHEInqaezHoHp5ln5P0NE4NbQUyQ/JA7hTmee5MQSv Gx4g48bXYVJSDGVL4YSAf+VQIzMvlFAv+o8q5hLXRp9CBiHnAy1AqXzqyUH3ZR65gj3A2LQVw0lqH Qz1GsKVlFrTrf5GNRFnMVYe2c2MMzmOpjxQ4I5XffgCWR2Hb9GG0Zo+JWhEMO7d11kCVug0WBiHsk uzjFDYrt1qxk0nMox3iIjPWlwC0J4P5ST6FeF54rmXxKGGMdxudBsLGdsbKrQKVjihsLADUoJVGzn QR0vNZKg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKQ6J-0007Cd-IL; Mon, 21 Sep 2020 17:59:43 +0000 Date: Mon, 21 Sep 2020 18:59:43 +0100 From: Matthew Wilcox To: Linus Torvalds Cc: Jan Kara , Dave Chinner , Hugh Dickins , Amir Goldstein , Andreas Gruenbacher , Theodore Tso , Martin Brandenburg , Mike Marshall , Damien Le Moal , Jaegeuk Kim , Qiuyang Sun , linux-xfs , linux-fsdevel , Linux MM , linux-kernel , "Kirill A. Shutemov" , Andrew Morton , Al Viro , nborisov@suse.de Subject: Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages()) Message-ID: <20200921175943.GW32101@casper.infradead.org> References: <20200623052059.1893966-1-david@fromorbit.com> <20200916155851.GA1572@quack2.suse.cz> <20200917014454.GZ12131@dread.disaster.area> <20200917064532.GI12131@dread.disaster.area> <20200921082600.GO12131@dread.disaster.area> <20200921091143.GB5862@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 09:20:25AM -0700, Linus Torvalds wrote: > On Mon, Sep 21, 2020 at 2:11 AM Jan Kara wrote: > > > > Except that on truncate, we have to unmap these > > anonymous pages in private file mappings as well... > > I'm actually not 100% sure we strictly would need to care. > > Once we've faulted in a private file mapping page, that page is > "ours". That's kind of what MAP_PRIVATE means. > > If we haven't written to it, we do keep things coherent with the file, > but that's actually not required by POSIX afaik - it's a QoI issue, > and a lot of (bad) Unixes didn't do it at all. > So as long as truncate _clears_ the pages it truncates, I think we'd > actually be ok. We don't even need to do that ... "If the size of the mapped file changes after the call to mmap() as a result of some other operation on the mapped file, the effect of references to portions of the mapped region that correspond to added or removed portions of the file is unspecified." https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html As you say, there's a QoI here, and POSIX permits some shockingly bad and useless implementations.