Hi Yunlei,

On 2021/2/23 19:24, heyunlei wrote:
If file enable verity failed, should truncate anything wrote
past i_size, including cache pages.

+Cc Eric,

After failure of enabling verity, we will see verity metadata if we truncate file to larger size later?

Thanks,


Signed-off-by: heyunlei <[email protected]>
---
  fs/f2fs/verity.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
index 054ec852b5ea..f1f9b9361a71 100644
--- a/fs/f2fs/verity.c
+++ b/fs/f2fs/verity.c
@@ -170,8 +170,10 @@ static int f2fs_end_enable_verity(struct file *filp, const 
void *desc,
        }
/* If we failed, truncate anything we wrote past i_size. */
-       if (desc == NULL || err)
+       if (desc == NULL || err) {
+               truncate_inode_pages(inode->i_mapping, inode->i_size);
                f2fs_truncate(inode);
+       }
clear_inode_flag(inode, FI_VERITY_IN_PROGRESS);


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

Reply via email to