From: Andrew Morton Subject: Re: readahead not being thrown away by invalidate_inode_pages in 2.4 Date: Sun, 22 Feb 2004 22:29:30 -0800 Sender: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org Message-ID: <20040222222930.61962157.akpm@osdl.org> References: <1075948711.1255.11.camel@stevef95.austin.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, linux-cifs-client@lists.samba.org Return-path: To: Steve French In-Reply-To: <1075948711.1255.11.camel@stevef95.austin.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org List-Id: linux-fsdevel.vger.kernel.org Steve French 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)