Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp186824imj; Thu, 14 Feb 2019 18:14:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IZVck7fUE8KgOdoVM9fmt7vM4K1grBiyW8yb8bou1qq55GJOTDAuBAwz7QdO+8SzOscengv X-Received: by 2002:a17:902:8643:: with SMTP id y3mr7698664plt.80.1550196869797; Thu, 14 Feb 2019 18:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550196869; cv=none; d=google.com; s=arc-20160816; b=SVk0j7ONXz4qMBp8p/y5TJ3FESV0Z7Xb7Q2Y0ygVRAhCaKDD2RIwIsoxvk11W3ofVb cxip1CcLaerj2DPRwJtUv4u0oqQsX18i7XaTuzOAcJFTpCsd6a1D8unDhGO5FhoPhxTC 3jUq+SuzWMWmAJ7nb8nhyMW9YIRtlcxK8TxFVm1r4/3YgJ6ZqOXP9nXJiq+M7g+jMERq AcjCCcVEstT7i9UqFLZYFb5JVdZOGXOyBYga/b4vvn0uWgyeWO5CLW2RaE5EQmOzLdDP TDz8xpglC+wfYZvGtlCzy2cA0c3KOJv7rNPIVMSmUiMnfTNuUxkEDLijV82bMTvW3xKI E8Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MeG5zKc2UE0WieoqB3MtbxjtjTruWyk7aA1ukjpUZG8=; b=p7AROEjJfHyfRGAPjAIahISJ8gDF7/7wxVluHPbT9985f9cj4bRuBZehUI37zPDN3K XavU+LrgVrdQXUfRhvG6PCUoaKw95GBo95Cd3/8XygISZsD4huqLb8vCeM9H3FjGs8t6 uRHyIV4QIane2rIKZR3MBLeqacq+aT4b82X9p0MoSyW9++bQIeAuQRCZCO02qQ8GLXHt vMtSPU/qh/kUzriEUO01jVYU27P8LSvEWwF3IMdBthQIpFHZM6VAvbVRukStS9sXWMq5 RrJud/Lp7Ihyqn7h8kjW1NJ6Ht1XdgRzrDbdHO/jzSiir3gWNW80ndkIXNjX96wPMs65 e9DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=mYsBJPmT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si3986137pll.219.2019.02.14.18.14.14; Thu, 14 Feb 2019 18:14:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=mYsBJPmT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503253AbfBNUux (ORCPT + 99 others); Thu, 14 Feb 2019 15:50:53 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:46840 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389327AbfBNUuw (ORCPT ); Thu, 14 Feb 2019 15:50:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MeG5zKc2UE0WieoqB3MtbxjtjTruWyk7aA1ukjpUZG8=; b=mYsBJPmTtZhQzy0ZO8CWKmZjk EeFJMVF6VsZNK4WQKcHFoEaGMjsISWtXhyHOzdW2h8ZWGqidCeQe6MdGafFyrmTAthg9Y6Z+BghdJ MUdM20P8ab3cw8KNk779YGfh4B9dmRQn0JQUoQ0JHntGaffI+ITQGPBYeEuW/Ja7MP/wmDzXPlXj2 K56uXU7VU2y8R/UERH5Fi5p8bthi53qYRJ/3p9Wp8Y7O+LkUJTQLLjOt8Fre5fgiVg9OkMLO2vm5N NgVbd2lJauoEGzKymG0p5O85NEPWV3cDDOqKzXmDF31tklfVsOEWh8v4Q8un8hrhhHGhRBFOC7grr mIaRDnZrg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1guNy5-0000Qd-MR; Thu, 14 Feb 2019 20:50:49 +0000 Date: Thu, 14 Feb 2019 12:50:49 -0800 From: Matthew Wilcox To: Jerome Glisse Cc: Jason Gunthorpe , Dan Williams , Jan Kara , Dave Chinner , Christopher Lameter , Doug Ledford , Ira Weiny , lsf-pc@lists.linux-foundation.org, linux-rdma , Linux MM , Linux Kernel Mailing List , John Hubbard , Michal Hocko Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA Message-ID: <20190214205049.GC12668@bombadil.infradead.org> References: <01000168c8e2de6b-9ab820ed-38ad-469c-b210-60fcff8ea81c-000000@email.amazonses.com> <20190208044302.GA20493@dastard> <20190208111028.GD6353@quack2.suse.cz> <20190211102402.GF19029@quack2.suse.cz> <20190211180654.GB24692@ziepe.ca> <20190214202622.GB3420@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190214202622.GB3420@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 14, 2019 at 03:26:22PM -0500, Jerome Glisse wrote: > On Mon, Feb 11, 2019 at 11:06:54AM -0700, Jason Gunthorpe wrote: > > But it also doesnt' trucate/create a hole. Another thread wrote to it > > right away and the 'hole' was essentially instantly reallocated. This > > is an inherent, pre-existing, race in the ftrucate/etc APIs. > > So it is kind of a // point to this, but direct I/O do "truncate" pages > or more exactly after a write direct I/O invalidate_inode_pages2_range() > is call and it will try to unmap and remove from page cache all pages > that have been written too. Hang on. Pages are tossed out of the page cache _before_ an O_DIRECT write starts. The only way what you're describing can happen is if there's a race between an O_DIRECT writer and an mmap. Which is either an incredibly badly written application or someone trying an exploit.