On Wed, Feb 24, 2021 at 03:02:52PM -0800, Eric Biggers wrote: > Hi Yunlei, > > On Wed, Feb 24, 2021 at 09:16:24PM +0800, Chao Yu wrote: > > 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 <heyunlei@xxxxxxxxxxx> > > > --- > > > 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); > > > > > This looks good; thanks for finding this. You can add: > > Reviewed-by: Eric Biggers <ebiggers@xxxxxxxxxx> > > I thought that f2fs_truncate() would truncate pagecache pages too, but in fact > that's not the case. > > ext4_end_enable_verity() has the same bug too. Can you please send a patch for > that too (to linux-ext4)? > Also please include the following tags in the f2fs patch: Fixes: 95ae251fe828 ("f2fs: add fs-verity support") Cc: <stable@xxxxxxxxxxxxxxx> # v5.4+ and in the ext4 patch: Fixes: c93d8f885809 ("ext4: add basic fs-verity support") Cc: <stable@xxxxxxxxxxxxxxx> # v5.4+ - Eric
![]() |