[[email protected]: [PATCH v7 03/22] ovl: use core fsverity ensure info interface]

Andrey Albershteyn <[email protected]>
Newsgroups org.kernel.vger.linux-unionfs
Message-ID <wtbfe3tb3uk6oeitkqodcal63p7pj6xjqwujzlzglina7o7imr@4sv25le6djgg>
Forgot to add overlayfs as a receiver, this is overlayfs relevant
patch in the patchset adding fsverity support for XFS [1].

The patchset exposes fsverity_ensure_verity_info() [2] which could be
used instead.

1: https://lore.kernel.org/linux-fsdevel/[email protected]/T/#t
2: https://lore.kernel.org/linux-fsdevel/[email protected]/T/#m6baa3210a16a2f54ce977353da7532a93f1aef65

----- Forwarded message from Andrey Albershteyn <[email protected]> -----

Subject: [PATCH v7 03/22] ovl: use core fsverity ensure info interface
From: Andrey Albershteyn <[email protected]>
Date: Thu,  9 Apr 2026 15:13:35 +0200
To: [email protected], [email protected],
  [email protected], [email protected]
Cc: Andrey Albershteyn <[email protected]>, [email protected],
  [email protected], [email protected],
  [email protected], [email protected]
Message-ID: <[email protected]>
In-Reply-To: <[email protected]>

fsverity now exposes fsverity_ensure_verity_info() which could be used
instead of opening file to ensure that fsverity info is loaded and
attached to inode.

Signed-off-by: Andrey Albershteyn <[email protected]>
---
 fs/overlayfs/util.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 2ea769f311c3..8bde5dc31d7d 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -16,6 +16,7 @@
 #include <linux/namei.h>
 #include <linux/ratelimit.h>
 #include <linux/overflow.h>
+#include <linux/fsverity.h>
 #include "overlayfs.h"
 
 /* Get write access to upper mnt - may fail if upper sb was remounted ro */
@@ -1377,18 +1378,9 @@ char *ovl_get_redirect_xattr(struct ovl_fs *ofs, const struct path *path, int pa
 int ovl_ensure_verity_loaded(const struct path *datapath)
 {
 	struct inode *inode = d_inode(datapath->dentry);
-	struct file *filp;
 
-	if (!fsverity_active(inode) && IS_VERITY(inode)) {
-		/*
-		 * If this inode was not yet opened, the verity info hasn't been
-		 * loaded yet, so we need to do that here to force it into memory.
-		 */
-		filp = kernel_file_open(datapath, O_RDONLY, current_cred());
-		if (IS_ERR(filp))
-			return PTR_ERR(filp);
-		fput(filp);
-	}
+	if (fsverity_active(inode))
+		fsverity_ensure_verity_info(inode);
 
 	return 0;
 }
-- 
2.51.2



----- End forwarded message -----

-- 
- Andrey
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.