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

Thomas Haynes <loghyr@gmail.com> Thu, 18 April 2024 23:57 UTC

Return-Path: <loghyr@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 75B1FC14F6A4 for <nfsv4@ietfa.amsl.com>; Thu, 18 Apr 2024 16:57:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.095
X-Spam-Level:
X-Spam-Status: No, score=-2.095 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_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=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 8exi-BVTTdPG for <nfsv4@ietfa.amsl.com>; Thu, 18 Apr 2024 16:57:01 -0700 (PDT)
Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (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 11826C14F6A3 for <nfsv4@ietf.org>; Thu, 18 Apr 2024 16:57:01 -0700 (PDT)
Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6ed691fb83eso1310900b3a.1 for <nfsv4@ietf.org>; Thu, 18 Apr 2024 16:57:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713484620; x=1714089420; darn=ietf.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=Q2PKwrvLTBH+xbThmoExNFsOUGvY1ijyv/Srj3gFpf8=; b=mpob8RduJ2V0qGhF9LrjgdOJDbIsVVhac6FJcCCW/1CG4N3ez1HoUrZUlcLY0j9msg J6t+tlBltAOXuixIfMgPAU5axT4aEIOXy19PV8choKzTE6bay6MDNow0J8BF5rh+1K2C IchdUc1WQRe5Pc+r1QDiNrAYvWMibOxiLi2QAf+h3Oe9couJdlApJ8thE736KXl46m7V PZvYiBWOl+jQUUwPKwKvJzxoRXvY5fjkymDBWras0MUo+vtHjwrghv1PhAEZ4f0nudNE XLjaOb0Z6UCxB/Z+wgMkUm/q3tdBGt1FvKxMbdeBWf12xOevYOcVhED73l9F7kdvs2PX N4Qw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713484620; x=1714089420; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q2PKwrvLTBH+xbThmoExNFsOUGvY1ijyv/Srj3gFpf8=; b=g/tWUSywUzDcVzznVMgQGFfgkVROzN0kBAEtrQ2lDMNBMGIW6qZ3WEHkqcqv13lG7g tVvSPvGEMrXRQelYTIed9/SIl+ulICqNYMcTjKE7GmXSsi/JFXUDjJ33eIRb+NjUjBF/ VJIK13W0bJROLBCgeB6K5vYRsuolaWMWnRLAab6tLkZbXWitchg0mZ9lsqiTKCcT/DZw U+owCfnO2vopAEAMkdmIj565CxY6Br2T7oXJmp58KIOX6ccDLPROzvBSMV2t9ywTPMS6 i+/2lpRlZXa0fil/+ko8MIsrG3Mrr6Z0l1BtVowyOM0OnwrVT1MyNwf+dvKdY+Dk6t2x /y4Q==
X-Forwarded-Encrypted: i=1; AJvYcCX/O/PQnyeJW+YW1Wl0252uJwC4bLWD3A2OxLC+ntCglG7MB4nIGLVK2WWqIkBTDQ9A9FgOhVZaccF2RMNUNw==
X-Gm-Message-State: AOJu0YwBRz1Z6jg7vVW4PSEIP57uZII8O2ANEtgefUGyEbEGaLRstndG 0JhY2TKnut7K6J5jsWM+qMciKea9FCPYYxZ2PhpMzeFRd21e9bf6qZokRuXC
X-Google-Smtp-Source: AGHT+IHgfnraUHXDAhi5l37m4dq6nQ+N736AYuNm5yrIsAYtzQVySpyIQ0AxXuJ7dhW7mxKtcjWaJg==
X-Received: by 2002:a05:6a00:3cd4:b0:6ed:d47e:625d with SMTP id ln20-20020a056a003cd400b006edd47e625dmr674727pfb.30.1713484619833; Thu, 18 Apr 2024 16:56:59 -0700 (PDT)
Received: from smtpclient.apple ([2601:647:4500:91:949d:6322:5dca:ca9]) by smtp.gmail.com with ESMTPSA id n7-20020aa79847000000b006f0c0b6eee8sm326072pfq.185.2024.04.18.16.56.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2024 16:56:59 -0700 (PDT)
From: Thomas Haynes <loghyr@gmail.com>
Message-Id: <7ECB2A14-9884-483E-A04B-0AC14841BB48@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_7E17038D-B298-4DFB-99F2-AAC940DDC153"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Date: Thu, 18 Apr 2024 16:56:47 -0700
In-Reply-To: <CAM5tNy4izPiqDCxJXkWCUCpjFRHx3uR9Po+i_m8O0pmFUFuLbw@mail.gmail.com>
Cc: Trond Myklebust <trondmy@hammerspace.com>, "nfsv4@ietf.org" <nfsv4@ietf.org>
To: Rick Macklem <rick.macklem@gmail.com>
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> <CADaq8jdifYwzZDkrYnaZwV-_bYs=3z8HxfM7mtUAoPy29uvAig@mail.gmail.com> <d4b197a4dcad15d30b4aec25adbd5bb08485f121.camel@hammerspace.com> <CAM5tNy7cDpMd+zms1r6PjtVvZQ7LWyyrFmL6Pn_x1FkJYfPckA@mail.gmail.com> <CAM5tNy6vX6XUfwGLuOWOHWHBxhrL-Kr6Xe-OJT8hspZbuO6PRQ@mail.gmail.com> <6513a671fae58f522224fb608dd9735c2bb5ddaa.camel@hammerspace.com> <CAM5tNy4izPiqDCxJXkWCUCpjFRHx3uR9Po+i_m8O0pmFUFuLbw@mail.gmail.com>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/vXS3AcZEVUKFMhQC5saZEn4JKUw>
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: Thu, 18 Apr 2024 23:57:03 -0000


> On Apr 18, 2024, at 1:25 PM, Rick Macklem <rick.macklem@gmail.com> wrote:
> 
> On Thu, Apr 18, 2024 at 8:53 AM Trond Myklebust <trondmy@hammerspace.com <mailto:trondmy@hammerspace.com>> wrote:
>> 
>> On Wed, 2024-04-17 at 18:54 -0700, Rick Macklem wrote:
>>> On Wed, Apr 17, 2024 at 5:37 PM Rick Macklem <rick.macklem@gmail.com>
>>> wrote:
>>>> 
>>>> On Wed, Apr 17, 2024 at 4:56 PM Trond Myklebust
>>>> <trondmy@hammerspace.com> wrote:
>>>>> 
>>>>> On Wed, 2024-04-17 at 07:46 -0400, David Noveck wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> 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.
>>>>> 
>>>>> 
>>>>> Please re-read what I said above (repeated here):
>>>>> 
>>>>>>>>> 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.
>>>> I did not get this. Now I see that in LINK (sec. 18.9.3) it says
>>>> that
>>>> delegations must
>>>> be CB_RECALL'd (I never noticed that and assumed that a LINK could
>>>> be done by another client when a delegation is held. My Bad;-)
>>>> 
>>>> So, yes, the client that holds a delegation can track numlinks for
>>>> the
>>>> file. I didn't realize that was the case.
>>> I now think there is a glitch in this plan...
>>> I cannot see anywhere in RFC7530 that specifies LINK should recall
>>> delegations, so I am not sure if a NFSv4.0 LINK done by another
>>> client
>>> could increase numlinks without the delegation being recalled.
>>> (I knew there was a reason the FreeBSD NFSv4 server did not recall
>>> delegations for LINK. I will patch it to do so for NFSv4.1/4.2.)
>>> 
>> 
>> It doesn't just change nlink. It also bumps the change attribute (and
>> the ctime), which by itself implies that it must recall delegations
>> according to RFC8881.
>> Specifically in section 10.2:
>> 
>>   *  The semantics of the file system are crucial in defining when
>>      delegation recall is required.  If a particular change within a
>>      specific implementation causes change to a file attribute, then
>>      delegation recall is required, whether that operation has been
>>      specifically listed as requiring delegation recall.  Again, what
>>      is critical is whether the guarantees provided by the delegation
>>      are being invalidated.
>> 
>> The Linux client interprets that to mean that LINK will recall
>> delegations.
> Yes, I agree, for NFSv4.1/4.2.
> (And admit the FreeBSD NFSv4.1/4.2 needs to be fixed to do this.)
> 
> But what about NFSv4.0?
> I'm looking, but cannot find similar words in RFC7530.
> (Sec. 10.4.4. deals with Recall  of an Open Delegation, but it
> does not mention LINK and it does not mention "any operation
> that modifies the attributes. The same words appear to be in
> RFC3530, except under Sec. 9.4.4.) I do find mention that
> holders of delegations can either not modify attributes or
> only the attributes related to writing for write delegation.
> However, I cannot see any mention of clients that do not
> hold delegations.
> 
> Maybe you are arguing that it should have been obvious for
> NFSv4.0, but it was not so for me (and, therefore, maybe other NFSv4.0
> implementers?). There is also the case of NFSv3 LINK RPCs.
> 
> Although it would be nice to assume, I'm not convinced that
> extant NFS servers will all provide the guarantee that numlinks will
> not be changed (increased via LINK) when the client holds
> a delegation.
> (If the client could be sure the NFS server was a "pure NFSv4.1/4.2
> server and did not support earlier NFS versions, I would agree with
> you.)

I was under the impression that a server was either NFSv4.0 or NFSv4.1/4.2, even if pNFS was not applied.

And again, I really wish we had bumped the major version to NFSv5.0 on that release….




> I just think that, since RFC7530 Sec. 10.4.4. makes no mention of
> LINK, it is risky to assume all NFSv4.0 server implementations recall
> delegations when a LINK is done. (In particular, since the NFSv4.0
> cannot know which client is performing the LINK.)
> 
> rick
> 
>> 
>> --
>> Trond Myklebust
>> Linux NFS client maintainer, Hammerspace
>> trond.myklebust@hammerspace.com <mailto:trond.myklebust@hammerspace.com>
>> 
>> 
> 
> _______________________________________________
> nfsv4 mailing list
> nfsv4@ietf.org <mailto:nfsv4@ietf.org>
> https://www.ietf.org/mailman/listinfo/nfsv4