From: Andreas Dilger Subject: Re: readahead not being thrown away by invalidate_inode_pages in 2.4 Date: Mon, 23 Feb 2004 09:45:33 -0700 Sender: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org Message-ID: <20040223164533.GB1146@schnapps.adilger.int> References: <1075948711.1255.11.camel@stevef95.austin.ibm.com> <20040222222930.61962157.akpm@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-cifs-client@lists.samba.org, Steve French Return-path: To: Andrew Morton Content-Disposition: inline In-Reply-To: <20040222222930.61962157.akpm@osdl.org> 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 On Feb 22, 2004 22:29 -0800, Andrew Morton wrote: > Steve French 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/