summaryrefslogtreecommitdiff
path: root/include/linux/exportfs.h
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.com>2026-04-16 21:01:18 +0200
committerJiri Kosina <jkosina@suse.com>2026-04-16 21:01:18 +0200
commitd4eb7b2da66c848709e31585b9c371fa234abc39 (patch)
tree5c6311cfa45567ecdcb8946a2252da7d55d1ac10 /include/linux/exportfs.h
parent8b9a097eb2fc37b486afd81388c693bf3ab44466 (diff)
parent69c02ffde6ed4d535fa4e693a9e572729cad3d0d (diff)
Merge branch 'for-7.1/core-v2' into for-linus
- fixed handling of 0-sized reports (Dmitry Torokhov) - convert core code to __free() (Dmitry Torokhov) - support for multiple batteries per HID device (Lucas Zampieri)
Diffstat (limited to 'include/linux/exportfs.h')
-rw-r--r--include/linux/exportfs.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 262e24d83313..8bcdba28b406 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -200,6 +200,10 @@ 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 and the definition of the flags.
*
@@ -244,10 +248,14 @@ struct handle_to_path_ctx {
* space cannot be allocated, a %ERR_PTR should be returned.
*
* @permission:
- * Allow filesystems to specify a custom permission function.
+ * 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.
+ * 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 should commit metadata changes to stable storage.
@@ -330,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)
{