Re: [nfsv4] seeking clarifications in server-side copy CB_OFFLOAD feature

Olga Kornievskaia <aglo@umich.edu> Mon, 06 March 2017 16:55 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 7C02E12945A for <nfsv4@ietfa.amsl.com>; Mon, 6 Mar 2017 08:55:37 -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 k1lXGwq7lOtt for <nfsv4@ietfa.amsl.com>; Mon, 6 Mar 2017 08:55:36 -0800 (PST)
Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::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 D188E129860 for <nfsv4@ietf.org>; Mon, 6 Mar 2017 08:55:35 -0800 (PST)
Received: by mail-io0-x22d.google.com with SMTP id z13so73215969iof.2 for <nfsv4@ietf.org>; Mon, 06 Mar 2017 08:55:35 -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=N9KaBsxXHBIDZUu6EW6nMMAtT6rtr+s1qFWbmL8hxIM=; b=mRfgSjyMv4L2qu/PX2qs9hN155SezA0YqVGi+E+SfMd/7ORfCuE046/9eqNnHvKvz9 5huH3oQ2u7tucoPYuG39F1LK1Yp7Go7JHAQRXb1nX+Gvt5GSvdvhpldPxnaD7UT8dlM3 fJ6b0G1mJYk94f9OwEVSlUKmIzQW9R4Ux0ZgWUg5SZJ3pxDFzp6C/gPAq6+OgI8v6lxF tKkM9Oxy6s9Ahu02WOC3gMZnKRCZm5azcBl+g6yBLCzSiQQdCxvq972qIX2xfZkpin8F PD8Fy1bxFLUW0tVsQO66hcmtGjL0XAcAISEC/C32Ofvb/9Bcsey4O+uKc/l6DVquc9Bv 7TDQ==
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=N9KaBsxXHBIDZUu6EW6nMMAtT6rtr+s1qFWbmL8hxIM=; b=CnG5Mb5LiGWF/OHmSpk9uNIlyuQtyg09NsssXpzCuQI6zEllxXXM919Bby9L/jQXLm OlEt7qG16u+mrn96pnDK3fSr5yPgmQ/MKVvXLhKT551oJCOixh8XQfZbtjqAsooXSzmc FNGK0Q5aWLY4cNVRNqNyDFqOHaFYZMtYvahx91hZ7aMak1DNJqippp8cEA0SYj7UT0k5 zHV7yT9y/umY+Uf6BCN7Y7T5olcjDXR7rBCky4KHngOMfjj8vi8JdnRi47CnUhs33bhi loQQ4Z62VZQ6lfZpzHkmkCcxUM0w+UHSI3kC3WcDHgxLKtZAFODrCtguI4+6uj2yCxU7 gyLQ==
X-Gm-Message-State: AMke39kd1RvqxWc42bVoMxpkB9beXCLhooMl9z/S1oMwE/rQrpcpi71xA1EBHP428kCU62qHpSdrDdGZtcFB6w==
X-Received: by 10.107.32.83 with SMTP id g80mr13047555iog.234.1488819334999; Mon, 06 Mar 2017 08:55:34 -0800 (PST)
MIME-Version: 1.0
Sender: olga.kornievskaia@gmail.com
Received: by 10.107.10.41 with HTTP; Mon, 6 Mar 2017 08:54:44 -0800 (PST)
In-Reply-To: <20170304020726.GA21609@fieldses.org>
References: <CAN-5tyHB5Uo0uEHfKuBOSyJmu5VZ5osLWQQaqLnt68ftUS4OnQ@mail.gmail.com> <20170303184852.GC13877@fieldses.org> <CAN-5tyFWdUzb7Evx9+G-rkNRb8awCM7kqHQrfxn2Rb6qdWT_cw@mail.gmail.com> <20170304020726.GA21609@fieldses.org>
From: Olga Kornievskaia <aglo@umich.edu>
Date: Mon, 06 Mar 2017 11:54:44 -0500
X-Google-Sender-Auth: gAf2qMEonJ26vnb2u4dTipsimqk
Message-ID: <CAN-5tyGN2WJhqYWKLYyvas-7bKrrDEKGLKbp0to4ndfFTpvuAA@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/gpGxoBExUn3lTcPd_TMghn89hLI>
Cc: "nfsv4@ietf.org" <nfsv4@ietf.org>
Subject: Re: [nfsv4] seeking clarifications in server-side copy CB_OFFLOAD feature
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: Mon, 06 Mar 2017 16:55:37 -0000

