<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt'?>

<rfc
 category='std'
 docName='draft-haynes-nfsv4-uncacheable-01'
 ipr='trust200902'
 obsoletes=''
 scripts='Common,Latin'
 sortRefs='true'
 submissionType='IETF'
 symRefs='true'
 tocDepth='3'
 tocInclude='true'
 consensus='true'
 version='3'
 xml:lang='en'>

<front>
  <title abbrev='Uncacheable'>
    Adding an Uncacheable Attribute to NFSv4.2
  </title>
  <seriesInfo name='Internet-Draft' value='draft-haynes-nfsv4-uncacheable-01'/>
  <author fullname='Thomas Haynes' initials='T.' surname='Haynes'>
    <organization abbrev='Hammerspace'>Hammerspace</organization>
    <address>
      <email>loghyr@gmail.com</email>
    </address>
  </author>
  <date year='2024' month='October' day='13'/>
  <area>Transport</area>
  <workgroup>Network File System Version 4</workgroup>
  <keyword>NFSv4</keyword>
  <abstract>
    <t>
      The Network File System v4.2 (NFSv4.2) allows a client to cache
      both the metadata and the data for a file object. It can also
      cache the metadata for a directory object. Caching the dirents (i.e.,
      the metadata) allows the client to avoid querying the server
      to refresh information. But this defeats the server checking
      to see if the user has permission to view
      the dirent's attributes. Caching the data can cause performance
      impacts if the page cache hit rate is low..
      This document introduces a new file attribute called
      uncacheable which indicates that the client <bcp14>MUST NOT</bcp14>
      cache the metadata or data for that dirent.  This document extends NFSv4.2
      (see RFC7863).
    </t>
  </abstract>

  <note removeInRFC='true'>
    <t>
      Discussion of this draft takes place
      on the NFSv4 working group mailing list (nfsv4@ietf.org),
      which is archived at
      <eref target='https://mailarchive.ietf.org/arch/browse/nfsv4/'/>.
      Working Group information can be found at
      <eref target='https://datatracker.ietf.org/wg/nfsv4/about/'/>.
    </t>
  </note>
</front>

<middle>

<section anchor='sec_intro' numbered='true' removeInRFC='false' toc='default'>
  <name>Introduction</name>
  <t>
    In the Network File System version 4.2 (NFSv4.2) (see <xref target='RFC7863'
    format='default' sectionFormat='of'/>) , a client queries
    for either a file's or directory's attributes via either GETATTR
    (see Section 18.7 of <xref target='RFC8881'
    format='default' sectionFormat='of'/>)
    or READDIR (see Section 18.23 of <xref target='RFC8881'
    format='default' sectionFormat='of'/>) to the server. These directory
    entries (dirents) can be cached locally by the client.
  </t>

  <t>
    As these cached dirents are shared by all users on the clients and
    the client can not determine access to these dirents, all users
    are presented with the same set of attributes. We introduce the
    new uncacheable attribute, which informs the client not to cache
    a dirent for that file or directory object. As such each time the client
    queries for those attributes, the response can be
    tailored to that user. That decision can be based on either
    Access Control List (ACL) on a file or directory object (see Section 6
    of <xref target='RFC8881' format='default' sectionFormat='of'/>)
    or proprietary policies.
  </t>

  <t>
    Besides the caching of metadata for both files and directories, the
    client can also cache data for files. The uncacheable attribute also
    informs the client to avoid its page cache. It is very similar
    to passing the O_DIRECT to the open call. This can be useful
    for files that are not shared and also for ones which do not
    meet the expectations of the caching patterns of the page cache.
  </t>

  <t>
    Using the process detailed in <xref target='RFC8178' format='default'
    sectionFormat='of'/>, the revisions in this document become an
    extension of NFSv4.2 <xref target='RFC7862' format='default'
    sectionFormat='of'/>. They are built on top of the external data
    representation (XDR) <xref target='RFC4506' format='default'
    sectionFormat='of'/> generated from <xref target='RFC7863'
    format='default' sectionFormat='of'/>.
  </t>

  <section anchor='sec_defs' numbered='true' removeInRFC='false' toc='default'>
    <name>Definitions</name>
    <dl newline='false' spacing='normal'>
      <dt>Access Based Enumeration:</dt>
      <dd>
        When servicing either a READDIR or a GETATTR, base the
        result on the access permitted to the user making the request.
      </dd>
      <dt>dirent:</dt>
      <dd>
        A directory entry, describing either a directory or a file.
      </dd>
    </dl>
  </section>

  <section numbered='true' removeInRFC='false' toc='default'>
    <name>Requirements Language</name>
    <t>
      The key words '<bcp14>MUST</bcp14>', '<bcp14>MUST NOT</bcp14>',
      '<bcp14>REQUIRED</bcp14>', '<bcp14>SHALL</bcp14>', '<bcp14>SHALL
      NOT</bcp14>', '<bcp14>SHOULD</bcp14>', '<bcp14>SHOULD NOT</bcp14>',
      '<bcp14>RECOMMENDED</bcp14>', '<bcp14>NOT RECOMMENDED</bcp14>',
      '<bcp14>MAY</bcp14>', and '<bcp14>OPTIONAL</bcp14>' in this
      document are to be interpreted as described in BCP 14 <xref
      target='RFC2119' format='default' sectionFormat='of'/> <xref
      target='RFC8174' format='default' sectionFormat='of'/> when,
      and only when, they appear in all capitals, as shown here.
    </t>
  </section>
