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



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to