From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: Re: [LSF/MM TOPIC] Discuss least bad options for resolving longterm-GUP usage by RDMA Date: Thu, 14 Feb 2019 12:50:49 -0800 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 Return-path: Content-Disposition: inline In-Reply-To: <20190214202622.GB3420@redhat.com> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-rdma@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.