Re: [nfsv4] Server-side copy question

Olga Kornievskaia <aglo@citi.umich.edu> Tue, 28 February 2017 16:18 UTC

Return-Path: <olga.kornievskaia@gmail.com>
X-Original-To: nfsv4@ietfa.amsl.com
Delivered-To: nfsv4@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 056EE129614 for <nfsv4@ietfa.amsl.com>; Tue, 28 Feb 2017 08:18:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.37
X-Spam-Level:
X-Spam-Status: No, score=-2.37 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.229, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9PY1FFCxn8Ho for <nfsv4@ietfa.amsl.com>; Tue, 28 Feb 2017 08:18:23 -0800 (PST)
Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C3FF8129613 for <nfsv4@ietf.org>; Tue, 28 Feb 2017 08:18:23 -0800 (PST)
Received: by mail-it0-x22d.google.com with SMTP id 68so2594821itg.0 for <nfsv4@ietf.org>; Tue, 28 Feb 2017 08:18:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=7LMIK2ZcJxv19N3FbllahAx81zkeHNy6ai+ky5si1Xs=; b=aQaJr/Ov02jyh/Opl595C+29BzfTKHBpiIkbFWiLKox61cL/+Csv3+ETKAbMzuF+X1 KCxuLJEJyWxkLCQGmiVKCkF4xG8XeSbc/qxxJ5nYWY6AMKGozy5xHOx9iF0cNYSDPEGK Gn60ax0Ae5FkRBJFpPKef+1XubenaSrh+Vuc1gxKcuZRWF3yi/nj+lA4YY4mChSYs/KO 4rfR2GX+Xk4c4Le9wE6+2dBprEVtHuagZmCSe+Vxe3k2ZxFoD1gxGDSaq3GO3eZ27XND KvCtc0+Xo+aH8W9QNCjOcKjvgNhoi0phyyawBxGqU+LZ1pHYxPBjyOCNBlPFCXT3gebr ulAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=7LMIK2ZcJxv19N3FbllahAx81zkeHNy6ai+ky5si1Xs=; b=sONz8YGm2MiMMb4HcjYHzz4U09ApQ8su1AIUTXxNoZFqzF7B3hdYZKTEAZ5PZhWzQn K1IllrleKUi+kOCTw5CqFvboib5ZzlNiVwPAz9C3xyIX/SIZKnk5NADV4/MvjFv+Z8ZB /QYlXaM3QKPWEpuq++77mAfnRh0fOOt4nODDvWs++YFsfZVYV7Y7yHgytP/0Jh/sXujU 1cvnOPPaCn3Oe46N1lQDnZ2BVeWCiUJoJXADiTa8kMF8kzbV9lWDJBaTDETW6N0zYy8n w/Ao2Zx+UlZ0D0gFGfjvR0a3fWulC6ZfImkzreUJ/8JuxmEU6gIaXHXXQZrGPPcHlepA iX/w==
X-Gm-Message-State: AMke39km6y/VVB56dQb4XV+MJdM3m5vqjHK3Xce6FdgoxovGKO6I78LblsvWE76DIwrIYB/Av5DFuX5IawCnPw==
X-Received: by 10.36.53.210 with SMTP id k201mr3460819ita.21.1488298703065; Tue, 28 Feb 2017 08:18:23 -0800 (PST)
MIME-Version: 1.0
Sender: olga.kornievskaia@gmail.com
Received: by 10.107.10.41 with HTTP; Tue, 28 Feb 2017 08:18:22 -0800 (PST)
In-Reply-To: <20170224222135.GJ26378@fieldses.org>
References: <B65A07BE-E379-4507-A9B8-6927DF61A0A5@netapp.com> <CADaq8jdhK2NbJrAa0UHacvBS1w0ucoVpc1LJA3=mxH+_iBfMPQ@mail.gmail.com> <20170217195149.GH10894@fieldses.org> <CADaq8jc4XRaFSXz7mberFi0Dr-f+FaQcZFi=gKn9OjUifrNSyw@mail.gmail.com> <3889A2C2-9261-4809-92F9-9CF2F00A894D@gmail.com> <CADaq8jeo_r8jqj_WK3khX38LvwE0bG+5xdEwmkAwq-N6pCTeAg@mail.gmail.com> <CAABAsM6z59o91jv4rqq3-g1+6Lx4LAxOUr02Vd9frN6Mqw+vcQ@mail.gmail.com> <CADaq8jf5S55eBmuu7v+CAVFd+yZeSsU+aKwyL1F5rtr_xvnkMA@mail.gmail.com> <20170223150306.GA11882@fieldses.org> <CADaq8jc6vWdXonTs3795QWO8SWJTudo=x9=gR4uKN+tnfBk+dw@mail.gmail.com> <20170224222135.GJ26378@fieldses.org>
From: Olga Kornievskaia <aglo@citi.umich.edu>
Date: Tue, 28 Feb 2017 11:18:22 -0500
X-Google-Sender-Auth: Kz_TAT4jpB2PSf_F7ooaYUqe4RA
Message-ID: <CAN-5tyHJb=ercWh_W2uzPfKR86j=dGWx=zYH1y+TjbNTzYh38A@mail.gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/m9sr5Dh4_iF3EaDIzECvx-xTcfU>
Cc: "nfsv4@ietf.org" <nfsv4@ietf.org>
Subject: Re: [nfsv4] Server-side copy question
X-BeenThere: nfsv4@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: NFSv4 Working Group <nfsv4.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/nfsv4>, <mailto:nfsv4-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/nfsv4/>
List-Post: <mailto:nfsv4@ietf.org>
List-Help: <mailto:nfsv4-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/nfsv4>, <mailto:nfsv4-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 28 Feb 2017 16:18:26 -0000

