[linux-cifs-client] Re: readahead not being thrown away by invalidate_inode_pages in 2.4

Andreas Dilger adilger at clusterfs.com
Mon Feb 23 16:45:33 GMT 2004


On Feb 22, 2004  22:29 -0800, Andrew Morton wrote:
> Steve French <smfltc at us.ibm.com> wrote:
> > Is there a different call in 2.4 that can be
> > used to discard the readahead pages in the page cache for this inode,
> > invalidate_inode_pages does not seem to work as expected?
> > 
> > if(list_empty(&(CIFS_I(inode)->openFileList))) {
> >   cFYI(1,("closing last open instance for inode %p",inode));
> >   /* if the file is not open we do not know if we can cache
> >     info on this inode, much less write behind and read ahead */
> >        CIFS_I(inode)->clientCanCacheRead = FALSE;
> >        CIFS_I(inode)->clientCanCacheAll  = FALSE;
> >        invalidate_inode_pages(inode);
> > }
> > 
> > 
> > The result of this code not working is that on 2.4 stale file data can
> > continue to be given back to the application on the client, even long
> > after the file has been opened and closed by the client and opened,
> > updated, closed by multiple other clients or directly on the server
> > itself.
> 
> (Delayed response)
> 
> invalidate_inode_pages() is just best-effort.  If pages are currently under
> I/O then they will not be invalidated.
> 
> You will probably have some success with
> 
> 	down(i_sem)
> 	filemap_fdatasync()
> 	filemap_fdatawait()
> 	invalidate_inode_pages()
> 	up(i_sem)

What about truncate_inode_pages(inode, 0)?  The comment above
invalidate_inode_pages() says:

 * invalidate_inode_pages - Invalidate all the unlocked pages of one inode
 *
 * This function only removes the unlocked pages, if you want to
 * remove all the pages of one inode, you must call truncate_inode_pages.


Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/



More information about the linux-cifs-client mailing list