Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3042341pxb; Fri, 12 Feb 2021 07:50:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7X2DHcY5GYKfsG+ZiCRVE0xfLyZIQI30WZ2002sSbKLxtmDakEBmw31+f3DgG4rcG2I1Y X-Received: by 2002:a05:6402:1291:: with SMTP id w17mr4098421edv.112.1613145044581; Fri, 12 Feb 2021 07:50:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613145044; cv=none; d=google.com; s=arc-20160816; b=dGch3BYc/D+7VA3k/bmCbV7gi2K45FY7rjn9ahZQgQeCzGrWG7o1R61ac6oHEYPaNU uH8/8oYEWu9k9w22aDb6/BYGUDSt7ylqIR4x1xd0nieZoM6cLvbJU7FFIUW8qgr0LXrY FLjsnidywOAsInB39iGkAoiKz/KBJiefuq8KqEFSW3SMz4bOEL8mvUByjQqBmSFQnIQs ZJC/O75ihyhBMHrG7KlaJ3qLkGvnW9dg56+q3tIH9WW6+RxIU+FyWbTKb4WNDOjcuPtp uwQ229ofDbcswtU1f3P5GzToH5vCXRH/UD0i4zaRsaFxWJs2GYffsr6FAqVGPnrE9Jpr 4/Eg== 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=T2fEApU2tNm4te79D3V0xJpmZlz5hywwRk4LOgB2kbs=; b=R0sezxKa+VbTPt58NWYVmludcm39mUY+LO5V09lCKEGR0eEZUGjN8pIWr/Jb+kzG6o 3p0oD4q8h2uUXia6ewGddn2AjjmzNwX7WESZhqoK1Fhfj8sfjy1rXabnu9Cnue4G6rmI /un8uN3sCx4nSQYxBJOGVZKN7vmko0cFTWM1Es3/uI/DXF1ljA2+6mXZnKUgMZ7ueHb+ HOz4dai0MjW2VNvwaTc7QKNWHzJpe8nG1edcvgkDrsdwmYInci7ewLEuhWs3/nwjmuIn KqRnw1Bpvt/FtXxxE7cN4mzb7s9rMmkkIA6n0dNy76Z87wtth1UdkZF9ESmBSx25cZTW B3HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K5CDgd4p; 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 i4si6823431edg.119.2021.02.12.07.50.21; Fri, 12 Feb 2021 07:50:44 -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=K5CDgd4p; 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 S232111AbhBLPqj (ORCPT + 99 others); Fri, 12 Feb 2021 10:46:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:57718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbhBLPqZ (ORCPT ); Fri, 12 Feb 2021 10:46:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B96FD64E05; Fri, 12 Feb 2021 15:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613144744; bh=qAkxI2payHVPgy5p/M13gZv73tlbs9in+RM2Honv+/s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K5CDgd4p15otjppQPBw4gXd3vHvXINpW5j1xt8ElGhl7PZkQ9gJk5zFyL5sjttTWf eYiBwuaRStYE/XhBcsNglNC5ONtvieRJTNT3Cajj2Xlxdv4FkGUkwxBTvz4cVaOTgR eZd2uY2D416b44cC7Bb/QqaJ3gFkN2WEthjBqn0Y= Date: Fri, 12 Feb 2021 16:45:41 +0100 From: Greg KH To: Ian Lance Taylor Cc: Nicolas Boichat , "Darrick J . Wong" , Alexander Viro , Luis Lozano , Dave Chinner , linux-fsdevel@vger.kernel.org, lkml Subject: Re: [PATCH 1/6] fs: Add flag to file_system_type to indicate content is generated Message-ID: References: <20210212044405.4120619-1-drinkcat@chromium.org> <20210212124354.1.I7084a6235fbcc522b674a6b1db64e4aff8170485@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 12, 2021 at 07:33:57AM -0800, Ian Lance Taylor wrote: > On Fri, Feb 12, 2021 at 12:38 AM Greg KH wrote: > > > > Why are people trying to use copy_file_range on simple /proc and /sys > > files in the first place? They can not seek (well most can not), so > > that feels like a "oh look, a new syscall, let's use it everywhere!" > > problem that userspace should not do. > > This may have been covered elsewhere, but it's not that people are > saying "let's use copy_file_range on files in /proc." It's that the > Go language standard library provides an interface to operating system > files. When Go code uses the standard library function io.Copy to > copy the contents of one open file to another open file, then on Linux > kernels 5.3 and greater the Go standard library will use the > copy_file_range system call. That seems to be exactly what > copy_file_range is intended for. Unfortunately it appears that when > people writing Go code open a file in /proc and use io.Copy the > contents to another open file, copy_file_range does nothing and > reports success. There isn't anything on the copy_file_range man page > explaining this limitation, and there isn't any documented way to know > that the Go standard library should not use copy_file_range on certain > files. But, is this a bug in the kernel in that the syscall being made is not working properly, or a bug in that Go decided to do this for all types of files not knowing that some types of files can not handle this? If the kernel has always worked this way, I would say that Go is doing the wrong thing here. If the kernel used to work properly, and then changed, then it's a regression on the kernel side. So which is it? > So ideally the kernel will report EOPNOTSUPP or EINVAL when using > copy_file_range on a file in /proc or some other file system that > fails (and, minor side note, the copy_file_range man page should > document that it can return EOPNOTSUPP or EINVAL in some cases, which > does already happen on at least some kernel versions using at least > some file systems). Documentation is good, but what the kernel does is the true "definition" of what is going right or wrong here. thanks, greg k-h