Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8037182ybc; Fri, 29 Nov 2019 04:47:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxPnEhmF/bt+O0lg3ae1gZOw+9ZBDS9BdQ34AXa2Q45DZ2VztNwYB1SkBDnxmejSWuRN1Kc X-Received: by 2002:adf:f604:: with SMTP id t4mr17733944wrp.33.1575031657872; Fri, 29 Nov 2019 04:47:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575031657; cv=none; d=google.com; s=arc-20160816; b=d6dKSL0txhPCpLsj9LCUzQnSU8aSfo8bbR3nFD4ydXBKUB1W3h2DcKQ67Vm0bZDx+F uJLPruzgwNHNIgDRGeXvlECCarml+m5m+tb+kfJ6SHgwuSr+/s7qKSJ6ulpsQ8uhDr2w dXMyCz47gkd/uoTH6HSmVOO4Or7kQMB6ielxL/QKjfxAcb4GD/+XS1jRbUcDmALNC0Kt gt5T7mk9/VifKp8aSmSyG2Y2fOx1Vcl6Gd97z/nKsyLrIsE6FneVOqHEYKAkKZ1JOx23 L3359H2orJ5sSO1Qa4BDTF2m9oMScBrOmJF6gzfNroRlv/4CYoIkBFqKn8kYjt2F7m0d 1nug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:reply-to:in-reply-to:references:mime-version :dkim-signature; bh=GPdrQzCsKSWEOfPSRfTPg/zh6Na3hHHeRHsi7uEzLyw=; b=gCex2GX08f3D66VfzhNvJA+KdohnA52dH4SrTMZopcoLxB52F995oq3JD4EWNCkRak 4i8fVHjEJjnMx+wF45pyjDi4/+PNFGzDmjRoYQaTVpD8RLnD0uUfwAQsbaz+wZu9xdHj HTqk/QPMspQPSBXJ072XSx7GVWJil51/gDl+IDn2mnvKGp/LirmzFePmdU0JucVJKYaA 4ZA84//FjHxMY5SfxOp5UEKQPlQMC1HOMD4E1mcr8Ytq3H9Fgj7pgKzkl21fsD8OVTpY Q06s7yCKkuJG6aKiYydwQL3av1o6uyLNkDnQPqa3R4PixOtVpgBdOrBwL89KgNUkFwPG i/Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tAnHC+Pz; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 3si17754721wrh.247.2019.11.29.04.47.01; Fri, 29 Nov 2019 04:47:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tAnHC+Pz; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 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 S1726763AbfK2Mna (ORCPT + 99 others); Fri, 29 Nov 2019 07:43:30 -0500 Received: from mail-vk1-f193.google.com ([209.85.221.193]:42577 "EHLO mail-vk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfK2Mn3 (ORCPT ); Fri, 29 Nov 2019 07:43:29 -0500 Received: by mail-vk1-f193.google.com with SMTP id u123so1185030vkb.9; Fri, 29 Nov 2019 04:43:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=GPdrQzCsKSWEOfPSRfTPg/zh6Na3hHHeRHsi7uEzLyw=; b=tAnHC+PzdW+JSxsiM9eFc71BES2lxMZd5sN4SXXLSevLbuGOl3HAm3OPVx3AsLTyZD zTEhgyzOfsdgvwqgq0Al/c/GFrdM2nCZp7Cm691J0T1v1VJfjqVIuZmzTnxz472PHlrL p9alKLGG4gFGby06zAsh3PUOtt2utmmGwAZWQtoGWU3dOub9jmTKMAjYrV59qZZUhizx dqZ0Dx/KSphvet7h8n7gWnjjtO8DU+211sHLtanV084cCKiwcW4LHB7V4Qt9wec7IHRW ReIFtP4wKLsvVAT81p664w64LFOH0/Q89TmumX3I+i6sQFYS08lxD/x1NwI53orPNgv/ JJsA== 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:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=GPdrQzCsKSWEOfPSRfTPg/zh6Na3hHHeRHsi7uEzLyw=; b=iyJhX0/L2QzTumjeDHpRnybnOk2aoQAScORLMlUqp48mhyrWa7odRwHVexsZVMXqoj ni/cRjcR2DIoThCcE9INegG70+fuNSLnBx3+0jKWs6hU+jJ9T4GKiOi6FSd5VPqo7YBk CH3urvZGv2XCoFlMY/P8kbJjH6d/9Ubgpd5yU82Xzwvm4k/KtaKSl3gT5ORhmj8G3+IZ tT6zPrdbHbNT3mAAozIWHF/WfpLxzzTx7wJTzuVx/4Yr4v2pD0NctnTBKkp3lnFLz/g8 ofO9qWs/mk0uAZtY3mtK2P5iy6TKc/98Gey+6hcvjX2WqL3o4VhZCbSTomK/stZIOhDR pVYQ== X-Gm-Message-State: APjAAAWPrjdt3ZguN6Ml51sbkqH7ep6GNOMJLS6EFzfZIydBDAWSznai 9l5xILm6lXx9S87MCYk3CBMcN4y/5T/eNOd5RNI= X-Received: by 2002:a1f:8dc5:: with SMTP id p188mr9894849vkd.13.1575031408661; Fri, 29 Nov 2019 04:43:28 -0800 (PST) MIME-Version: 1.0 References: <20191127202136.GV6211@magnolia> In-Reply-To: <20191127202136.GV6211@magnolia> Reply-To: fdmanana@gmail.com From: Filipe Manana Date: Fri, 29 Nov 2019 12:43:17 +0000 Message-ID: Subject: Re: Question about clone_range() metadata stability To: "Darrick J. Wong" Cc: Trond Myklebust , "linux-fsdevel@vger.kernel.org" , "linux-nfs@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Nov 27, 2019 at 8:24 PM Darrick J. Wong w= rote: > > On Wed, Nov 27, 2019 at 06:38:46PM +0000, Trond Myklebust wrote: > > Hi all > > > > A quick question about clone_range() and guarantees around metadata > > stability. > > > > Are users required to call fsync/fsync_range() after calling > > clone_range() in order to guarantee that the cloned range metadata is > > persisted? > > Yes. > > > I'm assuming that it is required in order to guarantee that > > data is persisted. > > Data and metadata. XFS and ocfs2's reflink implementations will flush > the page cache before starting the remap, but they both require fsync to > force the log/journal to disk. > > (AFAICT the same reasoning applies to btrfs, but don't trust my word for > it.) Yep, exactly the same for btrfs. > > > I'm asking because knfsd currently just does a call to > > vfs_clone_file_range() when parsing a NFSv4.2 CLONE operation. It does > > not call fsync()/fsync_range() on the destination file, and since the > > NFSv4.2 protocol does not require you to perform any other operation in > > order to persist data/metadata, I'm worried that we may be corrupting > > the cloned file if the NFS server crashes at the wrong moment after the > > client has been told the clone completed. > > That analysis seems correct. > > --D > > > Cheers > > Trond > > -- > > Trond Myklebust > > Linux NFS client maintainer, Hammerspace > > trond.myklebust@hammerspace.com > > > > --=20 Filipe David Manana, =E2=80=9CWhether you think you can, or you think you can't =E2=80=94 you're= right.=E2=80=9D