Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4394402ybb; Tue, 14 Apr 2020 06:31:03 -0700 (PDT) X-Google-Smtp-Source: APiQypIR39u5TScZdx6tn7eKMFMIrEB5DxGCtROi7KED/4heiTlIls5AocY688/IkLAl60sHJySH X-Received: by 2002:aa7:c597:: with SMTP id g23mr1727620edq.109.1586871063049; Tue, 14 Apr 2020 06:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586871063; cv=none; d=google.com; s=arc-20160816; b=dr9C9RmqZkGQKFc8maeR3HqWfVt1IzHWeqe1K/NtVGCosSWRT0uw5dB+DWFrSLgfdt 2l86p9xXTeUgS8JcXe3FTWFRt+eRVWV/fltEjFopbprzOEPiHEhY50oulkHDWGKdhGyU IkZvGiU4POo+3qZg9wahf2xD3IlbjizAwDO7LeZBqBbqJ299kniMSomYBjGyaluAJsO8 vC8gWpjDiMn8jDuCP0lw1bo1iQi5P7touqMtR1kH36exMWMfOwr7F3xFQrNd+bY7MdPL Y7dbWjwqZ//6wokQROsKJYxQDOGTWlp/bpvnsb162v/obt4iNpCKVodA1V4OdgD7V4Rk Qrlw== 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=bdK8gEyBj47+B+b5fdWD48DFf9snz/SocRpKyG/PMKw=; b=HVC/VRLWLRcqL3yJwetIwX4VqnrYz+GR79bYGX53Zm1IzDYoo/OHXJ6cwT3VqvhGIJ ZIj8L7wDiXkFxL8RoDHTFiSA0SHf13O/4ztj9/a1fp2ekC6XLo/PtIvj6CVckfL8Ry4O NKDgKwcbAwNA6zPJVRewkAjwyP7WIcW47oO+oKzAZGiOeJ3zCiG4FIzHLXn1AVqJvucE XGhFHIRaI1WsoYBNEtWnHoYtyy4KeiPAB0lym/rdytvSHA+5mW2u9Km2l/CXeKV7L0ag 8LWiO1/+4oJALCYAlj9vXDrkfoDIdJ8VuNU/CFhPnV4QAUfyBfB5JRqw5xwyLZDjGtzl 811Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=1x8U2KZM; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c35si8044385edf.43.2020.04.14.06.30.38; Tue, 14 Apr 2020 06:31:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=1x8U2KZM; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387999AbgDMTkk (ORCPT + 99 others); Mon, 13 Apr 2020 15:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387994AbgDMTkh (ORCPT ); Mon, 13 Apr 2020 15:40:37 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA62C008748 for ; Mon, 13 Apr 2020 12:40:35 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id i75so9645077ild.13 for ; Mon, 13 Apr 2020 12:40:35 -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=bdK8gEyBj47+B+b5fdWD48DFf9snz/SocRpKyG/PMKw=; b=1x8U2KZMxLh/Y782kba7SyBXt1QFaYYGloH3M3XRqPHvjiH2sJChN66jW+0oFeYTho U3L1FYkAiqUREN247XRMF+D9yNlFBFCwnvXrstKNfnLkFZgulF1vt3r9u3ewQnRRdlX1 ZM/jrhK7ZZkhAAQoeg5QtMZesveYglPTsh7Q+RqGlSxHkvA6V3plAF0jBUQbY9NtCwas Y+Px8gK2IVOkpFQ3xiy5g8ywMA2Zt4DKXaeRoYg2yyG/nXnRDqNCE87GJG9j/1C10x5Z MfkMxvvdM71yjDwaY0nbxX+Yd5JaG3w//3ZXeQNKiX2QRcF8Ml5y9h6WpbuMziJnx9vQ bOXw== 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=bdK8gEyBj47+B+b5fdWD48DFf9snz/SocRpKyG/PMKw=; b=NSaWUiWzXyU5zQtFT5dipjUmKvD2vP2E+Lbm52U0HbVnUSIHcpcP54JNB28a7fDCyi N+AG6zBXeaAjwSGRN8HYBt/0PLTwq5MWnf1WjbbtA9bQrlalgDCJtb//h1wsG68s++XL PCPGQD0fjyM0gJ0zkyNQSzJTTs7tmx4jIAKBg6KID+d/YibD9w7LGNSTO/Ki3WpwtDhG I3b77kjR3ycXjhz8aInJ04kcyPFkgvWrMDEwEII5/fUVHlFOYkqhfpB9OfSomPrlndaw 3p8mTsonxbOHq/unU6ddvkjP+fZb+xW1tpLv6Uia3JsR5uRaHV1LGrrSRgQpQen51Ndo UbfQ== X-Gm-Message-State: AGi0PuZOgOY+FZqkA+pO4vwY5jZozH/onIOousYd9SfO/Hmr24WBgsRS cxU7hkj7+Tr1VelUtPBvg25Lf2Do6mRUUFffbTCqPQ== X-Received: by 2002:a92:5f17:: with SMTP id t23mr4857115ilb.2.1586806834685; Mon, 13 Apr 2020 12:40:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Keno Fischer Date: Mon, 13 Apr 2020 15:39:58 -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 make it sound like the heuristic decision must be made > *after* trying to clone, but it can be made before and pass > flags to the kernel whether or to fallback to copy. True, though I simplified slightly. There's other things we try first if the clone fails, like creating a hardlink. If cloning fails, we also often only want to copy a part of the file (again heuristically, whether more than what the program asked for will be useful for debugging) > copy_file_range(2) has an unused flags argument. > Adding support for flags like: > COPY_FILE_RANGE_BY_FS > COPY_FILE_RANGE_BY_KERNEL That would solve it of course, and I'd be happy with that solution, but it seems like we'd end up with just another spelling for the cloning ioctls then that have subtly different semantics. > I can also suggest a workaround for you. > If your only problem is bind mounts and if recorder is a privileged > process (CAP_DAC_READ_SEARCH) then you can use a "master" > bind mount to perform all clone operations on. > Use name_to_handle_at(2) to get sb file handle of source file. > Use open_by_handle_at(2) to get an open file descriptor of the source > file under the "master" bind mount. Thanks, that's a very valuable suggestion - I hadn't considered that. Unfortunately, I don't think the recorder does generally have those privileges. It doesn't help in my use case, since I'm recording a container that makes use of user namespaces, so nothing requires priviledge, but it does seem like it would be useful if the recorder does have appropriate capabilities (rr already has a mode where it runs with privilege, e.g. for recording setuid binaries). Keno