On Fri, Mar 3, 2017 at 9:07 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> On Fri, Mar 03, 2017 at 05:28:17PM -0500, Olga Kornievskaia wrote:
>> Thanks for the comments Bruce!
>>
>> On Fri, Mar 3, 2017 at 1:48 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
>> > On Thu, Mar 02, 2017 at 04:07:42PM -0500, Olga Kornievskaia wrote:
>> >> I'm seeking some clarification for doing the server-side copy feature.
>> >> EINVAL in read beyond the end of the file has been already raised in
>> >> another thread so I'll leave that aside. So here are a few more :
>> >> -- possible inconsistent behavior in presence of an error from doing
>> >> an async copy vs sync. CB_OFFLOAD can return an error and a partial
>> >> copy result but there is no mechanism to do so in synchronous COPY. If
>> >> CB_OFFLOAD returned an error and a partial copy, is that really an
>> >> error or should it be a short copy?
>> >
>> > On the client side, in the Linux case, the client is implementing
>> > copy_file_range(), which doesn't have the option of returning both an
>> > error and a number of bytes copied.  Returning an error to the
>> > application when the destination was actually modified is unacceptable.
>>
>> Are you saying it is not acceptable to fail copy_file_range() and do a
>> partial copy or am I not reading it correctly? Why is this not
>> acceptable? Currently if I do a "cp /mnt/foo /mnt2/bar" and say there
>> is not enough space "cp" will display ENOSPC error but it will copy as
>> much as it could in /mnt/bar until it failed.
>
> Maybe cp doesn't use the information that the write() system call gives
> it, but I think the system call interface should still try to provide
> this information.
>
> So, I'd still be in favor of turning nonzero copy + error reply from
> server into a succesful copy_file_range() call in every case.
>
> The one exception might be errors that the client can handle itself (say
> by retrying)?  I don't know what those might be.
>
>> > Returning success and a short copy is OK, I think--if the error's
>> > important then the application will get it when it tries to copy the
>> > rest.
>> >
>> >> I can see a case where an error should not be ignore -- if error is
>> >> ENOSPC. Should the client if received an error in CB_OFFLOAD propagate
>> >> the error to the application?
>> >
>> > I think it's OK to ignore the ENOSPC.  The application will try to write
>> > the rest, the client will turn that into a new COPY request, this time
>> > the response will probably be 0 bytes copied and ENOSPC, so this time
>> > the client can return the error to the client.
>>
>> Ok I agree about ENOSPC.
>>
>> But, in general, 0 + some ERROR might not necessarily mean an error.
>> When the server rebooted and copied 0 bytes and maybe returned an
>> error (?), it should not be considered an error on the (NFS) client.
>
> I'm trying to think about the server reboot cases, but I'm confused....
>
> In the case of just a single server, or in the server-to-server case
> when the target server reboots, I think the client just retries any
> COPYs it had in progress, the same as it would if it had a write that
> was in progress.  I don't there's anything else it can do.  The server
> doesn't have any way to return an error to the COPY after it reboots.
> Our server won't even remember it was in the middle of a copy after it
> comes back up.

Correct client will reboot the copy from scratch.

> If the source server reboots.... Yes, I guess it could just return a
> short copy result, but as you say if it didn't manage to copy any bytes,
> that might be confusing, as it might look like it hit end of file.
>
> Maybe it should return BAD_STATEID to indicate that the stateid that the
> server got in ca_src_stateid isn't accepted by the source server any
> more?  Or maybe PARTNER_NO_AUTH?

Due to the fact that VFS copy_file_range() can't return anything of
that sort, it returns EBADF. NFSD will return partial copy and
BAD_FILEHANDLE.

>> I'm actually hoping that server will return -1 and ENOSPC. But the
>> spec doesn't dictate that failure should return -1.
>
> I'm not sure what you mean by returning -1.  You mean returning with
> wr_count == -1?

As far as I can tell, "wr_count" could never be -1. wr_count is only
present on a successful copy (meaning CB_OFFLOAD error is NFS4_OK or
for synchronous case COPY's status is NFS4_OK). If error is set, then
coa_bytes_copied will be set to something. I'm suggesting it should be
-1.

>> >> Should it be server's responsibility to then if some
>> >> error occurred but a partial copy succeeded to then not return the
>> >> error to the client (that leads to the 2nd question).
>> >
>> > I'd rather servers didn't use this odd quirk of the protocol, but maybe
>> > it's too late to stop them.  And it seems easy enough just to ignore the
>> > error on the client side in the case bytes were copied.
>>
>> I can argue that it's easier for the server to ignore the error due to
>> the reboot. There is no error to represent server reboot. There is no
>> wording in the spec to state that if CB_OFFLOAD.error = X it means
>> source server reboot. So if client got CB_OFFLOAD.error = X it is
>> really guessing if it means server rebooted or something else.
>>
>> I guess I'm afraid that by ignoring all errors I'm not thinking of
>> some example where it was the wrong thing to do. Currently this is how
>> I've coded up the client to ignore the errors (all except ENOSPC which
>> I guess I can ignore as well let client got another ENOSPC) but I have
>> a nagging feeling I'm missing something.
>>
>> >> -- related to errors returned in CB_OFFLOAD, there is no guidance with
>> >> regards to the reboot recovery. If the destination server unable to
>> >> finish the copy due to the source server rebooting, should it reply
>> >> back with a successful short copy or should it return some error (and
>> >> short copy of possibly 0bytes).
>> >
>> > A short copy sounds reasonable to me.
>>
>> short copy with an error, right?
>
> I was thinking without an error, but at least in the case where there
> were 0 bytes I think you're right there needs to be an error.

I'm confused :( The way I read things you say server shouldn't hide
errors but here you are saying it should return a short copy without
an error. I guess I'll wait for you to comment on the actual code to
let me know what you think should happen there.