Re: [PATCH] mm/filemap: Use filemap_read_page in filemap_fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 03, 2021 at 12:12:53PM -0800, Andrew Morton wrote:
> On Wed, 3 Mar 2021 13:26:40 +0000 Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> 
> > But here's the thing ... invalidate_mapping_pages() doesn't
> > ClearPageUptodate.  The only places where we ClearPageUptodate is on an
> > I/O error.
> 
> yup.
> 
> > So ... as far as I can tell, the only way to hit this is:
> > 
> >  - Get an I/O error during the wait
> >  - Have another thread cause the page to be removed from the page cache
> >    (eg do direct I/O to the file) before this thread is run.
> > 
> > and the consequence to this change is that we have another attempt to
> > read the page instead of returning an error immediately.  I'm OK with
> > that unintentional change, although I think the previous behaviour was
> > also perfectly acceptable (after all, there was an I/O error while trying
> > to read this page).
> > 
> > Delving into the linux-fullhistory tree, this code was introduced by ...
> > 
> > commit 56f0d5fe6851037214a041a5cb4fc66199256544
> > Author: Andrew Morton <akpm@xxxxxxxx>
> > Date:   Fri Jan 7 22:03:01 2005 -0800
> > 
> >     [PATCH] readpage-vs-invalidate fix
> > 
> >     A while ago we merged a patch which tried to solve a problem wherein a
> >     concurrent read() and invalidate_inode_pages() would cause the read() to
> >     return -EIO because invalidate cleared PageUptodate() at the wrong time.
> > 
> > We no longer clear PageUptodate, so I think this is stale code?  Perhaps
> > you could check with the original author ...
> 
> Which code do you think might be stale?  We need the !PageUptodate
> check to catch IO errors and we need the !page->mapping check to catch
> invalidates.  Am a bit confused.

I think the check of !page->mapping here:

        if (PageUptodate(page))
                return 0;
        if (!page->mapping)     /* page truncated */
                return AOP_TRUNCATED_PAGE;

is no longer needed.  If we didn't see an error, the page will be Uptodate,
regardless of whether it's been removed from the page cache.  If we did
see an error, it's OK to return -EIO, even if the page has been removed
from the page cache in the interim.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux