From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 0/5] splice: locking changes and code refactoring Date: Tue, 14 Jan 2014 05:22:07 -0800 Message-ID: <20140114132207.GA25170@infradead.org> References: <20131212181459.994196463@bombadil.infradead.org> <20140113141416.GA30117@infradead.org> <20140113235646.GR10323@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , Jens Axboe , Mark Fasheh , Joel Becker , linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com To: Al Viro Return-path: Received: from bombadil.infradead.org ([198.137.202.9]:55565 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbaANNWP (ORCPT ); Tue, 14 Jan 2014 08:22:15 -0500 Content-Disposition: inline In-Reply-To: <20140113235646.GR10323@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Jan 13, 2014 at 11:56:46PM +0000, Al Viro wrote: > On Mon, Jan 13, 2014 at 06:14:16AM -0800, Christoph Hellwig wrote: > > ping? Would be nice to get this into 3.14 > > Umm... The reason for pipe_lock outside of ->i_mutex is this: > default_file_splice_write() calls splice_from_pipe() with > write_pipe_buf for callback. splice_from_pipe() calls that > callback under pipe_lock(pipe). And write_pipe_buf() calls > __kernel_write(), which certainly might want to take ->i_mutex. > > Now, this codepath isn't taken for files that have non-NULL > ->splice_write(), so that's not an issue for XFS and OCFS2, > but having pipe_lock nest between the ->i_mutex for filesystems > that do and do not have ->splice_write()... Ouch... What would be the alternative? Duplicating the code in even more filesystems to enforce an non-natural locking order for filesystems actually implementing splice? There don't actually seem to be a whole lot of real filesystems not implemting splice_write, the prime use would be for device drivers or synthetic ones. I'm not even sure how much that fallback gets used in practice.