Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3075482pxb; Fri, 12 Feb 2021 08:35:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxd6I/Rsq8s1Yhj7LzCyP6ZEAXXi3ATZAufaXZZwY/FCqB+rORbuzPEIq/YF9tKj+ao10Y9 X-Received: by 2002:a05:6402:190a:: with SMTP id e10mr4307978edz.110.1613147712521; Fri, 12 Feb 2021 08:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613147712; cv=none; d=google.com; s=arc-20160816; b=0WMU9BnxNaunzWvsghIkGHrhMrU7g50i8yos1UHI7q3xo7w96BOgVBSyWmbb4D3iYG CM8HTyERtFLNuFCygEwQnNvt/rr2L+Qq3JnSuK0j4qEfWFvm9172XNxPhiLKTN/PFiwi XRiUmy+VYcWSmeLLMRauGLbcu3KVgfuHGXq7MyqsXb9u5HKkGDCFfSK6XU23+o6jRD3W txxWXFmPwc6SBT60QZG26mIEaXw4lEpYyXCZB6/zLg2tkVschL4A+/RkBiMaOQk1iJ9J wjiF02kX4FDnvYIKSm21EBIGKHsv2HmbrLaEUdLn5Zzgnkn7oxG7XfXOndL4LW6XDocr 5Elw== 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=rFAay31aBgfrybdGdRB0E0f96PYT/Zp63sGtu184Jko=; b=ux/h7ng1u0/64TWxmBvOoQUskqyrV0RWBMAJJ98A0efY7+iep1AKu0lJ+S8+aNiXl+ 49JJHHPke71crYxzwrXMnKmmXe11OVkpUxkcomQ+/1d+VF0tApM0PtnS0z39vy6/kQTT 9h0CIV6GxA338Uro9ey625Iz7YR6zUIUS3pFe+4ZhUcRvA031BXS+YoyuS9dCjr8omtf w3RpO0Pi259eb4ZZVHsKn71sQsXtCwvAquZXMZOhlGMKQgd1u6HIRPtfPs8vCxI7G7Q+ 0QcdySM6Kl7WbSuCO/1SZDEFn+fyAKwrdbklxwtmzRucWT43ziVkUdx/ralWTuOo/FWI OyUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BKjEIsD0; 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 p7si6359670ejf.627.2021.02.12.08.34.49; Fri, 12 Feb 2021 08:35:12 -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=BKjEIsD0; 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 S230052AbhBLQeD (ORCPT + 99 others); Fri, 12 Feb 2021 11:34:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:36418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbhBLQ3e (ORCPT ); Fri, 12 Feb 2021 11:29:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 491A064E79; Fri, 12 Feb 2021 16:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613147332; bh=HcsDS6mK0dG0cq9UXuHaCkpq0Hiag5dWMSDBV6jX+fw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BKjEIsD0X86TF2KC4H104I1s9B5fYADy3zGRP/pcFLHhYDNI0IvNQzzcc0sAqES1L sCJjsBdI34UGEyhpECUgisxlHMZo6UkgofcV+AFaenVxCJjN6U2U/BBXxDRWhTpGcv C4EbRwLlvMx/T3EBrpHOc/ToISs9WjSIOnmUlX8E= Date: Fri, 12 Feb 2021 17:28:50 +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:59:04AM -0800, Ian Lance Taylor wrote: > On Fri, Feb 12, 2021 at 7:45 AM Greg KH wrote: > > > > 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? > > I don't work on the kernel, so I can't tell you which it is. You will > have to decide. As you have the userspace code, it should be easier for you to test this on an older kernel. I don't have your userspace code... > From my perspective, as a kernel user rather than a kernel developer, > a system call that silently fails for certain files and that provides > no way to determine either 1) ahead of time that the system call will > fail, or 2) after the call that the system call did fail, is a useless > system call. Great, then don't use copy_file_range() yet as it seems like it fits that category at the moment :) > I can never use that system call, because I don't know > whether or not it will work. So as a kernel user I would say that you > should fix the system call to report failure, or document some way to > know whether the system call will fail, or you should remove the > system call. But I'm not a kernel developer, I don't have all the > information, and it's obviously your call. That's up to the authors of that syscall, I don't know what they intended this to be used for. It feels like you are using this in a very generic "all file i/o works for this" way, while that is not what the authors of the syscall intended it for, as is evident by the failures that older kernels would report for you. > I'll note that to the best of my knowledge this failure started > happening with the 5.3 kernel, as before 5.3 the problematic calls > would report a failure (EXDEV). Since 5.3 isn't all that old I > personally wouldn't say that the kernel "has always worked this way." > But I may be mistaken about this. Testing would be good, as regressions are more serious than "it would be nice if it would work like this instead!" type of issues. thanks, greg k-h