diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 55ab99131a720a93da68e6711ba41fae713d6219..7cb930e367beaee8ac90483c42b7d0de93b0d955 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -473,6 +473,10 @@ bool ovl_need_index(struct dentry *dentry)
 	if (!lower || !ovl_indexdir(dentry->d_sb))
 		return false;
 
+	/* Index all files for NFS export and consistency verification */
+	if (!d_is_dir(lower) && ovl_index_all(dentry->d_sb))
+		return true;
+
 	/* Index only lower hardlinks on copy up */
 	if (!d_is_dir(lower) && d_inode(lower)->i_nlink > 1)
 		return true;