From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f66.google.com ([209.85.214.66]:35134 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753752AbcLRWK4 (ORCPT ); Sun, 18 Dec 2016 17:10:56 -0500 MIME-Version: 1.0 In-Reply-To: <20161218203003.GZ1555@ZenIV.linux.org.uk> References: <20160917190023.GA8039@ZenIV.linux.org.uk> <20160923190032.GA25771@ZenIV.linux.org.uk> <20160923190326.GB2356@ZenIV.linux.org.uk> <20160923201025.GJ2356@ZenIV.linux.org.uk> <20160924035951.GN2356@ZenIV.linux.org.uk> <87shpmxrey.fsf@linux-m68k.org> <20161218201207.GY1555@ZenIV.linux.org.uk> <20161218203003.GZ1555@ZenIV.linux.org.uk> From: Linus Torvalds Date: Sun, 18 Dec 2016 14:10:54 -0800 Message-ID: Subject: Re: [PATCH 04/12] splice: lift pipe_lock out of splice_to_pipe() To: Al Viro Cc: Andreas Schwab , Dave Chinner , CAI Qian , linux-xfs , xfs@oss.sgi.com, Jens Axboe , Nick Piggin , linux-fsdevel Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, Dec 18, 2016 at 12:30 PM, Al Viro wrote: > > OK, I see what's going on - it's wait_for_space() lifted past the checks > for lack of readers. The fix, AFAICS, is simply Ugh. Does it have to be duplicated? How about just making the wait_for_space() loop be a for-loop, and writing it as for (;;) { if (unlikely(!pipe->readers)) { send_sig(SIGPIPE, current, 0); return -EPIPE; } if (pipe->nrbufs == pipe->buffers) return 0; if (flags & SPLICE_F_NONBLOCK) return -EAGAIN; if (signal_pending(current)) return -ERESTARTSYS; pipe->waiting_writers++; pipe_wait(pipe); pipe->waiting_writers--; } and just having it once? Regardless - Andreas, can you verify that that fixes your issues? I'm assuming you had some real load that made you notice this, not just he dummy example.. Linus