From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 21 19:31:41 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 41FFB16A4CE for ; Wed, 21 Apr 2004 19:31:41 -0700 (PDT) Received: from mxsf11.cluster1.charter.net (mxsf11.cluster1.charter.net [209.225.28.211]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB6FD43D1F for ; Wed, 21 Apr 2004 19:31:40 -0700 (PDT) (envelope-from ups@tree.com) Received: from stups.com ([209.187.143.11])i3M2HrcZ057229; Wed, 21 Apr 2004 22:17:53 -0400 (EDT) Received: from tree.com (localhost [127.0.0.1]) by stups.com (8.9.3/8.9.3) with ESMTP id WAA28285; Wed, 21 Apr 2004 22:17:52 -0400 Message-Id: <200404220217.WAA28285@stups.com> X-Mailer: exmh version 2.0.2 To: Stephan Uphoff In-Reply-To: Message from Stephan Uphoff of "Wed, 21 Apr 2004 21:52:43 EDT." <200404220152.VAA26897@stups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Apr 2004 22:17:52 -0400 From: Stephan Uphoff cc: hackers@freebsd.org cc: Julian Elischer Subject: Re: how to flush out cache.? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2004 02:31:41 -0000 Stephan Uphoff wrote: > Matthew Dillon wrote: > > : > > :> > > :> mmap() and msync(..MS_INVALIDATE..) should work. > > : > > :hmmm that is rather interesting.. > > :I wonder if it would work.... > > :Maybe a vm guru could confirm this.. (under 4.x) > > : > > > > Huh. If I hadn't looked at the code I would have said that > > MS_INVALIDATE doesn't work in FreeBSD, but when I look at the code > > it sure looks like it ought to work! > > > > But, alas, it does not. The invalidation request goes all the way > > through to the vnode pager but it looks like the vnode pager ignores > > it. > > > > MS_INVALIDATE -> OBJPC_INVAL -> VM_PAGER_PUT_INVAL -> IO_INVAL -> (ignored) > > > > IO_INVAL is defined to be 'invalidate after I/O completes', > > not 'throw away the dirty data', but the only place it appears to be > > implemented is in the NFS code. > > > > -Matt > > > Yes - but FreeBSD then calls vm_object_page_remove to remove the pages > from the vnode object. (vm_object_sync for 5.x or vm_map_clean for 4.x ) > > Mhhh .. 4.X removes the pages without flushing if the file is not write > mapped. > This means that anyone with read access can screw up a file. A file with dirty (unflushed) pages. > ( For example periodically throwing away pages from /var/log/wtmp ...) > 5.x looks better - but there is a race condition that can cause the same thing. > I think for msync() the vm_object_page_remove() function should be called with > clean_only set to TRUE to avoid throwing away valid changes. > ( I will send-pr tomorrow ) > > Stephan > > >