<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.5.24 -->
<?rfc docmapping="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-rmacklem-nfsv4-new-attributes-01" category="std" consensus="true" tocInclude="true" sortRefs="true" symRefs="true" obsoletes="" updates="" submissionType="IETF" xml:lang="en" version="3">
  <!-- xml2rfc v2v3 conversion 3.12.0 -->
  <front>
    <title abbrev="New Attributes for NFSv4.2">New Attributes for Network File System Version 4, Minor Version 2</title>
    <seriesInfo name="Internet-Draft" value="draft-rmacklem-nfsv4-new-attributes-01"/>
    <author initials="R." surname="Macklem" fullname="Rick Macklem">
      <organization abbrev="FreeBSD">FreeBSD Project</organization>
      <address>
        <postal>
          <country>Canada</country>
        </postal>
        <email>rmacklem@uoguelph.ca</email>
      </address>
    </author>
    <date year="2022" month="January" day="15"/>
    <area>Transport</area>
    <workgroup>Network File System Version 4</workgroup>
<abstract>
<t>
This document proposes several new recommended attributes that
extend the Network File System Version 4, Minor Version 2 protocol (NFSv4.2).
All of these new attributes would be read-only, per file system attributes.
</t>
</abstract>

    <note>
      <name>Note</name>
      <t>This note is to be removed before publishing as an RFC.</t>
      <t>Discussion of this draft occurs on the <eref target="nfsv4@ietf.org">NFSv4 working group mailing
list</eref>, archived at
<eref target="https://mailarchive.ietf.org/arch/browse/nfsv4/"/>. Working Group
information is available at
<eref target="https://datatracker.ietf.org/wg/nfsv4/about/"/>.</t>
    </note>
</front>

<middle>

<section
 anchor="section_8F035331-8EB8-4FBC-973A-673FBA5FE952"
 numbered="true"
 removeInRFC="false"
 toc="default">
<name>Introduction</name>
<t>
Implementation experience with NFSv4.2
has identified that some additional attributes
providing per file system information to clients are useful.
This document identifies an important set of additional
recommended attributes.
</t>

</section>
      <section numbered="true" toc="include" removeInRFC="false">
<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"/> <xref target="RFC8174" format="default"/> when, and only when, they
appear in all capitals, as shown here.</t>

</section>
      <section numbered="true" toc="include" removeInRFC="false">
