Re: Checking page_count(page) in invalidate_complete_page

Andrew Morton
2006-09-27T16:03:05Z

On Wed, 27 Sep 2006 18:39:19 +1000
Nick Piggin <nickpiggin@yahoo.com.au> wrote:

> Andrew Morton wrote:
>
> >On Wed, 27 Sep 2006 14:47:26 +1000
> >Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> >
> >
> >>truncate_inode_pages will a) throw away everything including dirty
> >>pages, and b) probably be fairly
> >>racy unless the inode's i_size (for normal files) is modified.
> >>
> >>We really want to make an invalidation that works properly for you.
> >>
> >>If you can guarantee that a pagecache page can never get mapped to a
> >>user mapping (eg. perhaps for
> >>directories and symlinks) and also ensure that you don't dirty it via
> >>the filesystem, then you don't
> >>have to worry about it becoming dirty, so we can skip the checks Andrew
> >>has added and maybe add a
> >>WARN_ON(PageDirty()).
> >>
> >
> >None of that is true for when invalidate_inode_pages2() is used by
> >block-backed direct-io.
> >
>
> Sure, you wouldn't be able to skip those checks for direct IO, just for the
> NFS usage.
>
> >We should fix it for that application..
> >
>
> I thought direct IO fell back to buffered IO when the teardown failed.

See mm/filemap.c:generic_file_direct_IO().

> I
> was surprised that it didn't and gave me errors when I was testing. Do
> you see a better way to handle the direct IO case?
>

Ignore page_count() in invalidate_inode_pages2()?