summaryrefslogtreecommitdiff
path: root/include/linux/exportfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/exportfs.h')
-rw-r--r--include/linux/exportfs.h54
1 files changed, 42 insertions, 12 deletions
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index f0cf2714ec52..8bcdba28b406 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -200,10 +200,14 @@ struct handle_to_path_ctx {
* @get_parent: find the parent of a given directory
* @commit_metadata: commit metadata changes to stable storage
*
+ * Methods for open_by_handle(2) syscall with special kernel file systems:
+ * @permission: custom permission for opening a file by handle
+ * @open: custom open routine for opening file by handle
+ *
* See Documentation/filesystems/nfs/exporting.rst for details on how to use
- * this interface correctly.
+ * this interface correctly and the definition of the flags.
*
- * encode_fh:
+ * @encode_fh:
* @encode_fh should store in the file handle fragment @fh (using at most
* @max_len bytes) information that can be used by @decode_fh to recover the
* file referred to by the &struct dentry @de. If @flag has CONNECTABLE bit
@@ -215,7 +219,7 @@ struct handle_to_path_ctx {
* greater than @max_len*4 bytes). On error @max_len contains the minimum
* size(in 4 byte unit) needed to encode the file handle.
*
- * fh_to_dentry:
+ * @fh_to_dentry:
* @fh_to_dentry is given a &struct super_block (@sb) and a file handle
* fragment (@fh, @fh_len). It should return a &struct dentry which refers
* to the same file that the file handle fragment refers to. If it cannot,
@@ -227,31 +231,48 @@ struct handle_to_path_ctx {
* created with d_alloc_root. The caller can then find any other extant
* dentries by following the d_alias links.
*
- * fh_to_parent:
+ * @fh_to_parent:
* Same as @fh_to_dentry, except that it returns a pointer to the parent
* dentry if it was encoded into the filehandle fragment by @encode_fh.
*
- * get_name:
+ * @get_name:
* @get_name should find a name for the given @child in the given @parent
* directory. The name should be stored in the @name (with the
- * understanding that it is already pointing to a %NAME_MAX+1 sized
+ * understanding that it is already pointing to a %NAME_MAX + 1 sized
* buffer. get_name() should return %0 on success, a negative error code
* or error. @get_name will be called without @parent->i_rwsem held.
*
- * get_parent:
+ * @get_parent:
* @get_parent should find the parent directory for the given @child which
* is also a directory. In the event that it cannot be found, or storage
* space cannot be allocated, a %ERR_PTR should be returned.
*
- * permission:
- * Allow filesystems to specify a custom permission function.
+ * @permission:
+ * Allow filesystems to specify a custom permission function for the
+ * open_by_handle_at(2) syscall instead of the default permission check.
+ * This custom permission function is not respected by nfsd.
*
- * open:
- * Allow filesystems to specify a custom open function.
+ * @open:
+ * Allow filesystems to specify a custom open function for the
+ * open_by_handle_at(2) syscall instead of the default file_open_root().
+ * This custom open function is not respected by nfsd.
*
- * commit_metadata:
+ * @commit_metadata:
* @commit_metadata should commit metadata changes to stable storage.
*
+ * @get_uuid:
+ * Get a filesystem unique signature exposed to clients.
+ *
+ * @map_blocks:
+ * Map and, if necessary, allocate blocks for a layout.
+ *
+ * @commit_blocks:
+ * Commit blocks in a layout once the client is done with them.
+ *
+ * @flags:
+ * Allows the filesystem to communicate to nfsd that it may want to do things
+ * differently when dealing with it.
+ *
* Locking rules:
* get_parent is called with child->d_inode->i_rwsem down
* get_name is not (which is possibly inconsistent)
@@ -317,6 +338,15 @@ static inline bool exportfs_can_decode_fh(const struct export_operations *nop)
return nop && nop->fh_to_dentry;
}
+static inline bool exportfs_may_export(const struct export_operations *nop)
+{
+ /*
+ * Do not allow nfs export for filesystems with custom ->open() or
+ * ->permission() ops, which nfsd does not respect (e.g. pidfs, nsfs).
+ */
+ return exportfs_can_decode_fh(nop) && !nop->open && !nop->permission;
+}
+
static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
int fh_flags)
{