<name>Protocol Extension Considerations</name>
<t>
This document presents an extension to minor version 2 of the NFSv4
protocol as described in
<xref target="RFC8178" format="default" sectionFormat="of"/>.
It describes new OPTIONAL
features.
NFSv4.2 servers and clients implemented without knowledge
of this extension will continue to interoperate with clients and
servers that are aware of the extension (whether or not they support
it).
</t>
<t>
Note that
<xref target="RFC7862" format="default" sectionFormat="of"/>
does not define NFSv4.2 as non-extensible, so
<xref target="RFC8178" format="default" sectionFormat="of"/>
treats it as an extensible minor version.
This Standards
Track RFC extends NFSv4.2 but does not update
<xref target="RFC7862" format="default" sectionFormat="of"/>
or
<xref target="RFC8178" format="default" sectionFormat="of"/>.
</t>
</section>

      <section anchor="new_attributes" numbered="true" toc="include" removeInRFC="false">
        <name slugifiedName="name-new-attributes-list-an"><bcp14>OPTIONAL</bcp14> New Attributes - List and Definition References</name>
        <t>
     The list of New <bcp14>OPTIONAL</bcp14> attributes appears in <xref target="new_attr_table" format="default" sectionFormat="of" derivedContent="Table 1"/>.
     The meaning of the columns of the table are:
        </t>
        <dl spacing="normal" newline="false">
          <dt>Name:</dt>
          <dd>The name of the attribute.</dd>
          <dt>Id:</dt>
          <dd>The number assigned to the attribute.</dd>
          <dt>Data Type:</dt>
          <dd>The XDR data type of the attribute.</dd>
          <dt>Acc:</dt>
          <dd>Access allowed to the attribute. R means
        read-only.</dd>
          <dt>Defined in:</dt>
          <dd>The section of this specification that describes the
        attribute.</dd>
        </dl>
        <table anchor="new_attr_table" align="center" pn="table-1">
          <thead>
            <tr>
              <th align="left" colspan="1" rowspan="1">Name</th>
              <th align="left" colspan="1" rowspan="1">Id</th>
              <th align="left" colspan="1" rowspan="1">Data Type</th>
              <th align="left" colspan="1" rowspan="1">Acc</th>
              <th align="left" colspan="1" rowspan="1">Defined in:</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left" colspan="1" rowspan="1">supported_ops</td>
              <td align="left" colspan="1" rowspan="1">83</td>
              <td align="left" colspan="1" rowspan="1">bitmap4</td>
              <td align="left" colspan="1" rowspan="1">R</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_supported_ops" format="default" sectionFormat="of"/>
              </td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">dir_cookie_rising</td>
              <td align="left" colspan="1" rowspan="1">84</td>
              <td align="left" colspan="1" rowspan="1">bool</td>
              <td align="left" colspan="1" rowspan="1">R</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_dir_cookie_rising" format="default" sectionFormat="of"/>
              </td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">seek_granularity</td>
              <td align="left" colspan="1" rowspan="1">85</td>
              <td align="left" colspan="1" rowspan="1">uint64_t</td>
              <td align="left" colspan="1" rowspan="1">R</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_seek_granularity" format="default" sectionFormat="of"/>
              </td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">mandatory_br_locks</td>
              <td align="left" colspan="1" rowspan="1">86</td>
              <td align="left" colspan="1" rowspan="1">bool</td>
              <td align="left" colspan="1" rowspan="1">R</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_mandatory_br_locks" format="default" sectionFormat="of"/>
              </td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">max_xattr_len</td>
              <td align="left" colspan="1" rowspan="1">87</td>
              <td align="left" colspan="1" rowspan="1">uint64_t</td>
              <td align="left" colspan="1" rowspan="1">R</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="attrdef_max_xattr_len" format="default" sectionFormat="of"/>
              </td>
            </tr>
          </tbody>
        </table>
      <section numbered="true" toc="include" removeInRFC="false">
	<name>Definitions of new recommended attributes</name>
      <section anchor="attrdef_supported_ops" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-83-supported-ops">Attribute 83: supported_ops</name>
            <t>
	This bit vector indicates which operations are supported
	for objects (of the appropriate type) with an fsid matching
	that of the specified object.
            </t>
          <t>
	The bit vector is a counted array of 32-bit integers used to contain bit
	values.  The position of the integer in the array that contains
	the bit corresponding to operation n
	can be computed from the expression (n / 32), and its bit within that
	integer is (n mod 32), where n is the operation number.
          </t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	Without this attribute, an NFSv4.2 client must attempt an
	optional operation to determine if the server supports it.
	This attribute allows the NFSv4.2 client to avoid attempting an
	optional operation when it is not supported for the file
	object's file system on the server.
            </t>
	    <t>
	This attribute is likely to be particularly helpful in dealing
	with OPTIONAL attributes whose support is likely to be different
	for different file systems.
	    </t>
	   </section>
          </section>
      <section anchor="attrdef_dir_cookie_rising" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-84-dir-cookie-rising">Attribute 84: dir_cookie_rising</name>
            <t>
	TRUE, if performing the READDIR operation on directories
	with a matching fsid always returns monotonically increasing
	directory offset cookies.
	This includes, if named attributes are supported, directories
	returned by OPENATTR.
            </t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	If the NFSv4.2 client knows that directory offset cookies in
	READDIR replies are monotonically increasing, it might make
	it feasible to implement client side support for directory
	delegation.
	As an example, implementing client side directory delegation
	support is much easier when the directory offset cookies
	are monotonically increasing, so they can be used to order
	directory entries.
	Further, the client needs to know that the directory offset
	cookies are monotonically increasing before reading a directory,
	so that acquisition and use of a directory delegation may be
	done.
	Client side directory caching may also benefit from
	monotonically increasing directory offset cookies.
	For example, the Linux NFSv4.2 client uses a different
	caching algorithm when directory offset cookies are
	monotonically increasing.
            </t>
	  </section>
          </section>
      <section anchor="attrdef_seek_granularity" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-85-seek-granularity">Attribute 85: seek_granularity</name>
            <t>
	This attribute indicates the granularity of unallocated regions for
	data objects with an fsid matching that of the specified object.
	Data objects include regular files and, when
	named attributes are supported, named attributes.
            </t>
            <t>
	0, if the SEEK operation will not return unallocated regions (holes).
	    </t>
	    <t>
	1, if the SEEK operation will return unallocated regions (holes),
	but of no fixed granularity
	    </t>
	    <t>
	> 1, if the SEEK operation will return unallocated regions (holes),
	which are an exact multiple of this attribute in length.
	    </t>
	    <t>
	If this attribute is supported for a file system that does not
	support the SEEK operation, a value of 0 MUST be returned.
	    </t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	A NFSv4.2 client can avoid performing RPCs doing the SEEK
	operation when this attribute is equal 0 or whenever the
	client can determine that holes greater or equal to the
	value of this attribute do not exist in the file.
            </t>
	  </section>
          </section>
      <section anchor="attrdef_mandatory_br_locks" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-86-mandatory-br-locks">Attribute 86: mandatory_br_locks</name>
            <t>
	TRUE, if byte range locks obtained on data objects with an fsid
	matching that of the specified object have mandatory semantics
	potentially affecting IO operations done on overlapping areas.
	Data objects include regular files and, when named attributes
	are supported, named attributes.
            </t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	Applications that work with advisory byte range locks will
	fail with mandatory byte range locks and vice versa.
	Given that both forms are allowed yet incompatible,
	it is necessary to provide a way, other than trial-and-error,
	to determine which form is supported.
            </t>
	    <t>
	Further, if a client is doing read/write caching of data blocks
	using a write back caching policy, the caching requires locking
	if mandatory byte range locking is being enforced by the server.
	For this case, the client needs to acquire an exclusive byte range
	lock for each byte range being cached.
	If it does not do so, a write-back may fail, due to a conflicting
	lock having been acquired by a different client.
	Therefore, a client doing this kind of data block caching needs
	to know if the server is implementing mandatory byte range locking.
	    </t>
	  </section>
          </section>
      <section anchor="attrdef_max_xattr_len" numbered="true" toc="include" removeInRFC="false">
            <name slugifiedName="name-attribute-87-max-xattr-len">Attribute 87: max_xattr_len</name>
            <t>
	The maximum length, in bytes, of the extended attribute that can be
	set by the SETXATTR operation for file system objects with an fsid
	matching that of the specified object. The SETXATTR operation is
	described in the
	<xref target="RFC8276" format="default" sectionFormat="of"/>
	extension to NFSv4.2.
            </t>
	    <t>
	If this attribute is supported for a file system that does not
	support the SETXATTR operation, a value of 0 MUST be returned.
	    </t>
      <section numbered="true" removeInRFC="false">
	<name>Rationale</name>
            <t>
	This attribute allows a NFSv4.2 client to avoid attempting
	a SETXATTR operation when the length of the extended attribute is
	greater than the maximum specified by this attribute.
            </t>
	  </section>
          </section>
	</section>
