From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f196.google.com ([209.85.192.196]:36674 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751986AbcLJF2d (ORCPT ); Sat, 10 Dec 2016 00:28:33 -0500 Received: by mail-pf0-f196.google.com with SMTP id c4so2024511pfb.3 for ; Fri, 09 Dec 2016 21:28:32 -0800 (PST) Date: Sat, 10 Dec 2016 15:28:18 +1000 From: Nicholas Piggin To: Al Viro Cc: Jens Axboe , linux-fsdevel@vger.kernel.org, Miklos Szeredi Subject: Re: [RFC] vmsplice() and ->steal() Message-ID: <20161210152818.0c60ac01@roar.ozlabs.ibm.com> In-Reply-To: <20161210030354.GI1555@ZenIV.linux.org.uk> References: <20161210023849.GH1555@ZenIV.linux.org.uk> <20161210030354.GI1555@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sat, 10 Dec 2016 03:03:54 +0000 Al Viro wrote: > On Sat, Dec 10, 2016 at 02:38:49AM +0000, Al Viro wrote: > > vmsplice() generates pipe_bufs with ->steal() set to > > user_page_pipe_buf_steal(). What should happen when the source pages > > had code from an mmapped area and why shouldn't their ->steal() > > do what page_cache_pipe_buf_release() does in that case? > > > > As it is, e.g. fuse_dev_splice_write() getting fed that stuff could, > > AFAICS, clear MappedToDisk on such a page, scream about weird pages > > (upon noticing non-NULL ->mapping) and fall back to copying (thankfully). > > We don't have that many ->steal() users (as the matter of fact, I've > > discovered that while trying to debug the breakage in one I'd been > > trying to add), but I really wonder about the intended semantics of > > ->steal(). > > Hmm... Nope, the source of breakage is different, and these > guys will simply fail ->steal() - pages present in page cache will > have refcount >= 2 due to the buf->page contributing to it. My apologies... > > BTW, why doesn't page_cache_pipe_buf_steal() clear MappedToDisk > on its own in case of success? It probably should by the looks. Off topic, but I would like to see MappedToDisk returned to an "owner private" bit, and have filesystem ops do all the tests. Outside of the buffer_head based mappings, it's never been used enough to justify taking a pagecache-wide bit IMO.