From patchwork Sun May 9 21:39:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 12246567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F4EC43600 for ; Sun, 9 May 2021 21:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DD41613C9 for ; Sun, 9 May 2021 21:44:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbhEIVpL (ORCPT ); Sun, 9 May 2021 17:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbhEIVpK (ORCPT ); Sun, 9 May 2021 17:45:10 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439D0C06175F; Sun, 9 May 2021 14:44:06 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id h4so14536147wrt.12; Sun, 09 May 2021 14:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DBusF/KbjHCWghHBMnMPpKehqCL6Xa7jSi7F9W8BPnw=; b=NquJH4ELcrfZ2CwqHRFyicsGjSC/dPUMr2Ze4RjmfN9UV3IuIYC/wTeu3VUXiJc0k4 eRYV/Tia9lgtkPZar7Jchn2M8DbxiW4m8VU+lYi3bTm8yEJRXyGM26o+r7Qqq9v4KjIY 86hPtSo1qPmNBySrGzJtvpvw2iOYQMlSuB5nGbAYsCxaya+iLxPWR6lZP+GrBfqtGqXY LIspv5q48vmDsY3biUOXnNteFTYsspNhIJisj5I4zmibBXpZqR+JDTtmlPuhyHGIK7jL iH/E9TH7q1bl/WV94KzbN0pY10zRDDt3CBuqTCIH1Sk+lGlnype2XnSdwdehOT02hvtE 9bgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DBusF/KbjHCWghHBMnMPpKehqCL6Xa7jSi7F9W8BPnw=; b=cdu2bnIB1euN/z2X0q9UbaURrHCAu7R6mBHdfd6V5YQrcU/5Enap7JDFST8HKcC2H0 5gVy/8V/Dy2XwK9WtbXAyH7wE/maDZrsToSPwzd7Cf9XUaeP8Tg18EkJZFIPUZmDuZAN 9DCu06cTEJcVgmdJKyvqU4ctpLx89NiIztU2s7uPjwLZ75YNTeU0tRznaXsBt3LLReQW H45Z5ngPc24Ci1vcSyPc2e86lrubDbCA4movexpZeJHjxY+E9nvSoF6HeTo5/EYX+wGY ZDxuPf2BgVIA1W3mG2aixhe4SoVjBKBdP0GoxIZAhtcLRA5X3NLpjVxMINmjs/cKnnpc 6tRQ== X-Gm-Message-State: AOAM531CJbH0o0fr6dN9GobxBFPeYt4cF/pragFn6FUa5OMV669pUobs c6AfEHTbM8cHmOxaSaJirgUt7Mw9fu/rWA== X-Google-Smtp-Source: ABdhPJzvo/vbcHXbIH58HJbFF3QSN4voQDezYqeXyuqC8KbYNbm3j7DNhei/2xk3i0xTQLH+8Z/R6w== X-Received: by 2002:adf:a316:: with SMTP id c22mr26126159wrb.202.1620596645039; Sun, 09 May 2021 14:44:05 -0700 (PDT) Received: from localhost.localdomain ([170.253.36.171]) by smtp.googlemail.com with ESMTPSA id u6sm16495530wml.6.2021.05.09.14.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 14:44:04 -0700 (PDT) From: Alejandro Colomar To: mtk.manpages@gmail.com Cc: Alejandro Colomar , linux-man@vger.kernel.org, Luis Henriques , Amir Goldstein , Greg KH , Anna Schumaker , Jeff Layton , Steve French , Miklos Szeredi , Trond Myklebust , Alexander Viro , "Darrick J. Wong" , Dave Chinner , Nicolas Boichat , Ian Lance Taylor , Luis Lozano , Andreas Dilger , Olga Kornievskaia , Christoph Hellwig , ceph-devel , linux-kernel , CIFS , samba-technical , linux-fsdevel , Linux NFS Mailing List , Walter Harms Subject: [PATCH] copy_file_range.2: Update cross-filesystem support for 5.12 Date: Sun, 9 May 2021 23:39:06 +0200 Message-Id: <20210509213930.94120-12-alx.manpages@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210509213930.94120-1-alx.manpages@gmail.com> References: <20210509213930.94120-1-alx.manpages@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Linux 5.12 fixes a regression. Cross-filesystem (introduced in 5.3) copies were buggy. Move the statements documenting cross-fs to BUGS. Kernels 5.3..5.11 should be patched soon. State version information for some errors related to this. Reported-by: Luis Henriques Reported-by: Amir Goldstein Related: Cc: Greg KH Cc: Michael Kerrisk Cc: Anna Schumaker Cc: Jeff Layton Cc: Steve French Cc: Miklos Szeredi Cc: Trond Myklebust Cc: Alexander Viro Cc: "Darrick J. Wong" Cc: Dave Chinner Cc: Nicolas Boichat Cc: Ian Lance Taylor Cc: Luis Lozano Cc: Andreas Dilger Cc: Olga Kornievskaia Cc: Christoph Hellwig Cc: ceph-devel Cc: linux-kernel Cc: CIFS Cc: samba-technical Cc: linux-fsdevel Cc: Linux NFS Mailing List Cc: Walter Harms Signed-off-by: Alejandro Colomar --- man2/copy_file_range.2 | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/man2/copy_file_range.2 b/man2/copy_file_range.2 index 467a16300..843e02241 100644 --- a/man2/copy_file_range.2 +++ b/man2/copy_file_range.2 @@ -169,6 +169,9 @@ Out of memory. .B ENOSPC There is not enough space on the target filesystem to complete the copy. .TP +.BR EOPNOTSUPP " (since Linux 5.12)" +The filesystem does not support this operation. +.TP .B EOVERFLOW The requested source or destination range is too large to represent in the specified data types. @@ -184,10 +187,17 @@ or .I fd_out refers to an active swap file. .TP -.B EXDEV +.BR EXDEV " (before Linux 5.3)" +The files referred to by +.IR fd_in " and " fd_out +are not on the same filesystem. +.TP +.BR EXDEV " (since Linux 5.12)" The files referred to by .IR fd_in " and " fd_out -are not on the same mounted filesystem (pre Linux 5.3). +are not on the same filesystem, +and the source and target filesystems are not of the same type, +or do not support cross-filesystem copy. .SH VERSIONS The .BR copy_file_range () @@ -200,8 +210,11 @@ Areas of the API that weren't clearly defined were clarified and the API bounds are much more strictly checked than on earlier kernels. Applications should target the behaviour and requirements of 5.3 kernels. .PP -First support for cross-filesystem copies was introduced in Linux 5.3. -Older kernels will return -EXDEV when cross-filesystem copies are attempted. +Since Linux 5.12, +cross-filesystem copies can be achieved +when both filesystems are of the same type, +and that filesystem implements support for it. +See BUGS for behavior prior to 5.12. .SH CONFORMING TO The .BR copy_file_range () @@ -226,6 +239,12 @@ gives filesystems an opportunity to implement "copy acceleration" techniques, such as the use of reflinks (i.e., two or more inodes that share pointers to the same copy-on-write disk blocks) or server-side-copy (in the case of NFS). +.SH BUGS +In Linux kernels 5.3 to 5.11, +cross-filesystem copies were implemented by the kernel, +if the operation was not supported by individual filesystems. +However, on some virtual filesystems, +the call failed to copy, while still reporting success. .SH EXAMPLES .EX #define _GNU_SOURCE