From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750991AbdALXOH (ORCPT ); Thu, 12 Jan 2017 18:14:07 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:56940 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750781AbdALXOG (ORCPT ); Thu, 12 Jan 2017 18:14:06 -0500 Date: Thu, 12 Jan 2017 23:14:02 +0000 From: Al Viro To: Linus Torvalds Cc: "Alan J. Wylie" , Thorsten Leemhuis , linux-kernel Subject: Re: 4.9.0 regression in pipe-backed iov_iter with systemd-nspawn Message-ID: <20170112231402.GD1555@ZenIV.linux.org.uk> References: <22647.59020.331664.632444@wylie.me.uk> <20170112223718.GA1555@ZenIV.linux.org.uk> <20170112224624.GB1555@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2017 at 03:02:13PM -0800, Linus Torvalds wrote: > splice(5, NULL, 1, NULL, 9223372036854775807, 0) = -1 EAGAIN > (Resource temporarily unavailable) > > and note that the commit in question introduces that -EAGAIN error code. > > The old code never returned EAGAIN at all (well, it could do so later, > if NONBLOCK was set, obviously, but that doesn't seem to be the case > here). > > So that commit seems to have introduced a new error case, and I > suspect systemd-nospawn simply doesn't handle it. It is expecting > splice_to_pipe() to actually block. > > Ergo: I think we need to do a wait_for_space() somewhere, getting rid > of the EAGAIN. > > Looking at the callers of "do_splice_to()", we already have the > wait_for_space() in do_splice(), but we do *not* have it in the > do_splice_from() case when both the input and output file descriptors > are pipes. >>From the look of his strace, the source is /dev/ptmx. Pipe-to-pipe splice goes into splice_pipe_to_pipe() anyway. do_splice_from() is pipe-to-non-pipe, and it doesn't go anywhere near default_file_splice_read()... do_splice_to() is the only thing that can call default_file_splice_read() and there are only two callers - do_splice() (with its wait_for_space()) and splice_direct_to_actor(), which has internal pipe for destination. That certainly shouldn't be calling wait_for_space() - there's no other thread that could possibly read from the destination getting more space in there. IOW, it's do_splice() -> do_splice_to() -> default_file_splice_read().