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

Rick Macklem <rick.macklem@gmail.com> Tue, 09 April 2024 22:58 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 8DDE0C14F6BB for <nfsv4@ietfa.amsl.com>; Tue, 9 Apr 2024 15:58:52 -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 BNLVcxKSXg11 for <nfsv4@ietfa.amsl.com>; Tue, 9 Apr 2024 15:58:48 -0700 (PDT)
Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 17C0BC14F681 for <nfsv4@ietf.org>; Tue, 9 Apr 2024 15:58:43 -0700 (PDT)
Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2a2474f2595so5009577a91.1 for <nfsv4@ietf.org>; Tue, 09 Apr 2024 15:58:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712703522; x=1713308322; 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=69PpVzm+/NJMEfZTUjK8Vzd0GnSh1uBoui6PW7cl7Bg=; b=Earllp2Qveywhy7v/vO7o8bbVh4Mi+EXUul0Liy1dz1UT0Vn/5WM7UZlT1URv0DpgI amEBxW0HCJrc3wCCjEroc+oRztFmCwSg2TDFqz8MnOb1cMwz4JvS6QVOee1yG1nPl6f3 EAFLyUrPDR3WBaHxcDArXtp6DBWusBOrmRjufvTY6vKxZ1sgDWixOHF+w7iyqkEzWWpi Tffgz20N0Rk9fXpohqp+DTzA/K1I618JUecybr+o4jkf4Erxp+CF58kXS1YKoYKiUufv xsfz+FSQO9SAwBz5Y+sLsu6DCrIoJC9K13viBxuG40Y67Crq99asPyWAMAhqC4N6Ie/W 8Fsw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712703522; x=1713308322; 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=69PpVzm+/NJMEfZTUjK8Vzd0GnSh1uBoui6PW7cl7Bg=; b=eu6mOfGbeV1oVRDl8+iutiSbI//0OduT1UygWCzztv5Elc84c5iEICrJeyo8ynQ96Z ZicK8C44ZJT0zeDLn78NPBmViqkwAUqJODmkJWmcUnfDq/cBykesjrFDdIHlUIQ3bqmp 9rg6bYjbhcuJ6X6GiywpSMvulDhv0JhuREUJ7FHoUweYw+6iSzArMzzMjYMraJq32C/w Xxj8jIRc1Prpta3VPX4hXou0ORA7TcHdpDTCGQNZQj4VSoHKgDQQwolTQ5ghGnSABWwr 12HsUZ/xfh/Ealyc8oe/cePugv+g/v3q+8HcSvdTWGG1s2yFPJWl6aE92Zihpr7koihi Z1Sw==
X-Gm-Message-State: AOJu0Yx2Ns8VbVS6Wz+tri1BNoZhulFe/9p1WHCV9PSfmhCk1MGVbzT+ CIQ1L9GvC5aKsBYuhCxX7KC+x5wfMN2OJGAR2ShPPV0TmdnuKLqAiZNbzR01dEKjsuhdrZpf1yQ GRXLLzSpYjlFD358MbLu86X2aEqNxDEk=
X-Google-Smtp-Source: AGHT+IGTEMc31dQXpzDDvkQiuG0BYx2UtV5psc0brPqTGAwoI+xJUJ3z2Ljk7G/i/1RzSLKRI4gqETqtu+AmQjTKers=
X-Received: by 2002:a17:90a:d50b:b0:2a5:3f30:f5f9 with SMTP id t11-20020a17090ad50b00b002a53f30f5f9mr1085413pju.25.1712703522018; Tue, 09 Apr 2024 15:58:42 -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: Tue, 09 Apr 2024 15:58:31 -0700
Message-ID: <CAM5tNy55u+FqLd0dM7xC5kh1Rip2UKeW8ptLr_QVDQYd7itumQ@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/g63_ga8cvHreFegbyWmalb11hn8>
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: Tue, 09 Apr 2024 22:58:52 -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?
After thinking about this a little more, my current plan (which could change
at any time) is:
- When a delegation cannot be recovered after a client reboot, the cached
  data for the file will be marked Defunct.
  - This means the cached data remains in the non-volatile cache, but
     cannot be used as cached data.
- Then I plan on implementing a couple of commands (I call this cache
   a packrat, in case you wondered about the names):
   packrat_defunct <file-path>
   - This command checks to see if there is defunct cached data for the
      file and whether or not any of it is dirty.
   packrat_flush <file-path>
   - This command flushes defunct cached data that is dirty back to the
      file on the server.
I think these two commands can be used with "find" to deal with dirty data
where there is no longer a delegation and, as such, cannot be written
back to the server automatically. If a file needs to be merged, all the user
needs to do is a:
$ cp foo foo.bak
- before doing the
$ packrat-flush foo

If the above commands are coded carefully, they should be usable by
non-root users, since they will only work on files that the user has write
access to.

rick



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