Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp70976pxk; Wed, 16 Sep 2020 19:14:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWYNcduayJQtt/uz8XImBhfu9LsENtTy2A5xwtmYJEhxls6sMasp4mbu4v/hmj2fHmi5eS X-Received: by 2002:a50:fe82:: with SMTP id d2mr29702177edt.86.1600308895866; Wed, 16 Sep 2020 19:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600308895; cv=none; d=google.com; s=arc-20160816; b=qNMi1xzXDe/9o7yFmQnOBso7oCgFDKYLpv1a+TQ/u4Uv6cuoeQzKp0LHRI4oWMLSMI guOeSJkvp/99ImKnpVetAW4VUIQfwMCrdyFZFPDZcz/hNh6hksLMKzuZ4geMlQLX5fII hjcIYNlBGq82ChhjcJ6uMXJdLOSQWGb4031uTH2AejuMXD6rpV23b5rc+bObp71Ukmzd lFSaExsMUm5NJbnX80uwRHInZHdMom+AlKzft7pDE5F9O7qHOiPTe7UmbygAN3QOp/wQ vITKuKsZVWS/NATm0OADAxnlU/am4FVa8jwHRFe0p7WQRKYBCgiFgJLmPWEyZWYpeY+9 VIQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=FvBdfI3/8JYEzHDwTJchNGznx9TCTfOWN6nMTk+cWRg=; b=mNFuICYLSgAlVF/CEj0S50JbJySVoj3mDUkbEi+yVuDxkcL06i8ux7LrR8RSBMcCIc ElygNZHASPmCA821yS4suJcGhd7QIv2kJwgn0csTzTmjRBn4fYUaF4s8MCpcdEK9CZmT 6WCMPnyz5FZnrfpbF8dU8Zvy7mA20O0MblB6GEiY0voACO7dkwCFSyTD3wkDzxnaZI32 ROBv9UAFz8xU0sMgdr/ctgt/0szIRzTvJoCh0i7I184TKgY88+7rbHKBhjdqfXyXiejD 7FGWNfsYBsC4OXt2W98BFdfoiUHk7isGW0EDgjYJEjd0yERPjE/46uLxDFMWBJn0w7Yt Ic1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SxAIwAWl; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si13121798eje.58.2020.09.16.19.14.32; Wed, 16 Sep 2020 19:14:55 -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=@google.com header.s=20161025 header.b=SxAIwAWl; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726192AbgIQCNW (ORCPT + 99 others); Wed, 16 Sep 2020 22:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbgIQCNA (ORCPT ); Wed, 16 Sep 2020 22:13:00 -0400 X-Greylist: delayed 462 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Sep 2020 22:13:00 EDT Received: from mail-oo1-xc43.google.com (mail-oo1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95C25C06174A for ; Wed, 16 Sep 2020 19:05:15 -0700 (PDT) Received: by mail-oo1-xc43.google.com with SMTP id g26so181951ooa.9 for ; Wed, 16 Sep 2020 19:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=FvBdfI3/8JYEzHDwTJchNGznx9TCTfOWN6nMTk+cWRg=; b=SxAIwAWl1MqxQGVya1/LLGYLyQUf80qPgV3UgTzda0zs4xtGvK+4t42qChTNnUsQp2 iidBl3RcjWjxLEf3TZErhnJNVVQbN7kfMfUmVvIATlXjukaBN+biw4DGFEtwxso0eFH3 U57Zvvxg6m/kE5XelTs1/4GU+7H9JXM071r8m/4ZtDTvnHENVfGtnySAZv4kOHTr0OEO nGgEa2imdIkbWGjE4w2eJKI3i7opSAcSjM4lAf/eWxB03Q2LwB/TXuLJwne9YkNYXg0u /h/dWj2zkQOOZ9HHYhSHhoHJtjkFEXp5gat/GmMoyC4Tw0RZhLUvTdQyQRkgrx/gGf3i dp5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=FvBdfI3/8JYEzHDwTJchNGznx9TCTfOWN6nMTk+cWRg=; b=f7W+M2RV3OiWb7eHHwz6N/TTGyURB5rIlAC37GbUVTWPx6jnnF1kMna39zV3K81rqd KkohOzSd8AI18bdiG5s0WJhKVMRT4BIgDMO2yXYRiVk2xnlCWaZKdnL4ZvTxnFQ9Gs9b XoZKjPJ5JmbdC4UFG2yqPePcwaJ14VDjtvBHdyEJDNXFW1tDzJOmu5qHOv76BerdryoL cBJRPxbbt8S4sX/ZcQPvXzR/3lnBSwF+71Vt/ZKiX4N9GF+oAIw6ALS3p/u8zcMzJAhl 4V68VcMSmOXnBp5BnizPSuCQzFRMJqHG/6p4V3A52C6ykx7pKa9sCfSL6w7rGjC47oes KmOw== X-Gm-Message-State: AOAM5335QJk+ashS8e0j2XVWKrLwdMqvTnCE3g/+KkKL5Z/kJOFmLSVj MJqPRPYl2h2ro/Lo0NbUdfufmw== X-Received: by 2002:a4a:c541:: with SMTP id j1mr19671594ooq.13.1600308314725; Wed, 16 Sep 2020 19:05:14 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id a4sm8527275oif.3.2020.09.16.19.05.09 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Wed, 16 Sep 2020 19:05:11 -0700 (PDT) Date: Wed, 16 Sep 2020 19:04:46 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Dave Chinner cc: Jan Kara , 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 , Matthew Wilcox , Linus Torvalds , "Kirill A. Shutemov" , Andrew Morton , Al Viro , nborisov@suse.de Subject: Re: More filesystem need this fix (xfs: use MMAPLOCK around filemap_map_pages()) In-Reply-To: <20200917014454.GZ12131@dread.disaster.area> Message-ID: References: <20200623052059.1893966-1-david@fromorbit.com> <20200916155851.GA1572@quack2.suse.cz> <20200917014454.GZ12131@dread.disaster.area> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 17 Sep 2020, Dave Chinner wrote: > > So.... > > P0 p1 > > hole punch starts > takes XFS_MMAPLOCK_EXCL > truncate_pagecache_range() > unmap_mapping_range(start, end) > > > do_fault_around() > ->map_pages > filemap_map_pages() > page mapping valid, > page is up to date > maps PTEs > > truncate_inode_pages_range() > truncate_cleanup_page(page) > invalidates page > delete_from_page_cache_batch(page) > frees page > No. filemap_map_pages() checks page->mapping after trylock_page(), before setting up the pte; and truncate_cleanup_page() does a one-page unmap_mapping_range() if page_mapped(), while holding page lock. (Of course, there's a different thread, in which less reliance on page lock is being discussed, but that would be a future thing.) Hugh