@@ -67,6 +67,8 @@ config OVERLAY_FS_VERIFY
The verify feature prevents multiple redirects to the same lower dir
and prevents broken hardlinks from using the same inode number.
+ The verify feature is required for exporting an overlay filesystem
+ subtree as an NFS share.
Note, that verify feature is not backward compatible. That is,
mounting an overlay with verification index entries on a kernel
@@ -1316,6 +1316,14 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
ofs->config.verify = false;
}
+ /*
+ * NFS export requires that all layers support file handles and that
+ * all files and dirs are indexed on copy up (verify=on). We already
+ * check that all layers support file handles for enabling index.
+ */
+ if (ofs->config.verify)
+ sb->s_export_op = &ovl_export_operations;
+
/* Never override disk quota limits or use reserved space */
cap_lower(cred->cap_effective, CAP_SYS_RESOURCE);
Enable NFS export support if the "verify" feature is enabled. Signed-off-by: Amir Goldstein <amir73il@gmail.com> --- fs/overlayfs/Kconfig | 2 ++ fs/overlayfs/super.c | 8 ++++++++ 2 files changed, 10 insertions(+)