Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7222227pxb; Thu, 18 Feb 2021 04:58:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOwzcCnEEOsLF2T7dl0Du79/Gqdqq6YxOkzhyKgl6bUsMXHZVqtrU1rfipZ1ukD+uanyHO X-Received: by 2002:a17:906:5044:: with SMTP id e4mr3858975ejk.445.1613653095458; Thu, 18 Feb 2021 04:58:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613653095; cv=none; d=google.com; s=arc-20160816; b=Vzr9p8cd5T2oia/GU8ekVTTVurNB3upYrkQxPZdVJTMMlQYKBbvLIpzailfPEC9yzk 9XxFIAaZwa5+f1ihyfsxWCEM7OURs8kMZz0IOxlYcsxj1seU6seVfz5PN5LLOEfMraA7 uW4wgizhTNrgG89U5cjsdlqZiye6+Pjgn+m+v/jr8t460tMQ+QBQdTXEBcTDIK6sXUQz TXZBOQg5ltRQY/HaQeXMZ6McXg3Qh4w6/GYmgYZFHSm5GsTgUitE7sVXXdHoyVul1uGf SjXOe9MXKoiDlIgNGGhAf5Hwlr6jEjPBYI9OVTS5imSCtdYXNXHorPuakcZhAbHJX+N6 QCQw== 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=9j05/ujhefn+i0uqoNehBDttjjnrMeor9N19kGyBeSk=; b=Ei6OhbfnE6cRVX6w733PnXuT7Gmyt0kcG2rQEYwRqeX8XQYyQeeNrU4V6xEyZ8CAE+ KfS1sWcXYud9dVKa1Q2uEySCkkL6nbvTqRxXrA4l3n5IZ47PHbpKt4JSz68W/cazqzYl 3HG/cECMfv/iLfuinnkhB1wygwt2bhtNOhnU5tWB5dugTJ9Wi/uaahlkIsijULVi4ASx uT5JYIQAg9cLwRIOHx/4OlWBOiyfC7u62il9SZH1B+PctOHMkjvrTErB7MAa0rRRThrj ZqIfMbHOjxuh8z0QlfkWKFQkyot+p307AE3l3ZItnEkinOMro3VCDjZ4OTyU3ENw5KlE iT2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BfkwYu9R; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h23si360571edq.38.2021.02.18.04.57.52; Thu, 18 Feb 2021 04:58:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@gmail.com header.s=20161025 header.b=BfkwYu9R; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232653AbhBRM43 (ORCPT + 99 others); Thu, 18 Feb 2021 07:56:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233257AbhBRMuP (ORCPT ); Thu, 18 Feb 2021 07:50:15 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F70C0613D6; Thu, 18 Feb 2021 04:49:22 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id f6so1804949iop.11; Thu, 18 Feb 2021 04:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9j05/ujhefn+i0uqoNehBDttjjnrMeor9N19kGyBeSk=; b=BfkwYu9RpKR1NdZ+Nn3sljyddrWxW0TzGm16y8diuJzOvM0HGEIgJdiHtqxTPiX7Ek j4GN4sx1SqSwRXxgz/4+QWZSdEDAmCud+Xc/l8GgVQ3QyZ4WdrZLWHSo6jHo0UsjPuyS Ej2+rVCZQYJLQrae3nZuslv7pJSgbJ7zRhTgrWQ14YZQEQ0tCUZn8gGclYsGG+K75zu+ Ma9oSPHm2vYiXoafUhMU3WEsUfX0/IhfCkSx9AadJ5Y8byDm2+DZGcbvQenbbfPn/yVc M16dHHx8XlVkpjx7umh3g5yHNuMsDUb1j0JrnyF5VfVmurxyDko8EwHuwx8AXztXI9i2 DJvw== 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=9j05/ujhefn+i0uqoNehBDttjjnrMeor9N19kGyBeSk=; b=bBDYxBF3k3RRfbkfe1uYIh+S28eykQnnKR/V3cQ4qTLF7/eiZg2kYaFE3fr4gSfVoX //WKea45GmhtSqgAiM1O6cnFqlm/15ViRV81zYxoI+A4tRIFf9ACJNe0DxMtVykT7cO0 eTW1ScHjIIbDaV9KGns5QleeZsUeVV7ymPV5/RUwzEUbUTF7WfOgIccTaCjcVQ2F6RhQ fJ8FLXVBGkCBTE9DI7QXbmTlRjvTUaVbXF037bCioUSBumwxx3FjTcvISpuDAHKjTKCl 56qHT+MddVZWIriR+MwwYd+dNfbFfmYxcEuGNQzm0anE8n7/qxKhPsASSnf/ruUv89xk hHbQ== X-Gm-Message-State: AOAM532mSTIe/FdF0Gj0QbrjwZT8G1viz4gH+CCVGrM7WP85BvsjxWMq 7JEjDUXqrXTtxZsowZNHIOYr9mNZH7Y3EqJR1GE= X-Received: by 2002:a02:bb16:: with SMTP id y22mr4275297jan.123.1613652561509; Thu, 18 Feb 2021 04:49:21 -0800 (PST) MIME-Version: 1.0 References: <20210215154317.8590-1-lhenriques@suse.de> <20210218074207.GA329605@infradead.org> <87v9apis97.fsf@suse.de> <87mtw1incj.fsf@suse.de> In-Reply-To: <87mtw1incj.fsf@suse.de> From: Amir Goldstein Date: Thu, 18 Feb 2021 14:49:10 +0200 Message-ID: Subject: Re: [PATCH v2] vfs: prevent copy_file_range to copy across devices To: Luis Henriques Cc: Christoph Hellwig , Jeff Layton , Steve French , Miklos Szeredi , Trond Myklebust , Anna Schumaker , Alexander Viro , "Darrick J. Wong" , Dave Chinner , Greg KH , Nicolas Boichat , Ian Lance Taylor , Luis Lozano , ceph-devel , linux-kernel , CIFS , samba-technical , linux-fsdevel , Linux NFS Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, Feb 18, 2021 at 2:14 PM Luis Henriques wrote: > > Luis Henriques writes: > > > Amir Goldstein writes: > > > >> On Thu, Feb 18, 2021 at 9:42 AM Christoph Hellwig wrote: > >>> > >>> Looks good: > >>> > >>> Reviewed-by: Christoph Hellwig > >>> > >>> This whole idea of cross-device copie has always been a horrible idea, > >>> and I've been arguing against it since the patches were posted. > >> > >> Ok. I'm good with this v2 as well, but need to add the fallback to > >> do_splice_direct() > >> in nfsd_copy_file_range(), because this patch breaks it. > >> > >> And the commit message of v3 is better in describing the reported issue. > > > > Except that, as I said in a previous email, v2 doesn't really fix the > > issue: all the checks need to be done earlier in generic_copy_file_checks(). > > > > I'll work on getting v4, based on v2 and but moving the checks and > > implementing your review suggestions to v3 (plus this nfs change). > > There's something else: > > The filesystems (nfs, ceph, cifs, fuse) rely on the fallback to > generic_copy_file_range() if something's wrong. And this "something's > wrong" is fs specific. For example: in ceph it is possible to offload the > file copy to the OSDs even if the files are in different filesystems as > long as these filesystems are on the *same* ceph cluster. If the copy > being done is across two different clusters, then the copy reverts to > splice. This means that the boilerplate code being removed in v2 of this > patch needs to be restored and replace by: > > ret = __ceph_copy_file_range(src_file, src_off, dst_file, dst_off, > len, flags); > > if (ret == -EOPNOTSUPP || ret == -EXDEV) > ret = do_splice_direct(src_file, &src_off, dst_file, &dst_off, > len > MAX_RW_COUNT ? MAX_RW_COUNT : len, > flags); > return ret; > Why not leave the filesystem code as is and leave the generic_copy_file_range() helper? Less churn. Then nfsd_copy_file_range() can also fallback to generic_copy_file_range(). Thanks, Amir.