[nfsv4] Re: question around CB_GETATTR handling

Rick Macklem <rick.macklem@gmail.com> Wed, 04 September 2024 21:05 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 D8F99C14F6A3 for <nfsv4@ietfa.amsl.com>; Wed, 4 Sep 2024 14:05:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.108
X-Spam-Level:
X-Spam-Status: No, score=-2.108 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_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] 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 AyoBU6bdI19W for <nfsv4@ietfa.amsl.com>; Wed, 4 Sep 2024 14:05:13 -0700 (PDT)
Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 62EECC137370 for <nfsv4@ietf.org>; Wed, 4 Sep 2024 14:05:13 -0700 (PDT)
Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-2054e22ce3fso822415ad.2 for <nfsv4@ietf.org>; Wed, 04 Sep 2024 14:05:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725483912; x=1726088712; 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=r26PRA8vpmVgAIxkepDdrJtWeOhTY5FkQVGNwM0u06s=; b=eGxc5sg8r4fuMfBFCqU3WRhyTAlMPvLwakVyZOyeTkVEMxEiwZxhH9KkqNVb3fBC6J isNzokatDt9DVD3nNtsgMXKgK/zCK6SazcBp0OjK6KqZEmhBYTnHa7fubaP3p4zNOnsJ W87X1Tz1WuCyJ/RTCK/ev6g47idEeOg9lG+8di1sZ20qQP3xg4NzY1Why5zTYkh4z7XB 7kGcEv/pl0Ww4JCas4vkJWdcld3i6OEPW9aTmI67nn4xdQrPMY/lQ2hyEdXBFlWsEErX aoAVkOqU91Z5k8ezFkuUjAXS2GmADqw7AErFgSHfNh9wgYfskQqrsJ6pNk2JEZcA10q7 dg4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725483912; x=1726088712; 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=r26PRA8vpmVgAIxkepDdrJtWeOhTY5FkQVGNwM0u06s=; b=oJOV6FyrAVYx2MaM/7PdcomZ+XMa1A/0DaUfqtP6bB8LtNvD44Uuj/x9QjRswtJjis /XTtxrdaNWOraWasX8KUXuD9Ojij4rfmsHFDIlV2XDS4iRw1CS+GL6lqyStOvWXME0kb NYgycSFMiVEd9d7iV2TsXOA04Rp10Kw80iHsXxENW2SIEw6EiZMCV1r2o/L+OAAsyX1B aH1mlXjXP5lh3PUWySBiYuGVkHKHL2/pAtK5IUTf9DdyfsntzOqoijHq4RGaA7Mchovu Hw8M4cfM3VjVyKz4Z7Ot2hMhSQxPE5UoGyWktv2CMqCB662obJtT/bkhPlDHoN3kZdTY k2lw==
X-Forwarded-Encrypted: i=1; AJvYcCWyyesebKYtGWdIZAeS7vY4bX7qA1p6so6OzH5xJddSYs5fVEaGu+gqaQyOOGaj2eROaQOxFA==@ietf.org
X-Gm-Message-State: AOJu0Yxkdn+tl+n1lZuA5dcij2I/B3lwru7dJnYls21nu4OnodjcqXOn moDsfmCvewEiMtligNWuHikx+q8JgwQ7o0Ooxdfpe94uK7RBQhYR+wrO1zrehewpjwqb3pOiolE Rti+31BKloa+7zxLtZfiTQfliO2fst3o=
X-Google-Smtp-Source: AGHT+IEfS1J9UbmMFZEr/ToxEGcS5ldbCYDYMIjCOEoGmYrS8RZ7dR5kjehuTHM1TJQMu9Ovn0GlFyytOCHiICELCzY=
X-Received: by 2002:a17:903:2287:b0:205:68a4:b2d8 with SMTP id d9443c01a7336-20699acb7d5mr86237115ad.11.1725483912080; Wed, 04 Sep 2024 14:05:12 -0700 (PDT)
MIME-Version: 1.0
References: <6e6e3d11d0d48c88cc4cefc28b66d9cfb5874723.camel@poochiereds.net> <e584a74b46853af247212e8dc9bee1949c676cea.camel@hammerspace.com> <28b4c2851c73b518023f2e78be53874c64b1cff3.camel@poochiereds.net> <2074c10c3de50525f30089fd1634c421b3eddca6.camel@hammerspace.com> <880007b35526b41f41ce1263cd96813e7e5faf92.camel@poochiereds.net>
In-Reply-To: <880007b35526b41f41ce1263cd96813e7e5faf92.camel@poochiereds.net>
From: Rick Macklem <rick.macklem@gmail.com>
Date: Wed, 04 Sep 2024 14:05:01 -0700
Message-ID: <CAM5tNy5GJm+BXNiLJUZ8aS5kT5S0uLwUiBBF1MKQQ-0gGmTwQQ@mail.gmail.com>
To: Jeff Layton <jlayton@poochiereds.net>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Message-ID-Hash: QMBUDJXW2R3L43HS6Y2ZB5SYT5ONKLU6
X-Message-ID-Hash: QMBUDJXW2R3L43HS6Y2ZB5SYT5ONKLU6
X-MailFrom: rick.macklem@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-nfsv4.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Trond Myklebust <trondmy@hammerspace.com>, "nfsv4@ietf.org" <nfsv4@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [nfsv4] Re: question around CB_GETATTR handling
List-Id: NFSv4 Working Group <nfsv4.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/nfsv4/EKZBFaQBHqdrakOVsox5EmmFOLM>
List-Archive: <https://mailarchive.ietf.org/arch/browse/nfsv4>
List-Help: <mailto:nfsv4-request@ietf.org?subject=help>
List-Owner: <mailto:nfsv4-owner@ietf.org>
List-Post: <mailto:nfsv4@ietf.org>
List-Subscribe: <mailto:nfsv4-join@ietf.org>
List-Unsubscribe: <mailto:nfsv4-leave@ietf.org>

