From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:49083 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933649AbdAKNAR (ORCPT ); Wed, 11 Jan 2017 08:00:17 -0500 Date: Wed, 11 Jan 2017 14:00:08 +0100 From: Johannes Thumshirn To: Jeff Layton Cc: Alexander Viro , "J . Bruce Fields" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mbenes@suse.cz, jack@suse.cz Subject: Re: [PATCH RESEND] splice: introduce FMODE_SPLICE_READ and FMODE_SPLICE_WRITE Message-ID: <20170111130008.GE6286@linux-x5ow.site> References: <20170111095139.17783-1-jthumshirn@suse.de> <1484137213.2621.6.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1484137213.2621.6.camel@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Jan 11, 2017 at 07:20:13AM -0500, Jeff Layton wrote: > On Wed, 2017-01-11 at 10:51 +0100, Johannes Thumshirn wrote: > > Introduce FMODE_SPLICE_READ and FMODE_SPLICE_WRITE. These modes check > > whether it is legal to read or write a file using splice. Both get > > automatically set on regular files and are not checked when a 'struct > > fileoperations' includes the splice_{read,write} methods. > > > > Could you add a description of the problem that this solves? I assume > you hit a problem trying to splice to/from a non-regular file, but it'd > be good to know what that problem was. The problem is that a driver's ->write() is called under KERNEL_DS this way. This happened for sg and bsg and caused 128394eff 'sg_write()/bsg_write() is not fit to be called under KERNEL_DS' as well as a0ac402cf 'Don't feed anything but regular iovec's to blk_rq_map_user_iov'. There have also been patches for InfiniBand AFAIR doing similar things. So this is to solve it for future abuses. HTH, Johannes -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg GF: Felix Imend�rffer, Jane Smithard, Graham Norton HRB 21284 (AG N�rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850