On Fri, Mar 05, 2021 at 09:37:26AM +0800, Chao Yu wrote:
+cleanup:
- /*
* Verity failed to be enabled, so clean up by truncating any verity
* metadata that was written beyond i_size (both from cache and from
* disk) and clearing FI_VERITY_IN_PROGRESS.
*/
- truncate_inode_pages(inode->i_mapping, inode->i_size);
- f2fs_truncate(inode);
Eric,
Truncation can fail due to a lot of reasons, if we fail in f2fs_truncate(), do we need to at least print a message here? or it allows to keep those meta/data silently.
I suppose we might as well, although hopefully there will already be a message for the underlying failure reason too. Also, f2fs_file_write_iter() has the same issue too, right?
One other concern is that how do you think of covering truncate_inode_pages & f2fs_truncate with F2FS_I(inode)->i_gc_rwsem[WRITE] lock to avoid racing with GC, so that page cache won't be revalidated after truncate_inode_pages().
Yes, that does seem to be needed, due to the way the f2fs garbage collection works.
- Eric