Re: [nfsv4] Server-side copy question

"Adamson, Andy" <William.Adamson@netapp.com> Tue, 28 February 2017 17:05 UTC

Return-Path: <William.Adamson@netapp.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 7DB92129647 for <nfsv4@ietfa.amsl.com>; Tue, 28 Feb 2017 09:05:10 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.921
X-Spam-Level:
X-Spam-Status: No, score=-6.921 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=netapp.onmicrosoft.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 xz8UZkSadwKF for <nfsv4@ietfa.amsl.com>; Tue, 28 Feb 2017 09:05:07 -0800 (PST)
Received: from mx144.netapp.com (mx144.netapp.com [216.240.21.25]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A076B129618 for <nfsv4@ietf.org>; Tue, 28 Feb 2017 09:05:07 -0800 (PST)
X-IronPort-AV: E=Sophos;i="5.35,220,1484035200"; d="scan'208,217";a="179525545"
Received: from hioexcmbx02-prd.hq.netapp.com ([10.122.105.35]) by mx144-out.netapp.com with ESMTP; 28 Feb 2017 08:54:38 -0800
Received: from VMWEXCCAS07-PRD.hq.netapp.com (10.122.105.25) by hioexcmbx02-prd.hq.netapp.com (10.122.105.35) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 28 Feb 2017 09:04:21 -0800
Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS07-PRD.hq.netapp.com (10.122.105.25) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Tue, 28 Feb 2017 09:04:21 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.onmicrosoft.com; s=selector1-netapp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sBTdTmrNoY9FniZkMGqu09GggVoTqTZKJsdSenKoTrc=; b=okzoHuK62R3SbrzGEl8UitrRWdBWVwJeDR/18WX7xCvSODA8pvE2eGaypZwRdlV+W1kpAu6/niQWl93px0nH4Ap7mhDE9p4rJAZ3X2UxRrIu7MYcVKCkDx9AfyCte3ZequBW2DicSxFb7D/xMv5LsxmtSyBeHGFUU0/iWxFfNgQ=
Received: from BN3PR0601MB1347.namprd06.prod.outlook.com (10.161.210.150) by BN3PR0601MB1347.namprd06.prod.outlook.com (10.161.210.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Tue, 28 Feb 2017 17:04:27 +0000
Received: from BN3PR0601MB1347.namprd06.prod.outlook.com ([10.161.210.150]) by BN3PR0601MB1347.namprd06.prod.outlook.com ([10.161.210.150]) with mapi id 15.01.0933.020; Tue, 28 Feb 2017 17:04:27 +0000
From: "Adamson, Andy" <William.Adamson@netapp.com>
To: David Noveck <davenoveck@gmail.com>, "J. Bruce Fields" <bfields@fieldses.org>
Thread-Topic: [nfsv4] Server-side copy question
Thread-Index: AQHSh9mJMdo0XM5LV0SkJ1E945V/h6FrmaEAgAIFOYCAARtQAIAAYBmAgAApOgCAAHy6gIAG2ZuAgAAiWgCAAHC5gIABnB+AgAXj2ACAAAdBAIAAAk0A//+vfwA=
Date: Tue, 28 Feb 2017 17:04:27 +0000
Message-ID: <CC84C4DB-F00F-45FC-8307-BDA5424DA480@netapp.com>
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> <CADaq8jdivTUVNx2LXCiecAKY-nfoZP_XoAoNLwc3V1TUD6X8vg@mail.gmail.com>
In-Reply-To: <CADaq8jdivTUVNx2LXCiecAKY-nfoZP_XoAoNLwc3V1TUD6X8vg@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/f.17.0.160611
authentication-results: spf=none (sender IP is ) smtp.mailfrom=William.Adamson@netapp.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [2602:306:c41c:8d90:4d10:7462:9cd3:ce48]
x-ms-office365-filtering-correlation-id: af038c4a-b229-4a4d-d539-08d45ffbdac6
x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0601MB1347;
x-microsoft-exchange-diagnostics: 1; BN3PR0601MB1347; 7:nkZAOgH5AzqNUI+sZWc8w5uzVFHWivrtsdzho8d8TkO3+rLJJ/PgGimQqGIYHLK/9eRjQ0PBNbB2h4Lyhmr6GQEVpWSElLDFJNvLANt8/BQj/Utavkxtqyg+qJEgHzbOzGTpG0UR+ILPV3HLuL/DQ/rn/3ovvsLY5HdRgn2gq+nYhFerxPfJLxqhe8XC5iAWXfDkBP2zZKZo2wENpSKwu1HN7Asj79z8yv+b/ezk4ABMXuB/64vy5g91GhEjHa6rDLMlshemc8lAYsGAOledBw6u8jWVwVECyTuI3NRfCEXEE0eI0FqC13c8lI6g23AR0ZujaEyQbaxQ0aQWgpAbaQ==
x-microsoft-antispam-prvs: <BN3PR0601MB13478CAF951112E0A7B6CF7785560@BN3PR0601MB1347.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(158342451672863)(100405760836317)(21748063052155);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6072148); SRVR:BN3PR0601MB1347; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0601MB1347;
x-forefront-prvs: 0232B30BBC
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(7916002)(39450400003)(189002)(24454002)(199003)(377454003)(52314003)(51444003)(97736004)(105586002)(68736007)(106116001)(106356001)(53546006)(39060400002)(606005)(6436002)(6506006)(93886004)(83506001)(83716003)(82746002)(2906002)(4001350100001)(2950100002)(3280700002)(3660700001)(54356999)(8936002)(102836003)(5660300001)(6116002)(81156014)(189998001)(81166006)(8676002)(229853002)(36756003)(7906003)(122556002)(25786008)(7736002)(77096006)(6486002)(6246003)(6512007)(54896002)(99286003)(6306002)(53936002)(38730400002)(236005)(50986999)(2900100001)(86362001)(92566002)(101416001)(33656002)(4326008)(76176999)(104396002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0601MB1347; H:BN3PR0601MB1347.namprd06.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en;
received-spf: None (protection.outlook.com: netapp.com does not designate permitted sender hosts)
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_CC84C4DBF00F45FC8307BDA5424DA480netappcom_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2017 17:04:27.7507 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4b0911a0-929b-4715-944b-c03745165b3a
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0601MB1347
X-OriginatorOrg: netapp.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/1p_DifOSL3KhP7yEVpSAzlw1z_A>
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 17:05:10 -0000

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;
   };

-->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