Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3051390ybb; Sun, 12 Apr 2020 22:42:58 -0700 (PDT) X-Google-Smtp-Source: APiQypLoGFdybe8+FY7Gr3AQ3qdjxWC/slZfEWGZaQtrJyNHvkJKfzClYce9M4G9L/iRZqaQVPZr X-Received: by 2002:ac8:389b:: with SMTP id f27mr9979476qtc.39.1586756577958; Sun, 12 Apr 2020 22:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586756577; cv=none; d=google.com; s=arc-20160816; b=ZNFow9fNuEkqR1zDvBd21NEcYHSbsdsM5Y2Y9WiDIYs1DvLizqiRmzsc/99ma53T+Y kks8JMIZ2CvWdcBAl6JPTkPoALgt6KCcadqMX6myQHhlycn8+akxRxFU50bD5/+Uejw3 C369sRrDNx1DQaepFjyPEtYxENuHcydz6vBoYE5xaQaEVlw+AYay+SPYhQJclmGzok7K IQvEnbzrWPcbyL5pPo7iJCPkXVVnC2ZT+6Qmrm+W90LiyDJElm7l2Gm8TI+/9kVV5mhd 80JTZ/Ykw5XUCq2WZ+yIGoI78KFwHtMOm2sUMkosPtdmIN1zA+jzqkBwPPN7MQ7yHwQz 2thQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ANGfUKyG+6xWky2jJ2nWMKG+M8IIxgEacG/h0ycqR20=; b=QuqRYm/SYrFIJYDkY8FIbCHmZT6D2che7sNCFpBS+Pgq2D2t+m0LiXNKoEZHOIbNPq vEasVQaWw6uw/eVOUO6XdgEJGThmUc0JmA57qZaAW13qAeqcY82Izjh4COh9JLlahQF9 lfgGzj8TRCT2DsYWRn3PDJoQpi/ubjnSrPAH1UTlWEeWrrQRaOCAh+rgWYfmsjVaq069 Krpft3bFIMN+VhoUfOj84HSyvY405s5BQgUgx/7GAWOTBhjMkLrNTF72o91naquzDa7p hEVIWQY0UkD9R7We4trZxPhYpmx08qsL1ApdPoXSv5XbRYEbJkjgENg1frM+W51bEeNX ECcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=tAqXHlP8; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-nfs-owner@vger.kernel.org) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org ([209.132.180.67]) by mx.google.com with ESMTP id s89si5049982qtd.387.2020.04.12.22.42.32; Sun, 12 Apr 2020 22:42:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-nfs-owner@vger.kernel.org) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=tAqXHlP8; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-nfs-owner@vger.kernel.org) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725954AbgDLW2w (ORCPT + 99 others); Sun, 12 Apr 2020 18:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726188AbgDLW2w (ORCPT ); Sun, 12 Apr 2020 18:28:52 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC0A8C008778 for ; Sun, 12 Apr 2020 15:28:51 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id t8so2346400ilj.3 for ; Sun, 12 Apr 2020 15:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juliacomputing-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ANGfUKyG+6xWky2jJ2nWMKG+M8IIxgEacG/h0ycqR20=; b=tAqXHlP8pnC0Fae5HqLveAPHChvu5fDrBR9aCpdJ/+VGWLe239sL5EQQWbqaz3R9zk EAQUa5NP5nmgrY74n41PftFvtCCNCkmDthGZgO1ECVJSvQ4IMF53VSupjwSpg+7RuiI2 v8IH811tUAia95Hhy4SCvG+4vNYPYkm/oQwKOCJSYOIjRu3W/kSiUZHWJk1lZ+sCtpCN sz3mK9n7qAcYjYqEBtPNGS5pNjUaJMtI1sYKypSgAKOTUQlwM5XiVkmGcy1PN8/Nb7x4 5Dp2zxa0TXQ+m0aDA5A0d4GXIcPgOuuLePU4s7tZZkslKAfNetsNFpjzQdzBZpgG9Dy/ XODw== 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=ANGfUKyG+6xWky2jJ2nWMKG+M8IIxgEacG/h0ycqR20=; b=je74ctBtehR++816j4FBvN+uP+7ClfUI/nZXjkt9ZjYMYe5zcZVQHSdwvBWONm5xpQ f0TEdUkUojHCcUqqm75D003tgCCt8Un4i0hCnOHgWug998DUf09xslwxpmxQyR/4VJhy LDlJtJeruYRiT4ypuSf0Sm9xFSRecNu90YEByXcZ0YWOoATdvNFkTYqIKx9Vd1tAKKmB emKCvLoS05sIa3T7q3G1917YD1Y9cMU3jEF6R+wYCadSMCeL47qAPK5eABMPmYmNWNCg /UdG2OpAKtbmhdyHRWjUQf7Q9SrJyhtDyrOwx4/3Yq3xhkUVMgC6KQjzVfLJWiUJk+Lg 6wqA== X-Gm-Message-State: AGi0PuYysrR76WUvxYigWYB2APvBIHErhdUakFlhfoRH4XR+DGCLeFYG 09U9WyYDmzFc8Jp3DCyFQdNuYUqZH/dduPnk4kT7gQ== X-Received: by 2002:a92:250e:: with SMTP id l14mr14538847ill.201.1586730530779; Sun, 12 Apr 2020 15:28:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Keno Fischer Date: Sun, 12 Apr 2020 18:28:13 -0400 Message-ID: Subject: Re: Same mountpoint restriction in FICLONE ioctls To: Amir Goldstein Cc: linux-fsdevel , Miklos Szeredi , linux-xfs , CIFS , Linux NFS Mailing List , Olga Kornievskaia , Steve French Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org > You did not specify your use case. My use case is recording (https://rr-project.org/) executions of containers (which often make heavy use of bind mounts on the same file system, thus me running into this restriction). In essence, at relevant read or mmap operations, rr needs to checkpoint the file that was opened, in case it later gets deleted or modified. It always tries to FICLONE the file first, before deciding heuristically whether to instead create a copy (if it decides there is a low likelihood the file will get changed - e.g. because it's a system file - it may decide to take the chance and not copy it at the risk of creating a broken recording). That's often a decent trade-off, but of course it's not 100% perfect. > The question is: do you *really* need cross mount clone? > Can you use copy_file_range() instead? Good question. copy_file_range doesn't quite work for that initial clone, because we do want it to fail if cloning doesn't work (so that we can apply the heuristics). However, you make a good point that the copy fallback should probably use copy_file_range. At least that way, if it does decide to copy, the performance will be better. It would still be nice for FICLONE to ease this restriction, since it reduces the chance of the heuristics getting it wrong and preventing the copy, even if such a copy would have been cheap. > Across which filesystems mounts are you trying to clone? This functionality was written with btrfs in mind, so that's what I was testing with. The mounts themselves are just different bindmounts into the same filesystem. Keno