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

Rick Macklem <rick.macklem@gmail.com> Tue, 16 April 2024 21:40 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 D107AC14F71D for <nfsv4@ietfa.amsl.com>; Tue, 16 Apr 2024 14:40:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.098
X-Spam-Level:
X-Spam-Status: No, score=-7.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_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 j_Kdfr-T-FPa for <nfsv4@ietfa.amsl.com>; Tue, 16 Apr 2024 14:40:54 -0700 (PDT)
Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (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 5DEC4C14F683 for <nfsv4@ietf.org>; Tue, 16 Apr 2024 14:40:54 -0700 (PDT)
Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5dcc4076c13so141782a12.0 for <nfsv4@ietf.org>; Tue, 16 Apr 2024 14:40:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713303653; x=1713908453; 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=TKwUUFyGLW4IheHUztGz2uibKI1pwSxkt9mzASsKIZE=; b=bpaiNcq/YqMf96OXkYYmnNPLzReiKPuUgUVxfKWsiYjUcRYhqxush8yxOPyWOcxSjr TmxrFgGhlpwWn+0f4jB+OMcEqb3HxpvyhPVFs2KMH9NJKW0mHs+6+a91l/TK7rUM8shk NhYw/7Mtl9PszLAZLrwWEWCwayu/FiPqfSugU6iRj2qer7OpbYGJcVBX92oQDby085E6 OlLs/NpECiXJsCdpw5LgqR5ltYN7KHgY+3T3LNXfj9G7YBCZ4iI6y80o+GvWPdaepUAV r2P7wySYVXUOzJZ/obfdcT7siiE0/4JDxKg2SL+n604h2Iw1k6kihCwJZQCbFDG2qkJA gDxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713303653; x=1713908453; 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=TKwUUFyGLW4IheHUztGz2uibKI1pwSxkt9mzASsKIZE=; b=G+UQtODSkuHubCJkK3Sh6iK0LU2kLiwoQotDcxZZXWhMSHFr95JD2TGalUWaqYKS83 QCOFhtTALbtbBHH6ksFtncfrkT1wzi0LyLPU8252HeSivFDU5jLxA4tLUjIhfktbC4Hq kiNX7fiXl5bakvqx8xLl9NOMIjccCGVc2MbzRqKRIoMRBWhzlwZk/f27vK+de+D9vfcb Sh4ymMsciv/BjWgdmvKGCYhpTw7Dy5cyG4ePTkSImKcS1Bgi/SZeaedsRfkTbMfbsUfZ LbdtvfD2rrk7PZ4lkwoUh2G0N1tArMHZcsT0QHbYoOnMcGea+h8AYpg+ERPgMdBjTl/E hzVw==
X-Forwarded-Encrypted: i=1; AJvYcCUJH8SVJs8d1DdsSNa4kYfAHo6ioMcUGm04R4u+5Hgstvo+oNGY4trSxZc7Er4a4PeKdcf0vQQ4ZTwa6delLw==
X-Gm-Message-State: AOJu0Yy7XHQK3WZcBID4iBPJZS9vm9SVqIABc6FlLiOlmyCKJhlHTUdg KNCY8acyx9+ZOqoN1y/lKFgannN5+O8DMKFVcPBKSOUbVh3jZWdAEiGvHczw6Yqf1rPD7iC1JUu 5QuK0debA350HiRFG2cAVvSOTuQ==
X-Google-Smtp-Source: AGHT+IFWTix/TI9ZkRQhEkWFA8ns2RT2w2oLfIUjGDvsgPXhv8UdrB1xGUx4Gau/kxZbvWiIMdE+bc0smslM+l4+pAg=
X-Received: by 2002:a17:90a:2dcf:b0:29b:d747:f7ae with SMTP id q15-20020a17090a2dcf00b0029bd747f7aemr4422781pjm.14.1713303653238; Tue, 16 Apr 2024 14:40:53 -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>
In-Reply-To: <adc3fb5ed3674078c64399b19891c63b7a1185e4.camel@hammerspace.com>
From: Rick Macklem <rick.macklem@gmail.com>
Date: Tue, 16 Apr 2024 14:40:42 -0700
Message-ID: <CAM5tNy77PNiH6aTWTOyhrofe2cFTg+ga8sFzGbi0EHSfrXz79w@mail.gmail.com>
To: Trond Myklebust <trondmy@hammerspace.com>
Cc: "davenoveck@gmail.com" <davenoveck@gmail.com>, "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/0WPWpT0ApKWaS0Na_nS3tMGPNHM>
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: Tue, 16 Apr 2024 21:40:54 -0000

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.
>
> 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
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. It also does not DelegReturn a delegation
  for a file it is about to Remove.
- 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.

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

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