On Fri, Feb 24, 2017 at 5:21 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> On Thu, Feb 23, 2017 at 04:46:33PM -0500, David Noveck wrote:
>> > I think what we really want is to change the MUST to something weaker
>> > (MAY?).
>>
>> I think we should stay away from the question of what we really want,
>> since everybody's preferences are different.
>>
>> Fortunately, we don't need agreement/consensus on that.  Anyone,
>> can submit an errata.  All you need is a suggested corrected text that
>> people will not object strongly to and will regard as an improvement.
>> Given how broken the existing text is, that is a pretty low bar.
>>
>> I have already suggested using MAY so I'm on board.  Trond
>> had some objections but if he can't come up with something better,
>> I don't think he'll object to your approach.
>>
>> > Maybe it doesn't work, but I the intention was to allow COPY to be
>> > implemented by either a copy-like or clone-like backend.
>>
>> That's fine but the question is going to be about how such a client
>> deals with server's who manifest behavior A, mandated by RFC 7862
>> and allowed by the corrected text we are discussing.
>>
>> > So, my only worry would be to avoid clients that are unprepared to deal
>> > with a short read.  Thankfully I think short reads are already allowed
>> > for other reasons, so I think the risk of a major interoperability
>> > problem here is low?
>>
>> Given that this only occurs in the range case, which is quite rarely used,
>> the chance of a "major" interoperability problem is not low or
>> infinitesimal.
>> It is zero.
>
> The Linux server implementation currently caps the amount of data copied
> at 4MB, returning a short result instead, to prevent arbitrary long
> copies.  (Partly because we didn't want to implement async copy at
> first.)
>
> So an app might do something like:
>
>         offset = 0;
>         while (copied = copy_file_range(fdin, offset, fdout, offset,
>                                                         len, flags) > 0)
>                 offset += copied;
>
> So I expect the range case to be the normal case there even when copying
> the whole file.  But we're also counting on clients and apps to handle
> short copy results.
>
> (Hm, linux's copy_file_range isn't documented to have the "0 == copy to
> end of file convention".  That's a potentially ugly mismatch?  Not sure
> if our API can or should be fixed.)
>
> The possibility that the copy could return either a short read or EINVAL
> make this all kind of annoying.  You might end up having to do something
> like
>
>         offset = 0;
>         while (1) {
>                 copied = copy_file_range(fdin, offset, fdout, offset,
>                                                         len, flags) > 0)
>                 if (copied == -EINVAL) {
>                         /* Uh, I dunno, maybe stat the file for a new
>                          * length and retry? */

Bruce, just checking in general for returned EINVAL isn't great
because there is also the case when the source offset is beyond the
end of the file. So now we are forcing the client (application) to
distinguish between this case that is not OK and another case where it
might be ok?

>                 } else if (copied < 0)
>                         /* error out */
>                 else
>                         offset += copied;
>         }
>
> But, anyway, I guess that's doable.

An an implementor, I'm still a bit confused about the direction to
take especially on the client side. On the server side, I'm concluding
from this discussion that it's beneficial to ignore the error of
copying beyond the end of the file and returning to the client a
partial copy.

On the client side, I see 3 possibilities that the client can receive
in asynchronous copy case

say client sent COPY bytes 0-100 but say there are only 50bytes in the file.
server can send back
1. CB_OFFLOAD status NFS4_OK bytes copied 50.
 -- given that client needs to be prepared for a short read anyway,
should it retry from offset 50 and now offset is beyond the end of the
file and should the whole copy fail?
2. CB_OFFLOAD status EINVAL bytes copied 50.
 -- should the client application (or the NFS layer) fail since EINVAL
was returned or should it ignore it and return success to the user?
3. CB_OFFLOAD status EINVAL bytes copied -1 (or 0).
  -- this is the case where the server strictly enforces the current
spec. This is the clearest case, client can't do anything but fail.

>
> --b.
>
> _______________________________________________
> nfsv4 mailing list
> nfsv4@ietf.org
> https://www.ietf.org/mailman/listinfo/nfsv4