Re: [nfsv4] Server-side copy question

David Noveck <davenoveck@gmail.com> Tue, 28 February 2017 16:52 UTC

Return-Path: <davenoveck@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 2338A12963B for <nfsv4@ietfa.amsl.com>; Tue, 28 Feb 2017 08:52:38 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Level:
X-Spam-Status: No, score=-2.699 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=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 CdW6ZAxrVqMx for <nfsv4@ietfa.amsl.com>; Tue, 28 Feb 2017 08:52:36 -0800 (PST)
Received: from mail-oi0-x22f.google.com (mail-oi0-x22f.google.com [IPv6:2607:f8b0:4003:c06::22f]) (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 6DFC312962F for <nfsv4@ietf.org>; Tue, 28 Feb 2017 08:52:36 -0800 (PST)
Received: by mail-oi0-x22f.google.com with SMTP id f192so8847646oic.3 for <nfsv4@ietf.org>; Tue, 28 Feb 2017 08:52:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eTJFMokWPAOZZCE07xWXThefnC5lGhDNgXKzDT6Zd0g=; b=fOKbAFpaZUWfMemHrjLZLumFtsZ0MUcrDHIu/07iHOeERaV2xXfMTzNJxzvNh5t5b0 2XLt0NS2F/2FUHbaBDFtdvU1MJ9RdNmpBEiCXagOQMMHs2cUNZcl58+hozR51zs+yCWO Ebp20O7+LdiOy2DdIznoDl/lgJuOu556Aik51LBK292S9BM8tmBeGJDR5e74a+7tOiCs 5XRh27+nBOkgyawjOMg5owk8W0dm+NiJQPV//vB8H2tiL5krDNo39EsY22On/3nuNlZY TBz1Guo79t4dYsA4KjH5pXylGnY/UAEmzqcpfKbSEF18a+c8tEBWvJoeEMP9vh9b8Etj Ligg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eTJFMokWPAOZZCE07xWXThefnC5lGhDNgXKzDT6Zd0g=; b=I6csE+FtRAP5Lc1v3OeNz2aJzVlZ8QiuJhUaoeYt5zva0E5vv5FWc2lbdvyiJBRFo2 rep3b5wxzDxNHIntwlbf0f7z7O11PA4uJcAuCMFeusXVml5GXSU7tfizaSn1EOAh2qys ekVmgqBC+o25q55faFbQ159rbnPZ5oc4GJGa/GU8JiFDgvkKRFRDTQiDGYuF3TPnuFdD L/wzphoNoSYi/RgeA6lMLQ2rRSHpj5VVnRoMQrr/xppMxoJoNEcO353VuYtMglI/HzAs bY5PyE9xYtQdKCDPUtKHxCwfowqTA+6htA+ngzwHUl2C4CHv7ypffcXNLTT2q2ekgUor s70Q==
X-Gm-Message-State: AMke39k6tEPCmKN2Dz8npWNe3KEtbP2F0w4iIQaEfMDNaH5cO1VcnTCrZUhm3gnxDXQwa/xFXGi75PDd8glN6A==
X-Received: by 10.202.169.80 with SMTP id s77mr1533553oie.165.1488300755724; Tue, 28 Feb 2017 08:52:35 -0800 (PST)
MIME-Version: 1.0
Received: by 10.182.137.200 with HTTP; Tue, 28 Feb 2017 08:52:34 -0800 (PST)
Received: by 10.182.137.200 with HTTP; Tue, 28 Feb 2017 08:52:34 -0800 (PST)
In-Reply-To: <20170228164420.GA28845@fieldses.org>
References: <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> <CAN-5tyHJb=ercWh_W2uzPfKR86j=dGWx=zYH1y+TjbNTzYh38A@mail.gmail.com> <20170228164420.GA28845@fieldses.org>
From: David Noveck <davenoveck@gmail.com>
Date: Tue, 28 Feb 2017 11:52:34 -0500
Message-ID: <CADaq8jdivTUVNx2LXCiecAKY-nfoZP_XoAoNLwc3V1TUD6X8vg@mail.gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Content-Type: multipart/alternative; boundary="001a113cd7dadd31c405499a0583"
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/ekxHK9QV4ghM4iqjH5DyKijM96Q>
Cc: 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:52:38 -0000

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> 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>
> 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
> https://www.ietf.org/mailman/listinfo/nfsv4
>