Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3033592pxb; Fri, 12 Feb 2021 07:37:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVZrTDGZW2DlJ/HNe95FFdZRPPVn/tUm8uZGsvFmzckkYg5HO44wi3Qx5JkrLEZT4ITeU1 X-Received: by 2002:aa7:d692:: with SMTP id d18mr3973385edr.327.1613144253704; Fri, 12 Feb 2021 07:37:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613144253; cv=none; d=google.com; s=arc-20160816; b=TiMgX/t5WGa4YaKmVifQbWnRNMOu+tkJqAUkwVygVNH/tkgzwVwk+fe0xCJKpeUFV2 8CNG6g0mfvG81QS8A1KzK3702nItPsDU8Dsnj0TqiDI/yy5hWsjUlmw84Ay5VMJQCMV/ LbC15q1KwFF6Bzie8yFdSPCvjQG8DMahfcJuHcZOI9no1kkm27hr1uOcuCXYe4gjTfK8 tbbUbvv1p19SAdqjTYZG2pDjiASjrn/KjVQiLZq7yPXJOyNNpeo1PB2oemL86exr3AbF oCURFySSKnLne9BbHCIDT1FRiYBbEc+/nsLBcNhZCnNMPVJK0+OiIqt6eOJdC9dsRCVF /nQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=bnSJrWIXDrR4SdgszlbiKJGOs4XpFQvM2/Z+tUum89c=; b=LBu+buMC2rs1BNg96+VBvfDrsMqTsSxe3Ob7TmxU9pkfbrVSAo65WGlS6svN5pKQDg atetErmdsPUYO8lKIC7jzVVw7YwfVPGS0kKbITJvuLQAyrwo1kqt2eFg7ixfB40Mwb6J 9D8L2vz4F4ZiXlLzwkUydtRy8+lc8oh9IHSoQO1CkKBawJ6kU+3GpSmfIY/qL9D9cyiU Gx7UVpht+5cZPlF0ch5Ad7hPavXYLZZB2cwwMusTALrNe0ciTIYWHvVD2gvGw3oOJpKx LVClu2aa/2s+52Jqo9Ite/ttBJuvIMuqRKR6DXyJOwj2J74A3RjU5zrPuSnjvp5FKFmk 0d0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@golang-org.20150623.gappssmtp.com header.s=20150623 header.b=djI42P5x; 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=fail (p=NONE sp=NONE dis=NONE) header.from=golang.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si6283760ejj.217.2021.02.12.07.37.10; Fri, 12 Feb 2021 07:37:33 -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=@golang-org.20150623.gappssmtp.com header.s=20150623 header.b=djI42P5x; 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=fail (p=NONE sp=NONE dis=NONE) header.from=golang.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbhBLPfe (ORCPT + 99 others); Fri, 12 Feb 2021 10:35:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbhBLPew (ORCPT ); Fri, 12 Feb 2021 10:34:52 -0500 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E470AC061574 for ; Fri, 12 Feb 2021 07:34:10 -0800 (PST) Received: by mail-lj1-x231.google.com with SMTP id a22so12007298ljp.10 for ; Fri, 12 Feb 2021 07:34:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bnSJrWIXDrR4SdgszlbiKJGOs4XpFQvM2/Z+tUum89c=; b=djI42P5xOLiLflD5ZImjvpowk0ziZM+eZsnGCAwDmZk5CS0w/I9qUmHpNeteIYu2vA Wc3wO+pot9h9Zc9LPmlVZyNQXi7FOPmChl2Am3cxco58YeEdOd/XenvXO46534gXG82t lIhETD7HBsX3ibtWX4YpNUZ6LFqxmKDKOgpW9HK8jcK0yP4XPZRVXEQaJOsFi/F6gCcD nrtWhR7VUn9J4wyYk81QW1IpmI7EsekEXy4RitZqZV5jOZOg3RlJ+lXTgnROalh/Z5tj b6LW09XNYZ8XBo0LTcYOzvbtCotRDey2na4EAExsnuSnpu3iN6wA9Dh9cdPH9bPYrACR f6ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bnSJrWIXDrR4SdgszlbiKJGOs4XpFQvM2/Z+tUum89c=; b=piMOHyE02W5J9eT7he3ZZPhyRBlpEnkO2+fb7KhUJyeiNtpPxy2oPoT1rzCdKbFG/6 P8+yJh2B3XVqvYsTxS2nRDh/o7wwYVMMKEfNl4lV++dginhAx4pLxUCjYcrYuHFLQ/VX Fn+JV0feo3PHgC3sUtwnhnKX47dovcBXKFYtCQ/PrdosFcjZQe+STVT49+WM5QEhr5yg TgRznTbUP0CVtVe8vAWr3MCL5OAPopRBKT5RgY7p53LdJsfJU5D+yzv0YSMqbS53vEQy Ee1YKHzshkPhDAC2UUuyoKDu+KINoB+ZmFRthq+OnNy9D8BZz/GbnhkGDtsJJe2N9Fb6 H37A== X-Gm-Message-State: AOAM532/aUti700buWDh4yUe0Q1LJq9LyRpWYqFpzWNrhW4r+dPHu79s iCeZmiLzTUx9sjRdM5wnu8CazZA3CnFmtzm15aamag== X-Received: by 2002:a2e:95d2:: with SMTP id y18mr2071178ljh.292.1613144049145; Fri, 12 Feb 2021 07:34:09 -0800 (PST) MIME-Version: 1.0 References: <20210212044405.4120619-1-drinkcat@chromium.org> <20210212124354.1.I7084a6235fbcc522b674a6b1db64e4aff8170485@changeid> In-Reply-To: From: Ian Lance Taylor Date: Fri, 12 Feb 2021 07:33:57 -0800 Message-ID: Subject: Re: [PATCH 1/6] fs: Add flag to file_system_type to indicate content is generated To: Greg KH Cc: Nicolas Boichat , "Darrick J . Wong" , Alexander Viro , Luis Lozano , Dave Chinner , linux-fsdevel@vger.kernel.org, lkml Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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). Or, less ideally, there will be some documented way that the Go standard library can determine that copy_file_range will fail before trying to use it. If neither of those can be done, then I think the only option is for the Go standard library to never use copy_file_range, as even though it will almost always work and work well, in some unpredictable number of cases it will fail silently. Thanks. Ian