Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp353901pxb; Fri, 8 Jan 2021 06:45:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2/I4jFolGO78svveTqHUdF2/koFFXD2TF0OiZ200eqKSfniOAGWJz7g2B2I1cGvAyes87 X-Received: by 2002:aa7:c253:: with SMTP id y19mr5434384edo.179.1610117135435; Fri, 08 Jan 2021 06:45:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610117135; cv=none; d=google.com; s=arc-20160816; b=yr9KEsrdFYcqv5+oiHTha+ZaX3V0or29l484D+7Zatq4Riv0K+ogaZUzOgTKQdH2KH BX/Ej72Wk8pSiYjBnQdllUStyQ+f71Yt3iNiELeAIPq3BK3e99BlZNOgzkCyR6vA08yO VEneZi65tONqpFCGJwZG3vWvUMdvC0jcADENV4l0lL/Gdw9Fll/rJUV0PSWpCawpP47s RzwTSOxzTM1XJ0y2lrA4Q9tKlo8D7FsWgKfb6Ev957Wofi+kg1MnYdxPl9NIWCmhtr/2 2gBaYHj+DiGF7L8RW87eK5FmzxRyNb43AaZm3lpYqh7wbPBHiYvBO93FCVunlb2rnk4H H7TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=o8eniqMPi82qSP0ED8n/0o70+Qr03QxsLVoI41ONZ38=; b=MEoFuXu7JA4m6LzMTybWbp0V8Eo+cxCGfAEFpVFHSY1GNH4ABEGUoMlRt1xjpmaauF aYFM/guwNPTnghxi4qWrm2lFQLsqf6iQ9fuFBZXOm98Ef1u70reSmCKsc6sLWlCr68+U JafvyYAEGhSnVVVEcEN7SoVBE12ep+ewu6bwIT61ULump3vDfDw78HeWjRV8BqlA1KOs LDgKV6lH0aZ1kwPXB0evGGCQLqsBNpU+cVMcyr7RgP2k5l8d/06WZvz0Cls/FfeUlB5W jqS23YyJ76YvfaB4O/VGDT+TyLc0BAJqlInA3Lc7LtCov0Q2GuLFfhIh3m2Os6U1WAXT Kbsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v/HqKeZj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q21si3547460ejd.515.2021.01.08.06.45.11; Fri, 08 Jan 2021 06:45:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v/HqKeZj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727130AbhAHOoX (ORCPT + 99 others); Fri, 8 Jan 2021 09:44:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:48164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbhAHOoW (ORCPT ); Fri, 8 Jan 2021 09:44:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC3982388B; Fri, 8 Jan 2021 14:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610117022; bh=Cp2wA57ecYdtDg0Wseygbmw/tUYcjrk2toCIX0dnUWw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=v/HqKeZjizb5BXQakcncaHA/bYJVzNoAVhAR5FHpcDO0H7h/eoBWy1e7oITDYZXkS FoPG8p7YJvlQIqPGXKf3EiBexVAMs4Z6RaEroVfxBbW6SA9CGvx+59VYuLOeqYJ8Zm meL6Fj2F55KQVdhrhBq7t6PfmUC6k4W1VFeUwzNY= Date: Fri, 8 Jan 2021 15:44:59 +0100 From: Greg KH To: Siddharth Gupta Cc: mcgrof@kernel.org, rafael@kernel.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Linux Kernel Mailing List , "psodagud@codeaurora.org" Subject: Re: PROBLEM: Firmware loader fallback mechanism no longer works with sendfile Message-ID: References: <7e6f44b1-a0d2-d1d1-9c11-dcea163f8f03@codeaurora.org> <180bdfaf-8c84-6946-b46f-3729d4eb17cc@codeaurora.org> <62583aaa-d557-8c9a-5959-52c9efad1fe3@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62583aaa-d557-8c9a-5959-52c9efad1fe3@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 07, 2021 at 02:03:47PM -0800, Siddharth Gupta wrote: > On 1/6/2021 2:33 AM, Greg KH wrote: > > > > > Since the binary attributes don't support splice_{read,write} functions the > > > > > calls to splice_{read,write} used the default kernel_{read,write} functions. > > > > > With the above change this results in an -EINVAL return from > > > > > do_splice_from[4]. > > > > > > > > > > This essentially means that sendfile will not work for any binary attribute > > > > > in the sysfs. > > > > Have you tried fixing this with a patch much like what we did for the > > > > proc files that needed this? If not, can you? > > > I am not aware of this fix, could you provide me a link for reference? I > > > will try it out. > > Look at the series of commits starting at fe33850ff798 ("proc: wire up > > generic_file_splice_read for iter ops") for how this was fixed in procfs > > as an example of what also needs to be done for binary sysfs files. > I tried to follow these fixes, but I am unfamiliar with fs code. I don't see > the generic_file_splice_write function anymore on newer kernels, also AFAICT > kernfs_ops does not define {read,write}_iter operations. If the solution is > simple and someone could provide the patches I would be happy to test them > out. If not, some more information about how to proceed would be nice. Can you try this tiny patch out below? thanks, greg k-h diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index f277d023ebcd..113bc816d430 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -968,6 +968,8 @@ const struct file_operations kernfs_file_fops = { .release = kernfs_fop_release, .poll = kernfs_fop_poll, .fsync = noop_fsync, + .splice_read = generic_file_splice_read, + .splice_write = iter_file_splice_write, }; /**