From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F84DC43381 for ; Thu, 14 Feb 2019 20:50:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF29A21B68 for ; Thu, 14 Feb 2019 20:50:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mYsBJPmT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503257AbfBNUux (ORCPT ); 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.