Re: [nfsv4] Server-side copy question

"J. Bruce Fields" <bfields@fieldses.org> Fri, 24 February 2017 22:22 UTC

Return-Path: <bfields@fieldses.org>
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 C23C812950A for <nfsv4@ietfa.amsl.com>; Fri, 24 Feb 2017 14:22:08 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.903
X-Spam-Level:
X-Spam-Status: No, score=-1.903 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 hQWCB0a2laIW for <nfsv4@ietfa.amsl.com>; Fri, 24 Feb 2017 14:22:05 -0800 (PST)
Received: from fieldses.org (fieldses.org [173.255.197.46]) by ietfa.amsl.com (Postfix) with ESMTP id E05421294E4 for <nfsv4@ietf.org>; Fri, 24 Feb 2017 14:22:05 -0800 (PST)
Received: by fieldses.org (Postfix, from userid 2815) id 27BFB1EF8; Fri, 24 Feb 2017 17:21:35 -0500 (EST)
Date: Fri, 24 Feb 2017 17:21:35 -0500
From: "J. Bruce Fields" <bfields@fieldses.org>
To: David Noveck <davenoveck@gmail.com>
Message-ID: <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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CADaq8jc6vWdXonTs3795QWO8SWJTudo=x9=gR4uKN+tnfBk+dw@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/wn2S3GLuV4Jxc4JSFFkYujtEniM>
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: Fri, 24 Feb 2017 22:22:09 -0000

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? */
		} else if (copied < 0)
			/* error out */
		else 
			offset += copied;
	}

But, anyway, I guess that's doable.

--b.