Re: [nfsv4] RFC: Is Open/Claim_Delegate_Prev done before/after Reclaim_complete?

Rick Macklem <rick.macklem@gmail.com> Sat, 06 April 2024 04:33 UTC

Return-Path: <rick.macklem@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 B4653C14F6FB for <nfsv4@ietfa.amsl.com>; Fri, 5 Apr 2024 21:33:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, 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 ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I6kYn2wqotAA for <nfsv4@ietfa.amsl.com>; Fri, 5 Apr 2024 21:33:25 -0700 (PDT)
Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 37494C14F6F6 for <nfsv4@ietf.org>; Fri, 5 Apr 2024 21:33:20 -0700 (PDT)
Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5e4613f2b56so2517596a12.1 for <nfsv4@ietf.org>; Fri, 05 Apr 2024 21:33:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712377999; x=1712982799; darn=ietf.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cFsKzwZ9iZqFBECZFlfePUREmYibkMrTFz6NuIwGO+8=; b=FjZBElhn9qXmtzPaXcYBBixTIyTMJlJ2T6SwZDP+TJdNoqRquvshKEZCvhkW7O9xWN R15ahTSQubgqFfbV6CZLt0rrQDlUvM3RE86tiVGJNGo4BysCBvy3XyJ8b8CHrYukvXAx s7oDbQdwuKZuuLYlGHjs9DOXTzof4wklnmkJNi3Hxd6IZ96CezWfri1FecguBTPup4KI u4/xsXttFFWMvYuC9OdusQ9fzrAxd8RKPmXeWpYKucUumUGuy/wSUNIDcKaS01zrBtIz Bg3D1QHkJegzfyuebqXw/Xs9JSt5vN/SXX48awD3iEhs+Cdi66/qClt19wETwy6/0EzY oPAA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712377999; x=1712982799; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cFsKzwZ9iZqFBECZFlfePUREmYibkMrTFz6NuIwGO+8=; b=JHa6CEEmsDqOYdK0cfw6hg9GzKGqNpocoOLHzgNLpSMXrdKTCVEyl9nKIJkUI2AvYE wJgDUC9M/qk5UiWx1XoE+tLSE+NKv0bOpfPmgM3RTqmhJVAcVmskSua8WBXm1rjhsn1b q70/IC+OqIwoxrHBhOh8rKZnhRUzxVTM/wVtz2/YMPjI1BbJu34IBtN8D35Fw4KSfO4f GB5JLkZzQnTGaA0KhtIM7ADQggSX2JrFjpmuqWVmO9OGooNLmfm/P9+995ycAa7ekkTT ckTmYQzjNx3nnsrSpDJ5f6UGVNJKaaSWEnPM1uvSY2CNO+SEgXQDtfh4lnDqrIOCDLUJ Wi8A==
X-Gm-Message-State: AOJu0YyrH97kvFnnltlj++uMONlyQ/B4c0NM9iHY3e9KBQYzef/vqS9a YcSd5PUETbVEplDvML53sEj4x9biZnaYCT9CnDY9/vuZBHH+9JhMosfBTqONISyfrTZracnm2lg 3m6ZUmKMnQdQm+HH8I16+HBPMKA==
X-Google-Smtp-Source: AGHT+IGxX12wvjf8SUGMmwPXUFqO97u2BDLp0C0D6yzqEvd8sue+dRveXAa9W2S22VkgeDmNHAM6ZohPTLI5f2wR80M=
X-Received: by 2002:a17:90b:92:b0:2a2:53d:a19c with SMTP id bb18-20020a17090b009200b002a2053da19cmr2843477pjb.19.1712377999330; Fri, 05 Apr 2024 21:33:19 -0700 (PDT)
MIME-Version: 1.0
References: <CAM5tNy4y36AEyD5SeOZ2F1t8AYhu8-ZKPyNvCd-dmydFg1kJtA@mail.gmail.com> <19e3502ca1859608975bd17dc18e6774bf0bfab3.camel@hammerspace.com> <CAM5tNy41j0BLi0ixu=VA_rT14GxL7ZKKwbSyb1UAgf-xAE8m+g@mail.gmail.com> <0d1c12d3e85a5feb165c13b44b0f25111224166f.camel@hammerspace.com> <28CDDCED-0056-427A-8D71-49AB937F8884@hammerspace.com>
In-Reply-To: <28CDDCED-0056-427A-8D71-49AB937F8884@hammerspace.com>
From: Rick Macklem <rick.macklem@gmail.com>
Date: Fri, 05 Apr 2024 21:33:08 -0700
Message-ID: <CAM5tNy7pkz6q5fY_NvDhLs91Eq-DNXx5gvFOeh3fqsNS0YwA9A@mail.gmail.com>
To: Trond Myklebust <trondmy@hammerspace.com>
Cc: "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/C4iPnFNJPboq8ALmkEBfOiEfYQw>
Subject: Re: [nfsv4] RFC: Is Open/Claim_Delegate_Prev done before/after Reclaim_complete?
X-BeenThere: nfsv4@ietf.org
X-Mailman-Version: 2.1.39
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: Sat, 06 Apr 2024 04:33:25 -0000

