Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4612353pxb; Sun, 14 Feb 2021 17:29:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyI0ChpfXs1wtL4p1OpOW7l3hZyNawywps2sKj1fehIFvo4UjC2f+LjcZOZ6u8xw+V1RJRT X-Received: by 2002:a50:fe86:: with SMTP id d6mr13430978edt.80.1613352566883; Sun, 14 Feb 2021 17:29:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613352566; cv=none; d=google.com; s=arc-20160816; b=Gt2GKGLootOtNNLJfke+DxASNOfbC2Np6FG1rO1CVf4WmUypOMBbB2XaxN4haXG96U 9j5reppOrVn+I8O2VZ8GP70fdINKOmEMxYAhOkWnMV6rZtTRtaz/zHoAKCrRzg5TNkQg hmR5jm/WWl54wWBvtYIM6VuSJiPfjpWFeMTWc0jnVcam+PkjyoCadL1xYayBRA8oDENB T3btnM1AcecsRs38YSrQeK0fvjgRDtRPzcmYFgWBytnX0t/XkuZdq1jy6P0PCk+MtCq7 uitBX2qTtM0A1ZgaMuQZGVzWhYuI3ylcsu57tcyhHTXWN5JJzsR7NtHzv52R/XR18Jv2 ndlA== 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=nqWxVX3tai8d6xQXNuc7CwStRoLgRKEWoNr21bE/mSo=; b=SWN+loQxnPeHvgnO+tMULyxWLMA8u8wbVZBb9XL/AXDpta+CGXamZ0/a5gFggyFon6 R9fRfd0dA3kqopsT33+qhxUY2+vRyKjU2qeiu9xm5502iHczElYdMoplNqXHyolg46nF aCoDOeP2BjaNcL8O3Rg7kGn8u068GztRKzmuFVaEKaKgNeKQfpj2Zz73J0bVQhe0Spmd NFNA0qyvfwTXg4Uq23bK/eGVmUaZfSUNpF2Je3Q1zZcS2a6CVeQ9GMMmRC7DJR5BfEkF VCqnvLj+mc6FXWyaKZFqrtssYvmmfALJEgwdl1WCkKMwZwBonQ418Osz57hOzZl0Wkc5 nTrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QOpoZzZa; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb23si10615581ejc.382.2021.02.14.17.29.03; Sun, 14 Feb 2021 17:29:26 -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=@chromium.org header.s=google header.b=QOpoZzZa; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229961AbhBOB0a (ORCPT + 99 others); Sun, 14 Feb 2021 20:26:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbhBOB02 (ORCPT ); Sun, 14 Feb 2021 20:26:28 -0500 Received: from mail-vs1-xe2d.google.com (mail-vs1-xe2d.google.com [IPv6:2607:f8b0:4864:20::e2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58183C061574 for ; Sun, 14 Feb 2021 17:25:48 -0800 (PST) Received: by mail-vs1-xe2d.google.com with SMTP id x201so2595012vsc.0 for ; Sun, 14 Feb 2021 17:25:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nqWxVX3tai8d6xQXNuc7CwStRoLgRKEWoNr21bE/mSo=; b=QOpoZzZaeSCQbZPr1cTUfUvf2158J9Niprw8W19J41RTckcu2Nv8IiqjG1ZyyfpZBP CxrzJD6dUjPg7Wd3LyI9B4r194w2v0RhKtJ7jd+Ocsy+T54GULfQKFE7NdL5uDGYBx4x buYdYsItgZcFvPSVhd2I1nKFsc9X5Cha3B9jU= 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=nqWxVX3tai8d6xQXNuc7CwStRoLgRKEWoNr21bE/mSo=; b=VXXL4Kt6jre+zudKISTvs+6JAqg4LQtan279z4rmDLluapF39LQwQUNjiGV3JV+nok zEvJbyZpDypmQzwzBZ1S6PhOT5eRTcyQuSRBw3Hul+87k1mGZw8SPCYlRigM965822CJ yHbnH/ZlLZTfpuSyi4PC2OxEwEzEdXRYzuR/h5wgemaerUsRpNo4bTzEXj9v6Y96kOck YLmcGZVnuKHIa/pEA16ekrqNK7wy7w8/uHaCCYwcE8z+w0vspYgDWXa97fObzJaoWAT5 XUyMY4kbr+mIQkTpzw96AfWQ6Tag7M6IT/sLt1Nl31L1Vc1JiC7iputmnKv4/kAT/Vqo gEHw== X-Gm-Message-State: AOAM532FGdIfewWvbd0ZroPrg0oL80XY+/l9rTIO/7A341oQHP+8eEIC 2Cy1TxiYdMnZF65BRp+SBX3M1tUTzcNrPpegimHvGA== X-Received: by 2002:a67:e119:: with SMTP id d25mr7271805vsl.16.1613352347038; Sun, 14 Feb 2021 17:25:47 -0800 (PST) MIME-Version: 1.0 References: <20210212124354.1.I7084a6235fbcc522b674a6b1db64e4aff8170485@changeid> <20210212230346.GU4626@dread.disaster.area> <20210212232726.GW4626@dread.disaster.area> <20210212235448.GH7187@magnolia> <20210215003855.GY4626@dread.disaster.area> In-Reply-To: From: Nicolas Boichat Date: Mon, 15 Feb 2021 09:25:36 +0800 Message-ID: Subject: Re: [PATCH 1/6] fs: Add flag to file_system_type to indicate content is generated To: Ian Lance Taylor Cc: Dave Chinner , "Darrick J. Wong" , Greg KH , Alexander Viro , Luis Lozano , 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 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) - If you're unlucky enough to have a partial write in the output filesystem, you'll get a non-zero return value and probably corrupted content. > > Ian