</section>

<section anchor='sec_dirents' numbered='true' removeInRFC='false' toc='default'>
  <name>Uncacheable Dirents</name>
  <t>
    If a file object or directory has the uncacheable attribute set, then the client
    <bcp14>MUST NOT</bcp14> cache their dirent attributes. I.e., just
    because it presented the attributes to user A on
    the first request, then on a subsequent request, it <bcp14>MUST</bcp14>
    query for those attributes again. Also, the client <bcp14>MUST NOT</bcp14>
    share attributes between different users.
  </t>
</section>

<section anchor='sec_files' numbered='true' removeInRFC='false' toc='default'>
  <name>Uncacheable Files</name>
  <t>
    If a file object is marked as uncacheable, that also means all modifications
    to the file <bcp14>MUST</bcp14> immediately be sent from the client
    to the server. I.e., the data is also not cacheable.
  </t>
</section>

<section anchor='ssec_uncacheable_attr' numbered='true' removeInRFC='false' toc='default'>
  <name>XDR for Offline Attribute</name>
  <sourcecode name='' type='' markers='true'><![CDATA[
///
/// typedef bool            fattr4_uncacheable;
///
/// const FATTR4_UNCACHEABLE            = 87;
///
]]>
  </sourcecode>
</section>

<section anchor='xdr_desc' numbered='true' removeInRFC='false' toc='default'>
  <name>Extraction of XDR</name>
  <t>
    This document contains the external data representation (XDR)
    <xref target='RFC4506' format='default' sectionFormat='of'/> description of the uncacheable
    attribute.
    The XDR description is embedded in this
    document in a way that makes it simple for the reader to extract
    into a ready-to-compile form.  The reader can feed this document
    into the following shell script to produce the machine readable
    XDR description of the new flags:
  </t>
  <sourcecode name='' type='' markers='true'><![CDATA[
#!/bin/sh
grep '^ *///' $* | sed 's?^ */// ??' | sed 's?^ *///$??'
    ]]>
  </sourcecode>
  <t>
    That is, if the above script is stored in a file called 'extract.sh', and
    this document is in a file called 'spec.txt', then the reader can do:
  </t>
  <sourcecode name='' type='' markers='true'><![CDATA[
sh extract.sh < spec.txt > uncacheable_prot.x
    ]]>
  </sourcecode>
  <t>
    The effect of the script is to remove leading white space from each
    line, plus a sentinel sequence of '///'.  XDR descriptions with the
    sentinel sequence are embedded throughout the document.
  </t>
  <t>
    Note that the XDR code contained in this document depends on types
    from the NFSv4.2 nfs4_prot.x file (generated from
    <xref target='RFC7863' format='default' sectionFormat='of'/>).
    This includes both nfs types that end with a 4, such as offset4,
    length4, etc., as well as more generic types such as uint32_t and
    uint64_t.
  </t>
  <t>
    While the XDR can be appended to that from
    <xref target='RFC7863' format='default' sectionFormat='of'/>,
    the various code snippets belong in their respective areas of
    that XDR.
  </t>
</section>

<section anchor='sec_security' numbered='true' removeInRFC='false' toc='default'>
  <name>Security Considerations</name>
  <t>
    Clients <bcp14>MUST NOT</bcp14> make access decisions to uncacheable dirents,
    these decisions <bcp14>MUST</bcp14> be made by the server. With the
    uncacheable attribute, dirents can be annotated such that attributes
    can be presented to the user based on the server's decision.
  </t>
</section>

<section anchor='sec_iana' numbered='true' removeInRFC='false' toc='default'>
  <name>IANA Considerations</name>
  <t>
    There are no IANA considerations.
  </t>
</section>

</middle>

<back>

<references>
  <name>References</name>

  <references>
  <name>Normative References</name>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml'/>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4506.xml'/>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7862.xml'/>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7863.xml'/>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml'/>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8178.xml'/>
    <xi:include xmlns:xi='http://www.w3.org/2001/XInclude'
       href='https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8881.xml'/>
  </references>
</references>

<section numbered='true' removeInRFC='false' toc='default'>
      <name>Acknowledgments</name>
      <t>
        Trond Myklebust and Thomas Haynes
        all worked on the prototype at Hammerspace.
      </t>
    </section>
</back>

</rfc>
