Skip to contentSkip to conversation

ovl: do not allow nfs_export with data-only layers

PATCH New Amir Goldstein 1 participant 1 message Nov 9

Subsystems (2)
lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 ovl: do not allow nfs_export with data-only layers

Since data-only layers no longer require metacopy=on, which conflicts with nfs_export=on, an overlay with data-only layers can be mounted with nfs_export=on.

Decoding a file handle of a lower metacopy file whose data is in a data-only layer builds the inode only from the decoded lower dentry, without the lazy lowerdata redirect, so the data of the file would be read from the metacopy file in the lower layer.

Fail the mount with explicit nfs_export=on and data-only layers and otherwise disable nfs_export with data-only layers.

Fixes 5ef7bcdeecc9 ("ovl: relax redirect/metacopy requirements for lower -> data redirect")
---
 fs/overlayfs/params.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
fs/overlayfs/params.c +10 -0
index ad7f30177ef4c..7a4e1be5225fa 100644
@@ -931,6 +931,16 @@ int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
 		}
 	}
 
+	/* Resolve nfs_export -> !data-only layers dependency */
+	if (config->nfs_export && ctx->nr_data) {
+		if (set.nfs_export) {
+			pr_err("NFS export is not supported with data-only layers\n");
+			return -EINVAL;
+		}
+		pr_info("disabling nfs_export due to data-only layers\n");
+		config->nfs_export = false;
+	}
+
 	/* Resolve nfs_export -> index dependency */
 	if (config->nfs_export && !config->index) {
 		if (!config->upperdir &&
Signature · 1 line
2.56.0