</section>

<section
 anchor="section_88BBA4D6-ED42-4FE6-A208-9D277B68729A"
 numbered="true"
 removeInRFC="true"
 toc="default">
<name>Implementation Status</name>
<t>
This section records the status of known implementations of the
protocol defined by this specification at the time of posting of
this Internet-Draft.
The description of implementations in this section is
intended to assist the IETF in its decision processes in
progressing drafts to RFCs.
</t>
<t>
Please note that the listing of any individual implementation here
does not imply endorsement by the IETF.
Furthermore, no effort has been spent to verify the information
presented here that was supplied by IETF contributors.
This is not intended as, and must not be construed to be, a
catalog of available implementations or their features.
Readers are advised to note that other implementations may exist.
</t>

<section
 anchor="section_86689813-E907-4046-ADF1-58E2BF668546"
 numbered="true"
 removeInRFC="false"
 toc="default">
<name>FreeBSD NFS server and client</name>
<dl newline="false" spacing="normal" indent="11">
<dt>Organization:</dt>
<dd>
FreeBSD Project
</dd>
<dt>URL:</dt>
<dd>
<eref target="https://www.freebsd.org"/>
</dd>
<dt>Maturity:</dt>
<dd>
Prototype software based on the current document.
</dd>
<dt>Coverage:</dt>
<dd>
The bulk of this specification is implemented.
</dd>
<dt>Licensing:</dt>
<dd>
BSD
</dd>
<dt>Implementation experience:</dt>
<dd>
The implementation of these attributes have allowed the
NFSv4.2 client to avoid unnecessary RPCs against the server.
The current client implementation does not include support
for directory delegations nor makes use of the
dir_cookie_rising
attribute.
The current client implementation does not support
mandatory byte range locking.
</dd>
</dl>
</section>

</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.7862.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.8276.xml"/>
</references>

<references>
<name>Informational References</name>

<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="false" anchor="acknowledgments" toc="default">
      <name>Acknowledgments</name>
	<t>
	Thanks go to David Noveck for his suggestions for improving
	the draft.
	</t>
     </section>

</back>

</rfc>
