[PATCH 16/29] ovl: add EXPORT_OP_STABLE_HANDLES flag to export operations

Jeff Layton posted 29 patches 3 weeks, 3 days ago
There is a newer version of this series
[PATCH 16/29] ovl: add EXPORT_OP_STABLE_HANDLES flag to export operations
Posted by Jeff Layton 3 weeks, 3 days ago
Add the EXPORT_OP_STABLE_HANDLES flag to overlayfs export operations to indicate
that this filesystem can be exported via NFS.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/overlayfs/export.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
index 83f80fdb156749e65a4ea0ab708cbff338dacdad..17c92a228120e1803135cc2b4fe4180f5e343f88 100644
--- a/fs/overlayfs/export.c
+++ b/fs/overlayfs/export.c
@@ -865,9 +865,11 @@ const struct export_operations ovl_export_operations = {
 	.fh_to_parent	= ovl_fh_to_parent,
 	.get_name	= ovl_get_name,
 	.get_parent	= ovl_get_parent,
+	.flags		= EXPORT_OP_STABLE_HANDLES,
 };
 
 /* encode_fh() encodes non-decodable file handles with nfs_export=off */
 const struct export_operations ovl_export_fid_operations = {
 	.encode_fh	= ovl_encode_fh,
+	.flags		= EXPORT_OP_STABLE_HANDLES,
 };

-- 
2.52.0
Re: [PATCH 16/29] ovl: add EXPORT_OP_STABLE_HANDLES flag to export operations
Posted by Amir Goldstein 3 weeks, 3 days ago
On Thu, Jan 15, 2026 at 6:49 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> Add the EXPORT_OP_STABLE_HANDLES flag to overlayfs export operations to indicate
> that this filesystem can be exported via NFS.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/overlayfs/export.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
> index 83f80fdb156749e65a4ea0ab708cbff338dacdad..17c92a228120e1803135cc2b4fe4180f5e343f88 100644
> --- a/fs/overlayfs/export.c
> +++ b/fs/overlayfs/export.c
> @@ -865,9 +865,11 @@ const struct export_operations ovl_export_operations = {
>         .fh_to_parent   = ovl_fh_to_parent,
>         .get_name       = ovl_get_name,
>         .get_parent     = ovl_get_parent,
> +       .flags          = EXPORT_OP_STABLE_HANDLES,
>  };
>
>  /* encode_fh() encodes non-decodable file handles with nfs_export=off */
>  const struct export_operations ovl_export_fid_operations = {
>         .encode_fh      = ovl_encode_fh,
> +       .flags          = EXPORT_OP_STABLE_HANDLES,
>  };
>

Actually, see comment above:
/* encode_fh() encodes non-decodable file handles with nfs_export=off */

That's the variant of export_ops when overlayfs cannot be nfs exported
because its encoded file handles can change after copyup+reboot.

Thanks,
Amir.