On Fri, Apr 5, 2024 at 8:24 PM Trond Myklebust <trondmy@hammerspace.com> wrote:
>
>
>
> On Apr 5, 2024, at 23:02, Trond Myklebust <trondmy@hammerspace.com> wrote:
>
> On Fri, 2024-04-05 at 16:13 -0700, Rick Macklem wrote:
>
> On Thu, Apr 4, 2024 at 9:18 PM Trond Myklebust
> <trondmy@hammerspace.com> wrote:
>
>
> On Thu, 2024-04-04 at 16:23 -0700, Rick Macklem wrote:
>
> Hi,
>
> I am in the process of implementing Open/Claim_Delegate_Prev and
> have
> run
> into a question I cannot seem to answer from reading RFC8881.
>
> There is this snippet:
>    enum open_claim_type4 {
>            /*
>             * Not a reclaim.
>             */
>            CLAIM_NULL              = 0,
>
>            CLAIM_PREVIOUS          = 1,
>            CLAIM_DELEGATE_CUR      = 2,
>            CLAIM_DELEGATE_PREV     = 3,
>
>            /*
>             * Not a reclaim.
>             *
>             * Like CLAIM_NULL, but object identified
>             * by the current filehandle.
>             */
>            CLAIM_FH                = 4, /* new to v4.1 */
> The comments in the above seem to "hint" that CLAIM_DELEGATE_PREV
> is
> a
> reclaim type operation.
> If that is the case, I'd assume it/should be performed by the
> client
> before it does a
> Reclaim_Complete?
>
> Then there is this snippet:
>    For OPEN requests that reach the server during the grace
> period,
> the
>    server returns an error of NFS4ERR_GRACE.  The following claim
> types
>    are exceptions:
>
>    *  OPEN requests specifying the claim type CLAIM_PREVIOUS are
> devoted
>       to reclaiming opens after a server restart and are
> typically
> only
>       valid during the grace period.
>
>    *  OPEN requests specifying the claim types CLAIM_DELEGATE_CUR
> and
>       CLAIM_DELEG_CUR_FH are valid both during and after the
> grace
>       period.  Since the granting of the delegation that they are
>       subordinate to assures that there is no conflict with locks
> to
> be
>       reclaimed by other clients, the server need not return
>       NFS4ERR_GRACE when these are received during the grace
> period.
> This clearly states that CLAIM_DELEGATE_PREV cannot be performed
> during the server's grace period.
>
> The above two statements are not necessarily contradictory but it
> does seem
> that, if the server is in its grace period, the Reclaim_Complete
> needs to be
> done before any Open/Claim_Delegate_Prev, since Reclaim_Complete
> tells
> the server when to end its grace period.
> Note that, usually, a client would not be rebooting when a server
> is
> in its
> grace period, but that could happen.
>
> Bottom line...
> Should a client perform Open/Claim_Delegate_Prev before or after
> Reclaim_Complete?
> And, if the answer is "after", how does the server know when a
> client
> is done recovering opens/delegations via
> Open/Claim_Delegate_Prev?
>
> Thanks for any help with this, rick
>
>
> CLAIM_DELEGATE_PREV has now survived at least 24 years as part of a
> "standard" and has yet to be properly described. I can find
> references
> to it in RFC3010 and all NFSv4 descriptions since then, but I have
> yet
> to meet anybody who can claim to have implemented it in a product.
>
> IMO, it is time to drop it, and start afresh with something that
> has
> actually been road tested before someone started putting pen to
> paper.
>
> Well, I am going to respond to David's post in some more detail, but
> I will
> note here that, with the exception of whether to do it before or
> after
> Reclaim_complete,
> I have not found serious issues with it. (Btw, the FreeBSD server has
> had a "dormant"
> implementation for about 20years, although I am just now trying to
> use it by the
> FreeBSD client. I was wondering if I would find any other server
> implementation at
> the Bakeathon in a couple of weeks.)
>
>
> I see. So how do you plan to deal with the case where the server denies
> the request for a delegation? Will your client just toss away the dirty
> data?
>
>
> My problem with CLAIM_DELEGATE_PREV is that the “spec” has no description whatsoever for what happens in the “unhappy path” case, where the application has done everything right to apply a share lock, or a byte range lock to the parts that it plans to modify, and yet because the server cannot be contacted, the client lets everything proceed because it wants to assert a delegation once the server is back online.

I have assumed that Open/Claim_delegate_prev will only be used by a
client after it has rebooted. I cannot see it being
any more/less useful for recovery from network partitioning than the
rest of the Opens.

I assume that a server will reply to an Open/Claim_delegate_prev with
NFS4ERR_EXPIRED if it does not have such a
delegation for the client, since it was not able to recall it.
I'm not sure if the spec states that, but since delegations are
covered by the lease, it makes
sense to me?

No doubt network partitioning and NFS4ERR_EXPIRED is ugly. But I do
not see anything different for CLAIM_DELEGATE_PREV
than other open/delegation handling. Typically a client mount will
hang pretty quickly during a network partitioning, but applications
can certainly write a lot of dirty data into a client's data cache
before the network partitioning is noticed and a client does not
have any good way to deal with the dirty data.

> …. and yet the assertion of the CLAIM_DELEGATE_PREV delegation can trivially fail if someone has modified or deleted the file during the period when the client was unable to talk to the server, and there is nothing in the spec that advises what to expect next.
If the file has been deleted, all opens will fail (NFS4ERR_NOENT or
NFS4ERR_STALE?).

If the file was modified and the client does a Claim_null open, the
only indication
that it has been modified is the change attribute's value, which it
might not have kept.
At least the open/Claim_delegate_prev fails (presumably with NFS4ERR_EXPIRED)
and the client knows the file might have been modified by someone
else. Not great,
but I do not see how it is worse off than without Claim_delegate_prev?

rick

>
>
> _________________________________
> Trond Myklebust
> Linux NFS client maintainer, Hammerspace
> trond.myklebust@hammerspace.com
>