The patch titled Subject: mm/filemap: drop check for truncated page after I/O has been added to the -mm tree. Its filename is mm-filemap-drop-check-for-truncated-page-after-i-o.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-filemap-drop-check-for-truncated-page-after-i-o.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-filemap-drop-check-for-truncated-page-after-i-o.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Subject: mm/filemap: drop check for truncated page after I/O If the I/O completed successfully, the page will remain Uptodate, even if it is subsequently truncated. If the I/O completed with an error, this check would cause us to retry the I/O if the page were truncated before we woke up. There is no need to retry the I/O; the I/O to fill the page failed, so we can legitimately just return -EIO. This code was originally added by commit 56f0d5fe6851 ("[PATCH] readpage-vs-invalidate fix") in 2005 (this commit ID is from the linux-fullhistory tree; it is also commit ba1f08f14b52 in tglx-history). At the time, truncate_complete_page() called ClearPageUptodate(), and so this was fixing a real bug. In 2008, commit 84209e02de48 ("mm: dont clear PG_uptodate on truncate/invalidate") removed the call to ClearPageUptodate, and this check has been unnecessary ever since. It doesn't do any real harm, but there's no need to keep it. Link: https://lkml.kernel.org/r/20210303222547.1056428-1-willy@xxxxxxxxxxxxx Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/filemap.c | 2 -- 1 file changed, 2 deletions(-) --- a/mm/filemap.c~mm-filemap-drop-check-for-truncated-page-after-i-o +++ a/mm/filemap.c @@ -2281,8 +2281,6 @@ static int filemap_read_page(struct file return error; if (PageUptodate(page)) return 0; - if (!page->mapping) /* page truncated */ - return AOP_TRUNCATED_PAGE; shrink_readahead_size_eio(&file->f_ra); return -EIO; } _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are mm-filemap-use-filemap_read_page-in-filemap_fault.patch mm-filemap-drop-check-for-truncated-page-after-i-o.patch