<!DOCTYPE html>
<html lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Reexporting NFS filesystems — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../_static/alabaster.css?v=3918102e" />
<script src="../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="NTFS3" href="../ntfs3.html" />
<link rel="prev" title="Kernel NFS Server Statistics" href="knfsd-stats.html" />
<link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../subsystem-apis.html#storage-interfaces">Storage interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../index.html">Filesystems in the Linux kernel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../block/index.html">Block</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../cdrom/index.html">CD-ROM</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../scsi/index.html">SCSI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../target/index.html">TCM Virtual Device</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../nvme/index.html">NVMe Subsystem</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/filesystems/nfs/reexport.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="reexporting-nfs-filesystems">
<h1>Reexporting NFS filesystems<a class="headerlink" href="#reexporting-nfs-filesystems" title="Link to this heading">¶</a></h1>
<section id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Link to this heading">¶</a></h2>
<p>It is possible to reexport an NFS filesystem over NFS. However, this
feature comes with a number of limitations. Before trying it, we
recommend some careful research to determine whether it will work for
your purposes.</p>
<p>A discussion of current known limitations follows.</p>
</section>
<section id="fsid-required-crossmnt-broken">
<h2>“fsid=” required, crossmnt broken<a class="headerlink" href="#fsid-required-crossmnt-broken" title="Link to this heading">¶</a></h2>
<p>We require the “fsid=” export option on any reexport of an NFS
filesystem. You can use “uuidgen -r” to generate a unique argument.</p>
<p>The “crossmnt” export does not propagate “fsid=”, so it will not allow
traversing into further nfs filesystems; if you wish to export nfs
filesystems mounted under the exported filesystem, you’ll need to export
them explicitly, assigning each its own unique “fsid= option.</p>
</section>
<section id="reboot-recovery">
<h2>Reboot recovery<a class="headerlink" href="#reboot-recovery" title="Link to this heading">¶</a></h2>
<p>The NFS protocol’s normal reboot recovery mechanisms don’t work for the
case when the reexport server reboots because the source server has not
rebooted, and so it is not in grace. Since the source server is not in
grace, it cannot offer any guarantees that the file won’t have been
changed between the locks getting lost and any attempt to recover them.
The same applies to delegations and any associated locks. Clients are
not allowed to get file locks or delegations from a reexport server, any
attempts will fail with operation not supported.</p>
</section>
<section id="filehandle-limits">
<h2>Filehandle limits<a class="headerlink" href="#filehandle-limits" title="Link to this heading">¶</a></h2>
<p>If the original server uses an X byte filehandle for a given object, the
reexport server’s filehandle for the reexported object will be X+22
bytes, rounded up to the nearest multiple of four bytes.</p>
<p>The result must fit into the RFC-mandated filehandle size limits:</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>NFSv2</p></td>
<td><p>32 bytes</p></td>
</tr>
<tr class="row-even"><td><p>NFSv3</p></td>
<td><p>64 bytes</p></td>
</tr>
<tr class="row-odd"><td><p>NFSv4</p></td>
<td><p>128 bytes</p></td>
</tr>
</tbody>
</table>
<p>So, for example, you will only be able to reexport a filesystem over
NFSv2 if the original server gives you filehandles that fit in 10
bytes--which is unlikely.</p>
<p>In general there’s no way to know the maximum filehandle size given out
by an NFS server without asking the server vendor.</p>
<p>But the following table gives a few examples. The first column is the
typical length of the filehandle from a Linux server exporting the given
filesystem, the second is the length after that nfs export is reexported
by another Linux host:</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"></th>
<th class="head"><p>filehandle length</p></th>
<th class="head"><p>after reexport</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>ext4:</p></td>
<td><p>28 bytes</p></td>
<td><p>52 bytes</p></td>
</tr>
<tr class="row-odd"><td><p>xfs:</p></td>
<td><p>32 bytes</p></td>
<td><p>56 bytes</p></td>
</tr>
<tr class="row-even"><td><p>btrfs:</p></td>
<td><p>40 bytes</p></td>
<td><p>64 bytes</p></td>
</tr>
</tbody>
</table>
<p>All will therefore fit in an NFSv3 or NFSv4 filehandle after reexport,
but none are reexportable over NFSv2.</p>
<p>Linux server filehandles are a bit more complicated than this, though;
for example:</p>
<blockquote>
<div><ul class="simple">
<li><p>The (non-default) “subtreecheck” export option generally
requires another 4 to 8 bytes in the filehandle.</p></li>
<li><p>If you export a subdirectory of a filesystem (instead of
exporting the filesystem root), that also usually adds 4 to 8
bytes.</p></li>
<li><p>If you export over NFSv2, knfsd usually uses a shorter
filesystem identifier that saves 8 bytes.</p></li>
<li><p>The root directory of an export uses a filehandle that is
shorter.</p></li>
</ul>
</div></blockquote>
<p>As you can see, the 128-byte NFSv4 filehandle is large enough that
you’re unlikely to have trouble using NFSv4 to reexport any filesystem
exported from a Linux server. In general, if the original server is
something that also supports NFSv3, you’re <em>probably</em> OK. Re-exporting
over NFSv3 may be dicier, and reexporting over NFSv2 will probably
never work.</p>
<p>For more details of Linux filehandle structure, the best reference is
the source code and comments; see in particular:</p>
<blockquote>
<div><ul class="simple">
<li><p>include/linux/exportfs.h:<code class="xref c c-enum broken_xref docutils literal notranslate"><span class="pre">enum</span> <span class="pre">fid_type</span></code></p></li>
<li><p>include/uapi/linux/nfsd/nfsfh.h:<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">nfs_fhbase_new</span></code></p></li>
<li><p>fs/nfsd/nfsfh.c:set_version_and_fsid_type</p></li>
<li><p>fs/nfs/export.c:nfs_encode_fh</p></li>
</ul>
</div></blockquote>
</section>
<section id="open-deny-bits-ignored">
<h2>Open DENY bits ignored<a class="headerlink" href="#open-deny-bits-ignored" title="Link to this heading">¶</a></h2>
<p>NFS since NFSv4 supports ALLOW and DENY bits taken from Windows, which
allow you, for example, to open a file in a mode which forbids other
read opens or write opens. The Linux client doesn’t use them, and the
server’s support has always been incomplete: they are enforced only
against other NFS users, not against processes accessing the exported
filesystem locally. A reexport server will also not pass them along to
the original server, so they will not be enforced between clients of
different reexport servers.</p>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../../_sources/filesystems/nfs/reexport.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>