Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2681347pxb; Thu, 11 Feb 2021 20:51:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJyD/jwEvqoCML7gM2p/rCfYOGSyTsqzNfJThM4pfP5n/uoEKXaP7sLlvjEseyI7/nMTjD6+ X-Received: by 2002:a17:906:390c:: with SMTP id f12mr1210179eje.31.1613105461384; Thu, 11 Feb 2021 20:51:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613105461; cv=none; d=google.com; s=arc-20160816; b=t32GTPhQH3xhY/GDMfK9byd+UyLXpDF5FD4V6/S04dl9j6OWs3LPLrrqqEECNab5pe p2CSB2//HaUbTMVVGPc4azomOiUn5ulx08O63P0ny1jYK4vIx0ekHyATUcFjD1mR0tlR v8NVhMfW/8DvhUkk7muYdqvfsoQQVEGSSydl7KMb7iYlz8ImWHYR1koqDh532wPtDeYn 3xD5csSFARjLsWrOL7b9HeJgnXhMrS2ZAgHhWYOwuDNvCGf53u20nEY6rgTsG6cv6tZE lv+LbumTiL2Qg5ygVR91qQnCr+Pg2rirjQQuXE05qCaqnYR0nZoVo86LRrhqisltBInM /kqQ== 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=oT9pyCENAroqyQofR5rn6Lps4PvawUWgtEucTBqW7iw=; b=lKSis2sm/K34bvvIGvcDa6oGI9xCyXPspY6MnicoDPJ2CaYjNjxcSimOIVUTgq+CAZ NiIFfVbnGEXZQDplrcp+iXDGwcfmIUJpUh4ibrkEIRrte9ij5S7VNthcpfW0GNKXBwmA O8JqqRiwQ8VHup0uFuPoz8OkUgZMTXwWUEnh4/8ZKyY5iLxTQt/hvZeGce3CtxhhYTlA 9RCabGC6Ms9xqMSVw8zNmr27B8AIYO311gN+c1iuYyTuTvx0nTrHuuAp6cAWFB5sgylw IuHnq2oRi6ozpgV6hwZAeZQknf9V4JK0D7H4ayQ3jutEqiJDfRKqn4PqqrYXF/PwSwJm P7UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SBcCIGew; 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 y23si5402985edv.312.2021.02.11.20.50.38; Thu, 11 Feb 2021 20:51:01 -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=SBcCIGew; 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 S229710AbhBLEtw (ORCPT + 99 others); Thu, 11 Feb 2021 23:49:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbhBLEtv (ORCPT ); Thu, 11 Feb 2021 23:49:51 -0500 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC247C061756 for ; Thu, 11 Feb 2021 20:49:10 -0800 (PST) Received: by mail-vs1-xe34.google.com with SMTP id y123so4200753vsy.13 for ; Thu, 11 Feb 2021 20:49:10 -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=oT9pyCENAroqyQofR5rn6Lps4PvawUWgtEucTBqW7iw=; b=SBcCIGew+7NcUv9Rxp/TNTz7mifemsxhrM6e+hfhx5MYwXbz52Ck4QZR+r4jsLBJO2 r+XRXX2Vsw7cQ5XjHme0SSRI6NrP72/VTYwoCEGyoWYu6uo/N76xzEO8dKY70/o/Y0eo IInnBbOrjCaaoLGRVVyDTdgc3DvVHgg4DZWGI= 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=oT9pyCENAroqyQofR5rn6Lps4PvawUWgtEucTBqW7iw=; b=kyXfX9GL3tcgYnrGyRHf1PjjkFu2p9QASQ5oFnoCHBBAbTSQXZjDCkV43sFsBQPOtd 8/ftOt3W4dHiAiNl8b47ZfLXVsAUqd4vwNgtZ9fW4bQSMsH8HJeYVrkLC42Vo7uIlHYy 7LGjapMxEuKcPGSIgtAN34praUwXLmxZ7NlQSQnsv2D0qUrX0cmBaQExiTltS5Jdkm+h A4F7DmI5/3Y4/fFXf6Vv521Ezsm1SkBDFYDPra7ljDwe8whS841smMJkZ1rUy6rdGIlF ciE5nwBM0WR8UdUysyo0PgSnSEJBpwS/3H4HPModlM+YhTk13pPycPU8thwpXz4TWd/Y nrgw== X-Gm-Message-State: AOAM532PTOd0dhf45Jy6fJt0l1Qvmmtg+oJYzM5wvqMn7evS53N8juHi M4slo3Jp/03sAAlWSFGydxRlcZrGtTz+8NHdls7zww== X-Received: by 2002:a67:8945:: with SMTP id l66mr530140vsd.48.1613105349219; Thu, 11 Feb 2021 20:49:09 -0800 (PST) MIME-Version: 1.0 References: <20210126135012.1.If45b7cdc3ff707bc1efa17f5366057d60603c45f@changeid> <20210126233840.GG4626@dread.disaster.area> <20210128055726.GF7695@magnolia> In-Reply-To: <20210128055726.GF7695@magnolia> From: Nicolas Boichat Date: Fri, 12 Feb 2021 12:48:58 +0800 Message-ID: Subject: Re: [PATCH] fs: generic_copy_file_checks: Do not adjust count based on file size To: "Darrick J. Wong" Cc: Dave Chinner , Luis Lozano , Ian Lance Taylor , Alexander Viro , Amir Goldstein , "Darrick J. Wong" , 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 Thu, Jan 28, 2021 at 1:57 PM Darrick J. Wong wrote: > > On Thu, Jan 28, 2021 at 08:46:04AM +0800, Nicolas Boichat wrote: [snip] > > Okay, so, based on this and Al's reply, I see 2 things we can do: > > 1. Go should probably not use copy_file_range in a common library > > function, as I don't see any easy way to detect this scenario > > currently (detect 0 size? sure, but that won't work with the example > > you provide above). And the man page should document this behaviour > > more explicitly to prevent further incorrect usage. > > 2. Can procfs/sysfs/debugfs and friends explicitly prevent usage of > > copy_file_range? (based on Al's reply, there seems to be no way to > > implement it correctly as seeking in such files will not work in case > > of short writes) > > One /could/ make those three provide a phony CFR implementation that > would return -EOPNOTSUPP, though like others have said, it's weird to > have regular files that aren't quite regular. Not sure where that > leaves them, though... Not that simple, as the issue happens on cross-filesystem operations where file_operations->copy_file_range is not called (and also, that'd require modifying operations for every single generated file... Anyway, made an attempt here: https://lore.kernel.org/linux-fsdevel/20210212044405.4120619-1-drinkcat@chromium.org/T/#t > --D > > > > > Thanks, > > > > > > > > Cheers, > > > > > > Dave. > > > -- > > > Dave Chinner > > > david@fromorbit.com