libfuse/doc/README.NFS
Bernd Schubert e2df577a7c
Add more documentation for FUSE_CAP_EXPORT_SUPPORT (#917)
Add more documentation for FUSE_CAP_EXPORT_SUPPORT

Also remove the flag from passthrough_ll.c and passthrough_hp.cc
as these implementations do _not_ handle that flag. They just
cast fuse_ino_t to an inode and cause a heap buffer overflow
for unknown objects (simplest reproducer are the examples
in "man 2 open_by_handle_at", but to unmount/mount the file
system after name_to_handle_at and before open_by_handle_at).

Fixes https://github.com/libfuse/libfuse/issues/838

---------

Co-authored-by: Nikolaus Rath <Nikolaus@rath.org>
2024-04-02 23:52:18 +02:00

45 lines
2.1 KiB
Plaintext

NFS exporting is supported in Linux kernels 2.6.27 or later.
You need to add an fsid=NNN option to /etc/exports to make exporting a
FUSE directory work.
Filesystem support
------------------
NFS exporting works to some extent on all fuse filesystems, but not
perfectly. This is due to the stateless nature of the protocol, the
server has no way of knowing whether the client is keeping a reference
to a file or not, and hence that file may be removed from the server's
cache. In that case there has to be a way to look up that object
using the inode number, otherwise an ESTALE error will be returned.
1) low-level interface
Filesystems need to set FUSE_CAP_EXPORT_SUPPORT in conn->wants and
implement special lookups for the names "." and "..". The former may
be requested on any inode, including non-directories, while the latter
is only requested for directories. Otherwise these special lookups
should behave identically to ordinary lookups.
Furthermore, setting FUSE_CAP_EXPORT_SUPPORT requires the file system
to handle node-ids (fuse_ino_t) that the file system may does not know
about - e.g. a fuse FORGET request might have been received or the node-id
was used in a previous instance of the file system daemon. The node-id might
not be valid at all when an invalid handle is passed to open_by_handle_at().
This implies that the filesystem *must not* reuse node-ids even if
generation numbers are set correctly. This is because generation numbers
are not provided by the kernel to e.g. the getattr() handler, so the
handler would be unable to tell if the provided node-id refers to the
"known" current one, or a previous one that has been forgotten and re-used.
2) high-level interface
Because the high-level interface is path based, it is not possible to
delegate looking up by inode to the filesystem.
To work around this, currently a "noforget" option is provided, which
makes the library remember nodes forever. This will make the NFS
server happy, but also results in an ever growing memory footprint for
the filesystem. For this reason if the filesystem is large (or the
memory is small), then this option is not recommended.