On Wed, Sep 4, 2024 at 1:09 PM Jeff Layton <jlayton@poochiereds.net> wrote:
>
> On Wed, 2024-09-04 at 19:47 +0000, Trond Myklebust wrote:
> > On Wed, 2024-09-04 at 15:33 -0400, Jeff Layton wrote:
> > > On Wed, 2024-09-04 at 19:21 +0000, Trond Myklebust wrote:
> > > > On Wed, 2024-09-04 at 12:23 -0400, Jeff Layton wrote:
> > > > > RFC 8881, section 10.4.3 has this pseudo code to describe how to
> > > > > handle
> > > > > the size and change attr:
> > > > >
> > > > > ------------------8<-------------------
> > > > >     if (!modified) {
> > > > >         do CB_GETATTR for change and size;
> > > > >
> > > > >         if (cc != sc)
> > > > >             modified = TRUE;
> > > > >     } else {
> > > > >         do CB_GETATTR for size;
> > > > >     }
> > > > >
> > > > >     if (modified) {
> > > > >         sc = sc + 1;
> > > > >         time_modify = time_metadata = current_time;
> > > > >         update sc, time_modify, time_metadata into file's
> > > > > metadata;
> > > > >     }
> > > > > ------------------8<-------------------
> > > > >
> > > > >
> > > > > The line that shows sc = sc + 1 seems to indicate that we need to
> > > > > increment "sc" on every CB_GETATTR, even if nothing changed since
> > > > > the
> > > > > last time.
> > > > >
> > > > > Is that correct or should we only increment it if it wasn't
> > > > > incremented
> > > > > before? The latter would make more sense, given that it doesn't
> > > > > query
> > > > > for change if the file is already considered to be modified.
> > > >
> > > > I believe RFC5661 says
> > > >
> > > >    For simplicity of implementation, the client MAY for each
> > > > CB_GETATTR
> > > >    return the same value d.  This is true even if, between
> > > > successive
> > > >    CB_GETATTR operations, the client again modifies the file's data
> > > > or
> > > >    metadata in its cache.  The client can return the same value
> > > > because
> > > >    the only requirement is that the client be able to indicate to
> > > > the
> > > >    server that the client holds modified data.  Therefore, the
> > > > value of
> > > >    d may always be c + 1.
> > > >
> > > > Which is how the Linux client tries to implement it.
> > > >
> > >
> > > Right, 8881 is similar.
> >
> > Yeah, but nobody has coded to that.
> >
> > >
> > > In this case though, I'm asking about the server-side implementation.
> > > That has its own algorithm (illustrated above in the pseudocode), and
> > > it seems to indicate that once the server detects that the client has
> > > made a single modification to the file, that it needs to increment
> > > "sc"
> > > on every subsequent CB_GETATTR.
> > >
> > > That makes no sense on its face, so I suspect this is a mistake in
> > > the
> > > pseudocode above. Or am I wrong and this is actually necessary?
> > > --
> >
> > Oh... No, as far as the server is concerned, I think it is indeed
> > supposed to increment the change attribute and timestamps on every
> > reply. That is reinforced here:
> >
> >    As discussed earlier in this section, the client MAY return the same
> >    cc value on subsequent CB_GETATTR calls, even if the file was
> >    modified in the client's cache yet again between successive
> >    CB_GETATTR calls.  Therefore, the server must assume that the file
> >    has been modified yet again, and MUST take care to ensure that the
> >    new nsc it constructs and returns is greater than the previous nsc it
> >    returned.
> >
> > The spec also says that "committing the constructed attribute values to
> > stable storage is OPTIONAL". That seems misleading or possibly just
> > incorrect. The fact that the client declares that it is caching data
> > doesn't necessarily mean that it will actually manage to write that
> > data back.
I think the server does have the option of not saving the change attribute
on stable storage and then, after a server reboot, if the client does a
OPEN/CLAIM_PREVIOUS for the delegation, the server can require
an immediate recall of the delegation. (By setting recall == true in the
open_read_delegation4/open_write_delegation4.)

At least I think that works?

>
> Huh, ok.
>
> So imagine that the client gets a write deleg and makes a single small
> change to the file, but then holds on to the write deleg for a long
> time. Other clients are issuing CB_GETATTRs against the server.
> Eventually the delegation is returned.
>
> Could you end up in a change attr reuse situation due to all of this
> faux change attr incrementing by the server?
Since change is 64bits, I think this will take a very very long time?

rick

> --
> Jeff Layton <jlayton@poochiereds.net>
>
> _______________________________________________
> nfsv4 mailing list -- nfsv4@ietf.org
> To unsubscribe send an email to nfsv4-leave@ietf.org