Re: [nfsv4] RFC: New DelegReturn_NoFH operation for NFSv4.2?

David Noveck <davenoveck@gmail.com> Wed, 17 April 2024 11:46 UTC

Return-Path: <davenoveck@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 8E12AC14F60D for <nfsv4@ietfa.amsl.com>; Wed, 17 Apr 2024 04:46:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.097
X-Spam-Level:
X-Spam-Status: No, score=-7.097 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, 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 deLkEakeZ3pT for <nfsv4@ietfa.amsl.com>; Wed, 17 Apr 2024 04:46:25 -0700 (PDT)
Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (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 5AE12C14F604 for <nfsv4@ietf.org>; Wed, 17 Apr 2024 04:46:25 -0700 (PDT)
Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-434b7ab085fso5286311cf.1 for <nfsv4@ietf.org>; Wed, 17 Apr 2024 04:46:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713354384; x=1713959184; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+wq6wtgykj/I8VuwBGCasXITViwcWRIpGVMymy7y8zY=; b=N6Z9LhHaQ7FYY+HOxLNq2vlLU9ehM61Ab13fSPnbMBVIyalaZlvG67bB9kkZdSExkO S3e2qW7z8RcesRpOW3h+FkC3wic3+So6JvNjvvP6SuR1BaWAqYy/GqUIDx9d0gsGh8II DCIOK0rYtQj8piz/nzZGhMt6zHy4O/NNp1vACwlyExHwRdgPmf7pRVxi6MwvprYwkpqz XtXkEmH6pfTafl99V+D2SBnS2EjR0umu+kbGy2ek6UtPgj57euiKoIMdcZYnOtEQthDt FnpLEGOcO2Gi6yFsDr8aVYSiWLdKXRDYYiN3GKWUzuTyNiwmsAzoBkP8AeOYZEKZUZAv En0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713354384; x=1713959184; h=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=+wq6wtgykj/I8VuwBGCasXITViwcWRIpGVMymy7y8zY=; b=pduxOmxqTVvnpobXQbqedUzQe2ur9pf6tabBkWOZjpJDi/YChJs7agun1Vu4hpbRHp D4qIXxPT17y3AxnzF3j5MCbpYK2Mg/jeu8S971Byr0Z2CuKeByD1u60kc3tyKMFR7bXF xTZ+v4Fo+8PEbGyJ6vEkXmwvwRhBVMiYypzOuibNJLMY9tWpBFoypB/ZJdnT4nLEpkI1 PLMouo19WHXOeC8thkRQY/y0Oiv/nnGJDcwGySoHkngRMdT/jqxlb9vedGz4pUByj8ZN 2v+RSkBDFrxKV08zzteMTCNwEBWXpryzOKBunaecI7k4zCkiA80bvPjyGnCBMrE8zHVz QdwQ==
X-Forwarded-Encrypted: i=1; AJvYcCXppLJ1usiFocnIZonZTVAJMVQdH9ZIvhOwn2aCArN7d0wllp6gBun5y/U5QXMKwzbNT8qR6kZ6pr/64JfD3A==
X-Gm-Message-State: AOJu0YzQawuXF2N9R8xh3G8WXLqjhOqieFbMnIaqfWTil3ObIVIl1GNQ o2/vRXnDt/QfQpbD79T3vZ5BkRr+5Y69/1kja03KTXPb6dRPZrFdKPz2sxEcdYOotpwERQx+I37 QlHxi7vnZ/XWNP91PPABod12Dbi8=
X-Google-Smtp-Source: AGHT+IHFky4foStr9mOAeGcfmnWvOSNhBvvxD0adx4PCDWPHTRMAQW1FvqhamDxlfDCzu3/02OZM4XWw5vi0OZNAtcs=
X-Received: by 2002:ad4:404d:0:b0:69b:6c70:3207 with SMTP id r13-20020ad4404d000000b0069b6c703207mr7606520qvp.28.1713354383990; Wed, 17 Apr 2024 04:46:23 -0700 (PDT)
MIME-Version: 1.0
References: <CAM5tNy407R30WQqCuzFE+feRz42wkaAAGOwiHwqFoWZSpwfT0A@mail.gmail.com> <9D17BB42-54A9-46DB-8E4F-3FF852EEAC90@hammerspace.com> <CADaq8jePTg8WVFe2FmrwgUjyc7H9v=Ln7g2FT9G5DJtkpVSF3Q@mail.gmail.com> <CAM5tNy6-ADHC1z9HJME0r5o-hDeG9OucE_SWftDrqE4JnMrhAg@mail.gmail.com> <adc3fb5ed3674078c64399b19891c63b7a1185e4.camel@hammerspace.com> <CAM5tNy77PNiH6aTWTOyhrofe2cFTg+ga8sFzGbi0EHSfrXz79w@mail.gmail.com>
In-Reply-To: <CAM5tNy77PNiH6aTWTOyhrofe2cFTg+ga8sFzGbi0EHSfrXz79w@mail.gmail.com>
From: David Noveck <davenoveck@gmail.com>
Date: Wed, 17 Apr 2024 07:46:12 -0400
Message-ID: <CADaq8jdifYwzZDkrYnaZwV-_bYs=3z8HxfM7mtUAoPy29uvAig@mail.gmail.com>
To: Rick Macklem <rick.macklem@gmail.com>
Cc: Trond Myklebust <trondmy@hammerspace.com>, NFSv4 <nfsv4@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000006ea8ad06164967bc"
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/EHKqzb822fT9q_XQ-ZeSOCfoLkA>
Subject: Re: [nfsv4] RFC: New DelegReturn_NoFH operation for NFSv4.2?
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: Wed, 17 Apr 2024 11:46:27 -0000

On Tue, Apr 16, 2024, 5:40 PM Rick Macklem <rick.macklem@gmail.com> wrote:

> On Tue, Apr 16, 2024 at 7:44 AM Trond Myklebust <trondmy@hammerspace.com>
> wrote:
> >
> > On Tue, 2024-04-16 at 07:06 -0700, Rick Macklem wrote:
> > > On Tue, Apr 16, 2024 at 5:21 AM David Noveck <davenoveck@gmail.com>
> > > wrote:
> > > >
> > > >
> > > >
> > > > On Mon, Apr 15, 2024, 8:06 PM Trond Myklebust
> > > > <trondmy@hammerspace.com> wrote:
> > > > >
> > > > >
> > > > >
> > > > > On Apr 15, 2024, at 18:31, Rick Macklem <rick.macklem@gmail.com>
> > > > > wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > I am wondering if others have found this a pita and are
> > > > > interested in
> > > > > a new operation for NFSv4.2 to get around it.
> > > > >
> > > > > Right now DelegReturn requires a CFH and delegation stateid.
> > > > > I do not know why the CFH is needed, since it seems that the
> > > > > delegation stateid should be sufficient?
> > > > >
> > > > > This new operation would be the same as DelegReturn except that
> > > > > it would not require a CFH argument.
> > > > >
> > > > > Why am I interested in this?
> > > > > - Lets assume a NFSv4.2 server that supports persistent FHs and
> > > > >  multiple hard links (as most extant servers do).
> > > > > - A client mounted to this server is removing a file for which it
> > > > > holds
> > > > >  a write delegation and a bunch of dirty data.
> > > > > Right now, the client must:
> > > > > - Write the dirty data back to the server.
> > > > > - DelegReturn
> > > > > - Remove
> > > > > because the client has no way of knowing if the file will be
> > > > > deleted
> > > > > by the Remove (or alternately is just removing one of several
> > > > > hard links).
> > > > >
> > > > >
> > > > > If a client is holding a delegation, it will presumably have done
> > > > > a GETATTR at some point while holding that delegation so should
> > > > > know how many links remain. While it is true that the unlink
> > > > > might invalidate the filehandle, that’s not a situation you are
> > > > > able to fix with the new operation.
> > > > >
> > > > > With a DelegReturn_NoFH, the client could:
> > > > > - Do a compound RPC with
> > > > >  Remove
> > > > >  PutFH of file
> > > > > - if the above returns NFS_OK, the file still exists and the
> > > > > client
> > > > >  can continue to use the delegation, writing the dirty data back
> > > > >  to the server sometime later (or maybe never, if the file gets
> > > > >   deleted by a subsequent Remove).
> > > > > or
> > > > > - If the above returns NFS4ERR_STALE for the PutFH, the file
> > > > >  has been deleted. It can throw the dirty data away and
> > > > >  DelegReturn_NoFH the delegation.
> > > > >
> > > > > A similar situation exists for Rename where the destination
> > > > > already exists.
> > > > >
> > > > > I find this scenario happens frequently during software builds.
> > > > >
> > > > > So, what do others think  w.r.t. this new operation? rick
> > > > >
> > > > >
> > > > > Why would you need to do a DELEGRETURN if the PUTFH returns
> > > > > NFS4ERR_STALE?
> > > >
> > > >
> > > > To make sure the client and server agree on the state of things.
> > > >
> > > > > If the server isn’t willing to just invalidate the delegation on
> > > > > the final unlink of the file,
> > > >
> > > > I'm not sure about "unwilling",  but I am uncomfortable with
> > > > unilateral stare changes like this, even if the spec indicated that
> > > > needed to be done, which is harder to effect than an extension such
> > > > as Rick is proposing
> > > >
> > > >  > then it can and should recall the delegation (and any pNFS
> > > > layouts that might be outstanding).
> > > >
> > > > If it did recall it/them, then there is no way to return them
> > > > without something like Rick's proposed extension.
> > > I assumed Trond meant "recall during the REMOVE" while the FH is
> > > still valid.
>

I didn't get that.  Apparently, I was mistaken.

>
> > Yes. This is a clarification of how the server can deal with the
> > problem (if it thinks this is a problem) within the confines of the
> > existing spec
>

That depends on what the problem is.  Your proposal does address the
problem of recalling a delegation when it is incapable of being returned.
It doesn't, at least alone, solve Rick's problem  which is that he wants to
be able to know, at the time of recall, whether he can throw away pending
writes, as opposed to flushing them to the server.

I believe that, if the server acts as you suppose it might, we would have a
solution, if Rick ceased to depend on the legacy approach to remove
involving "silly rename".  If you used a more modern approach to remove in
which the fh invalidation is deferred to the last close, then the existence
of a delegation would prevent the invalidation until delegation return.
Since, until it was returned, there would be a potential open outstanding,
at delegation recall you could test the link count and throw away the
pending writes if the count is zero. If it isn't zero, you flush the
writes  before return.

Just fyi, I should be able to test the stuff I've posted here recently
> at the Bakeathon next week.
> - I have a client setup that tries to do Open/Claim_deleg_prev_fh
>   before ReclaimComplete.


That sounds like it would work OK.

It also does not DelegReturn a delegation
>   for a file it is about to Remove.
>

OK.

- I'll have the server configured so that it does not bother to CB_RECALL
>   a delegation issued to the same client as the one doing the Remove or
>   Rename.
>

In that case, I think the delegation will never be released and will hang
around as an unreturnable piece of state.  On the other hand, if the server
does what Trond proposes the delegation will be appropriately returned but
you will  be doing those writes unconditionally, which is a performance
issue, although not a major one.

>
> I'll report here if the testing finds anything interesting, rick
>

Thanks.



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