On Fri, Dec 04, 2020 at 12:43:23PM +0900, Daeho Jeong wrote: > STEP_VERITY is enabled by f2fs_need_verity() and the function is like below. > We already know the second condition (idx < DIV_ROUND_UP...) is > satisfied when invoking f2fs_alloc_dic(). > > static inline bool f2fs_need_verity(const struct inode *inode, pgoff_t idx) > { > return fsverity_active(inode) && > idx < DIV_ROUND_UP(inode->i_size, PAGE_SIZE); > }
Are you sure? I thought that compression (and encryption) apply to the whole file, including any Merkle tree blocks past i_size. Also, even if you include the i_size check, it's still wrong to check fsverity_active() in the middle of the I/O because FS_IOC_ENABLE_VERITY can execute concurrently, causing fsverity_active() to return false at the beginning of the I/O and true later in the I/O. It needs to be checked only once, at the beginning... - Eric