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

Rick Macklem <rick.macklem@gmail.com> Sat, 06 April 2024 03:26 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 13456C14F721 for <nfsv4@ietfa.amsl.com>; Fri, 5 Apr 2024 20:26:10 -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_DNSWL_NONE=-0.0001, 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 UEofwKXI9Lfs for <nfsv4@ietfa.amsl.com>; Fri, 5 Apr 2024 20:26:08 -0700 (PDT)
Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (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 CDBC0C14F71D for <nfsv4@ietf.org>; Fri, 5 Apr 2024 20:26:08 -0700 (PDT)
Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2a28b11db68so1869147a91.2 for <nfsv4@ietf.org>; Fri, 05 Apr 2024 20:26:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712373968; x=1712978768; 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=CZOgY2t7mIR7zS4EoWEt3dU5wmdK4IZ4kI20GTj4FuI=; b=F14vyVk2RhlcjpkXrPjwYs853TQmDeBdF2OnxcrTZe10WRpHjpr545ZsaoDWLuVA45 7hhifZSLBcptsqvPNh0j48P9WyMuFri40/KA7cAwetm7mfLP63hxwAFFlBS/ULT+2/p1 hJ13h26I9r5+q9gjeDZzOaylcaRUNDNqhqMYCdb51mvIHSsxF7mQ2BkGcsbKYW/AMumA M6+et08+NOzpsEsBc8RZSMep0qESl3arynyib/+IOT9aTNtrx4bLYkp+22SLtyyKTQr4 sXQZ1sJtf00l7I4Q2/kG2bwDC8GCYFMFkku+YS2i6EmXqWXQtHUDSTrbCjlCOgWIo+EV qMXA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712373968; x=1712978768; 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=CZOgY2t7mIR7zS4EoWEt3dU5wmdK4IZ4kI20GTj4FuI=; b=PXsvfYddmtAn/zMuDpbmEdRqbOGzgvoKUltwacxmyNikw3oDjbSq1tihMBR0uDOk3L gUBb9Uhg04fo1s85uzshNUZIoDT0gTH7hY8yhjlp0VPkC+6UKsj2OwHkC/oXI5+4NldB SgaSB0408G3R7WHDCbfLpukjS0ME27/nsNJXOtYSXi/RfanOzeF4lwS/dbgDJailWS9S VnYrQ1glBRvSvdJbeLY2lIQCKVQLJmNle2oq9amU+m7HDEhmYz8CqhNnVQas2uvgDRCm 1EQ32GDURiqT8tkDaadCqYUcr1eXix9gqDI6TcRGuuISvUD4OGgL4Qj7mgSUVkuj+eEs QraQ==
X-Gm-Message-State: AOJu0YzZEJWpc9YnjZ46rsngb2C2KmXi7rDqh9bWYIwrORmItb/GuWSM reTyA2+bw7C8Cpv3s+3V4B3V0I4cYBjnWg3LgQRQ70TEGN63Yd0Au1q7mPSEzRquv6RUhYxgvPr 8TwF0s4eCeFOiBOo3nN9GwV44rg==
X-Google-Smtp-Source: AGHT+IHncGrue/7BVuDEZVBbiAloRHJe4kxIQux7b8rVYsR1HsaYwNVaNmSDyPaGTjUAR8ji2Or4LbvagHb88ezXA+4=
X-Received: by 2002:a17:90a:df15:b0:2a1:f3fd:ac4d with SMTP id gp21-20020a17090adf1500b002a1f3fdac4dmr2731982pjb.19.1712373967991; Fri, 05 Apr 2024 20:26:07 -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>
In-Reply-To: <0d1c12d3e85a5feb165c13b44b0f25111224166f.camel@hammerspace.com>
From: Rick Macklem <rick.macklem@gmail.com>
Date: Fri, 05 Apr 2024 20:25:57 -0700
Message-ID: <CAM5tNy6LTXTY=p7FfO5-P7qmUFYkfj7Y2Kw6ns4UdokidJ7acA@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/qN8dL_AvRRDtwy2yk2Obai6Z-ks>
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 03:26:10 -0000

On Fri, Apr 5, 2024 at 8:02 PM 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?
I assume you are referring to the recovery case...
First off, I'll admit that I do not have a good answer but just toss away the
dirty data is probably not one of them. With warnings in the man page
for anyone using
this caching option, it would be more along the lines of:
- Flagging the client cached file as being inconsistent with the one on the
  server and require the user to decide which to keep/merge. (This is ugly
  but at least it can be an option.)
or
- If the client can at least open the file then push the changes through to the
  server. More convenient but will definitely needs a warning in the man page
  that this could overwrite changes done elsewhere. (I am debating doing an
  open for writing with deny_write and then checking the change attribute. If
  the change attribute has not changed since the write  delegation was acquired,
  that case should be safe to write the dirty data back to the server.

This caching option would only be useful for files not being write shared across
multiple clients and with servers that usually issue delegations when a WANT
flag requests them.
If it ever goes into FreeBSD it would be a non-default option and writing the
man page entry to indicate when trouble can occur would be challenging.
(It would also be desirable that the server be a courteous one.)

rick

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