[linux-cifs-client] Re: readahead not being thrown away by
invalidate_inode_pages in 2.4
Andrew Morton
akpm at osdl.org
Mon Feb 23 06:29:30 GMT 2004
Steve French <smfltc at us.ibm.com> wrote:
>
> In the following snippet of the cifs vfs close file handle code
> (.release vfs operation), I see the code below being executed but I
> don't see it actually invalidating what I expect on 2.4 (in particular
> 2.4.24). The equivalent approach works on 2.6. The intent was that when
> the last instance of a file was closed on this client for the readahead
> data to be discarded by the call to invalidate_inode_pages (in 2.6 this
> is invalidate_remote_inode) so we will be forced to go to the server (ie
> invoke when the file is reopened for current copies of the data (cifs
> distributed caching token management works best when the file is open,
> and would be hard to monitor properly while the server file has no open
> instances on the client). 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)
More information about the linux-cifs-client
mailing list