On Tue, 2019-06-18 at 23:24 -0700, Song Liu wrote: > index 8563339041f6..bab8d9eef46c 100644 > --- a/mm/truncate.c > +++ b/mm/truncate.c > @@ -790,7 +790,11 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages2); > void truncate_pagecache(struct inode *inode, loff_t newsize) > { > struct address_space *mapping = inode->i_mapping; > - loff_t holebegin = round_up(newsize, PAGE_SIZE); > + loff_t holebegin; > + > + /* if non-shmem file has thp, truncate the whole file */ > + if (filemap_nr_thps(mapping)) > + newsize = 0; > I don't get it. Sometimes truncate is used to increase the size of a file, or to change it to a non-zero size. Won't forcing the newsize to zero break applications, when the file is truncated to a different size than they expect?