>>>>> " " == Linus Torvalds <[EMAIL PROTECTED]> writes:

     > Btw, that "invalidate_inode_pages()" thing is just wrong - we
     > can't just remove pages that are mapped etc, because that would
     > result in no end of fun aliasing problems etc.

<snip>
     > How about adding a test in invalidate_inode_pages() like

     >          /* We cannot invalidate a locked page */ if
     >          (TryLockPage(page))
     >                  continue;

     > + /* We cannot invalidate a page that is in use */
     > + if (page_count(page) != 1) {
     > + UnlockPage(page);
     > + continue;
     > + }
     > +
     >          __lru_cache_del(page); __remove_inode_page(page);

The problem here is that NFS pages have 3 rather than 2 states:
  1) mmapped & correct.
  2) mmapped & incorrect. (but possibly dirty)
  3) Unmapped

For case 1), we clearly want to have the page in inode->i_mapping.
For cases 2) & 3) we don't.

However for case 2) we still have a weak association to the inode
itself, and we want to be able to reference inode metadata etc.  Would
it make sense then to remove these pages from i_mapping, but to hang
them onto a new struct address_space (call it i_unmapped for want of a
better name)?

That would allow you to keep a consistent state for the page, while
still allowing you to 'invalidate' it (by removing it from the
i_mapping) and hence maintain a consistent cache.

invalidate_inode_pages() would then reduce to

   remove_page_from_inode_queue(page);
   remove_page_from_hash_queue(page);
   if (page_count(page))
         add_page_to_inode_unmapped(page);

Cheers,
  Trond
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to