From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:47400 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbcI0EOT (ORCPT ); Tue, 27 Sep 2016 00:14:19 -0400 Date: Tue, 27 Sep 2016 05:14:14 +0100 From: Al Viro To: Miklos Szeredi Cc: Linus Torvalds , Dave Chinner , CAI Qian , linux-xfs , xfs@oss.sgi.com, Jens Axboe , Nick Piggin , linux-fsdevel Subject: Re: [PATCH 04/12] splice: lift pipe_lock out of splice_to_pipe() Message-ID: <20160927041414.GK19539@ZenIV.linux.org.uk> References: <20160914042559.GC2356@ZenIV.linux.org.uk> <20160917082007.GA6489@ZenIV.linux.org.uk> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Sep 26, 2016 at 03:35:12PM +0200, Miklos Szeredi wrote: > > - if (spd.nr_pages <= 0) > > - ret = spd.nr_pages; > > - else > > - ret = splice_to_pipe(pipe, &spd); > > - > > + pipe_lock(pipe); > > + ret = wait_for_space(pipe, flags); > > + if (!ret) { > > + spd.nr_pages = get_iovec_page_array(&from, spd.pages, > > + spd.partial, > > + spd.nr_pages_max); > > + if (spd.nr_pages <= 0) > > + ret = spd.nr_pages; > > + else > > + ret = splice_to_pipe(pipe, &spd); > > + pipe_unlock(pipe); ^^^^^^^^^^^^^^^^ > > + if (ret > 0) > > + wakeup_pipe_readers(pipe); > > + } > > Unbalanced pipe_lock()? Reordering braindamage; fixed. > Also, while it doesn't hurt, the constification of the "from" argument > of get_iovec_page_array() looks only noise in this patch. Rudiment of earlier variant, when we did a non-trivial loop in the caller. Not needed anymore, removed. Fixed variant force-pushed to the same branch