Re: [nfsv4] Server-side copy question

Olga Kornievskaia <aglo@citi.umich.edu> Wed, 18 October 2017 21:22 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 2FEF11330B0 for <nfsv4@ietfa.amsl.com>; Wed, 18 Oct 2017 14:22:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.699
X-Spam-Level:
X-Spam-Status: No, score=-1.699 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.199, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no 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 hs3v4OTG8wDb for <nfsv4@ietfa.amsl.com>; Wed, 18 Oct 2017 14:22:14 -0700 (PDT)
Received: from mail-ua0-x229.google.com (mail-ua0-x229.google.com [IPv6:2607:f8b0:400c:c08::229]) (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 2470A133090 for <nfsv4@ietf.org>; Wed, 18 Oct 2017 14:22:10 -0700 (PDT)
Received: by mail-ua0-x229.google.com with SMTP id u32so4605401uau.0 for <nfsv4@ietf.org>; Wed, 18 Oct 2017 14:22:10 -0700 (PDT)
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:content-transfer-encoding; bh=mHf0EI8fYCGEPncZVrOLQ6MGV4YM/fnumV4taab5XSA=; b=Q9p5ZAxK3CUfk6HHQPk2ysXxXoaAujj/Qs36Ty32Nqu3P+yBEogeAHl15+quidNLhn NjAt+5gR2KyKm1XIP321OF1O1KGw7zrbjhACw+/v92cz/XIfGjPpeYZkPYFH724EvE0p Bi0utF6SurFlh1Xfo8iwF3KUxU9YxMwx1D0wailwfWGOHE8QOjIt7UGTFP6OTinGGGO1 VgdsmugWLnQ2ItKpwF1bmsg6MOdiQAAhN87bKfdrDAbVPYnmNcIk+nW+3pSPxCGrcbDf ZwzVAMC50/682ajA4eoEpx5Tt82yEH3n5KkoZNyxsysh0jddFPgXqG9bruIADbfg7TCI tEKw==
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:content-transfer-encoding; bh=mHf0EI8fYCGEPncZVrOLQ6MGV4YM/fnumV4taab5XSA=; b=FwuUecXMKKNbeP3YwekQWHxZdHEtdx1GPRmdu3wSCj1vJQIH/03Zwgqa8Iz8Ki+3NZ FareZxsCxBufpdM6zcTpQ4DjDenWCqyrBSVFP9zg0Z1qSx++6QUD6e8xhBrUPXFi4+F1 B7jBXvCdQiWjvv44iYgoc/JNgK/DH8gkJfuhsEMaEqxQEerTRlUtL6+SPKahAqCik4Ng /+pNaJ5/iPu58Ki6dpF8SJQDAMVIaNQAlt8GgXaXuU29MbQ5eoVUi16jxpt54n5U679z HYRL7gT3v2VNjvRghvS310LgJd4krb/DartEHWDzBaR4D8YURlnKHwk+1ePLNBx0KcBk TOhQ==
X-Gm-Message-State: AMCzsaXhBZqjs6Z+9FHLdNZ0U0zQM6me9dB+4clOwQU86ERy9+E6SH0m 0ilBD7k3lJM+Zqpe0v9TZ7xIrhTbXeN0OjRaXqE=
X-Google-Smtp-Source: ABhQp+QHPti2uSmWajH9nh0sudYtJUR3F40feEG1Q9nIP4I7kZEMemQ9cfPo3J8L3gs/KtKa3//br/bnzMLSi8RR7sk=
X-Received: by 10.159.55.239 with SMTP id q102mr10801756uaq.143.1508361729221; Wed, 18 Oct 2017 14:22:09 -0700 (PDT)
MIME-Version: 1.0
Sender: olga.kornievskaia@gmail.com
Received: by 10.103.59.202 with HTTP; Wed, 18 Oct 2017 14:22:08 -0700 (PDT)
In-Reply-To: <20170228173215.GA29700@fieldses.org>
References: <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> <CAN-5tyHJb=ercWh_W2uzPfKR86j=dGWx=zYH1y+TjbNTzYh38A@mail.gmail.com> <20170228164420.GA28845@fieldses.org> <CADaq8jdivTUVNx2LXCiecAKY-nfoZP_XoAoNLwc3V1TUD6X8vg@mail.gmail.com> <CC84C4DB-F00F-45FC-8307-BDA5424DA480@netapp.com> <20170228173215.GA29700@fieldses.org>
From: Olga Kornievskaia <aglo@citi.umich.edu>
Date: Wed, 18 Oct 2017 17:22:08 -0400
X-Google-Sender-Auth: mLo_ky_VhRfSOWLDosJmlrMXWUk
Message-ID: <CAN-5tyF8EZjYNX3cE43BPM9CbxVLygRdPuTJf_RgC7ntDCf9Kg@mail.gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: "Adamson, Andy" <William.Adamson@netapp.com>, "nfsv4@ietf.org" <nfsv4@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/G__j1K5L2EJcEiER14FeVRartHs>
Subject: Re: [nfsv4] Server-side copy question
X-BeenThere: nfsv4@ietf.org
X-Mailman-Version: 2.1.22
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: Wed, 18 Oct 2017 21:22:17 -0000

On Tue, Feb 28, 2017 at 12:32 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> On Tue, Feb 28, 2017 at 05:04:27PM +0000, Adamson, Andy wrote:
>> I also thought that bytes copied is only included in the success case – but as Olga pointed out, not true. The coa_status of NFS4_OK has the coa_resok4->wr_count showing the bytes copied, and the default (e.g. failure cases) has the coa_bytes_copied.
>>
>> So the server can send a CB_OFFLOAD with an error (such as the –EINVAL in the example) and send the bytes copied in coa_bytes_copied.
>>
>>    union offload_info4 switch (nfsstat4 coa_status) {
>>    case NFS4_OK:
>>            write_response4 coa_resok4;
>>    default:
>>            length4         coa_bytes_copied;
>>    };
>
> Gah, I'm sorry, Olga said CB_OFFLOAD but for some reason I was looking
> at COPY.
>
> I have no idea what to think of that.  I don't see why it should be
> different from COPY.

I'd like to resurrect this thread...

This discussion was initiated to allow for the server to do a partial
copy instead of failing the copy with EINVAL when copy is requested
beyond the end of the file.

However, the problem I'm running into is that because CB_OFFLOAD only
returns "coa_bytes_copied" and does not include stable_how and
verifier. So even if client were to then send a COMMIT for the bytes
that were copied, it has no verifier to match from the COMMIT to
anything.

Should the client then ignore the lack of the matching verifier and
just assume the data was committed for the partial bytes?


>
> --b.
>
>>
>> -->Andy
>>
>> From: nfsv4 <nfsv4-bounces@ietf.org> on behalf of David Noveck <davenoveck@gmail.com>
>> Date: Tuesday, February 28, 2017 at 11:52 AM
>> To: "J. Bruce Fields" <bfields@fieldses.org>
>> Cc: "nfsv4@ietf.org" <nfsv4@ietf.org>
>> Subject: Re: [nfsv4] Server-side copy question
>>
>> The bytes copied is only included in the success case, but .... The text talks about the bytes copied being returned in the failure case :-(
>>
>> On Feb 28, 2017 11:44 AM, "J. Bruce Fields" <bfields@fieldses.org<mailto:bfields@fieldses.org>> wrote:
>> On Tue, Feb 28, 2017 at 11:18:22AM -0500, Olga Kornievskaia wrote:
>> > On Fri, Feb 24, 2017 at 5:21 PM, J. Bruce Fields <bfields@fieldses.org<mailto: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?
>>
>> I think that's right, yes.
>>
>> > 2. CB_OFFLOAD status EINVAL bytes copied 50.
>>
>> Fortunately, this isn't possible--the xdr for bytes copied isn't even
>> there in the error case.
>>
>> --b.
>>
>> >  -- 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.
>>
>> _______________________________________________
>> nfsv4 mailing list
>> nfsv4@ietf.org<mailto:nfsv4@ietf.org>
>> https://www.ietf.org/mailman/listinfo/nfsv4
>
> _______________________________________________
> nfsv4 mailing list
> nfsv4@ietf.org
> https://www.ietf.org/mailman/listinfo/nfsv4