Nick Piggin wrote: > Andrew Morton wrote: > >> Nick Piggin wrote: > > >>> OK, I made a debug patch to printk and schedule_timeout in this >>> race window so I can easily truncate the file. When this happens, >>> it turns out that the readpage thinks it is reading a hole and >>> fills the page with zeros -> invalid result? >> >> >> >> A zero-filled pagecache page outside i_size is OK. >> > > Yes. But in this case the zero filled page actually gets > read by read(2). > > In any case, I think my patch won't close the race completely. > This following patch should be right. It causes the zeros to not get copied back unless i_size gets extended again.