Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4782093pxb; Mon, 15 Feb 2021 00:37:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXjsJw6abvKd93JVIJU66mpm8+Q/bSCgG2N8MJIuPIK0XUBBFXT9uVO24vN8TZxKIP+P6t X-Received: by 2002:a17:906:af86:: with SMTP id mj6mr14700449ejb.509.1613378274767; Mon, 15 Feb 2021 00:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613378274; cv=none; d=google.com; s=arc-20160816; b=rxMauJ1Kwu+G8fLn1GMzWzQRTsESjKGClqXyAzVjKj5uK3qvQaxveHbtV1pUUEP0DV nJYG0pLC0BJokDVVZYZbi1LVwZMmXVpf36mOMs/sEaY4Yi3yDJglUHHMSvyxI6HDdtM0 8iHcS6B3/iItGPt1Z1qL7spjv0sDYypgP0c2ryiZaAyDCsoxwnM7yB+HfsDRdBpKgMcI 9y8wGk8CLZ20ilCbyoMX7WXzWXSebjJNONMLCe4JM4PBhdrRNRi0OnA7u+UI46nJbBev U/x/fVDDqNR/B7ENFR43GQNDjOFCihoO7QiI/do07d8jPCgg6lzKwGVOMLfPo5MHacFL e3bQ== 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=NKqVhDv+wqqYLXzyHUri7OD4QnwvFOVmQxNNtkXqHCU=; b=VuD2BmpW6ftZLp4hfAj1QydrXI3DD0y4TQKrGg3cRqaS+eKyYEa056A7VM+4ZAlb2N SVXkkMAEJpKrP1Zmu+gwWTHyiyXh3kkgL1QJ7dWdd4UFZmknMlKjRqNQdrt4RQ73cz9P xbyJTMvVQoZ6t6c9v229xTnpjblbdVu7ql/H5sAJR3UUpzGBfIuJg8wKqTNrLNBk6TDD +yp+NPEC1g9/CVhiwqkKDRvJsdbOoMEK0yLVXILkSTQGQW2j/uATGleQiUs20e+MVktJ MlbiGyHdNxyzRipSj7dYlJBYK0mxuxI8VpDBxKQnjBHkGqpykO6US4lGyoqVYLuljokU 0aOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n2g8aeRf; 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 p11si11597686ejo.704.2021.02.15.00.37.31; Mon, 15 Feb 2021 00:37:54 -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=n2g8aeRf; 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 S229992AbhBOIbS (ORCPT + 99 others); Mon, 15 Feb 2021 03:31:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:33168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbhBOIbQ (ORCPT ); Mon, 15 Feb 2021 03:31:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0352764E00; Mon, 15 Feb 2021 08:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613377833; bh=M1yH8f5Vs5aiYy2Yl7CcI59gqMuFSQzURbN1sbR9EFw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n2g8aeRfVutEPCdSWe2sBMVt70VVxonbwr0AX2NE3r6QQTdGzBsz8/uDq9qUqhTY0 vdxcxg4GgNDoYH55WVZEE/eoH9Sz4CeAOe8JdprmC7maF2QkbGFNdXTkpFs5wxc6LU RSDbTZVX9UQmi3LGEmK2mZBWhJi7ADWIo4KLetEc= Date: Mon, 15 Feb 2021 09:30:28 +0100 From: Greg KH To: Nicolas Boichat Cc: Ian Lance Taylor , Dave Chinner , "Darrick J. Wong" , Alexander Viro , Luis Lozano , 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: <20210212230346.GU4626@dread.disaster.area> <20210212232726.GW4626@dread.disaster.area> <20210212235448.GH7187@magnolia> <20210215003855.GY4626@dread.disaster.area> 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 Mon, Feb 15, 2021 at 09:25:36AM +0800, Nicolas Boichat wrote: > On Mon, Feb 15, 2021 at 9:12 AM Ian Lance Taylor wrote: > > > > On Sun, Feb 14, 2021 at 4:38 PM Dave Chinner wrote: > > > > > > On Fri, Feb 12, 2021 at 03:54:48PM -0800, Darrick J. Wong wrote: > > > > On Sat, Feb 13, 2021 at 10:27:26AM +1100, Dave Chinner wrote: > > > > > > > > > If you can't tell from userspace that a file has data in it other > > > > > than by calling read() on it, then you can't use cfr on it. > > > > > > > > I don't know how to do that, Dave. :) > > > > > > If stat returns a non-zero size, then userspace knows it has at > > > least that much data in it, whether it be zeros or previously > > > written data. cfr will copy that data. The special zero length > > > regular pipe files fail this simple "how much data is there to copy > > > in this file" check... > > > > This suggests that if the Go standard library sees that > > copy_file_range reads zero bytes, we should assume that it failed, and > > should use the fallback path as though copy_file_range returned > > EOPNOTSUPP or EINVAL. This will cause an extra system call for an > > empty file, but as long as copy_file_range does not return an error > > for cases that it does not support we are going to need an extra > > system call anyhow. > > > > Does that seem like a possible mitigation? That is, are there cases > > where copy_file_range will fail to do a correct copy, and will return > > success, and will not return zero? > > I'm a bit worried about the sysfs files that report a 4096 bytes file > size, for 2 reasons: > - I'm not sure if the content _can_ actually be longer (I couldn't > find a counterexample) There are quite a few, look for binary sysfs files that are pipes from hardware/firmware resources to userspace. /sys/firmware/efi/efivars/ has a number of them if you want to play around with it. thanks, greg k-h