From owner-freebsd-hackers Thu May 18 11:57:52 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id LAA15783 for hackers-outgoing; Thu, 18 May 1995 11:57:52 -0700 Received: from Root.COM (implode.Root.COM [198.145.90.1]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id LAA15777 ; Thu, 18 May 1995 11:57:48 -0700 Received: (dyson@localhost) by Root.COM (8.6.8/8.6.5) id MAA12649; Thu, 18 May 1995 12:00:47 -0700 From: John Dyson Message-Id: <199505181900.MAA12649@Root.COM> Subject: Re: Ron Minnich in comp.os.research: Status of Linux/FreeBSD/NetBSD buffer/vm page integration To: peter@nmti.com (Peter da Silva) Date: Thu, 18 May 1995 12:00:47 -0700 (PDT) Cc: jkh@FreeBSD.org, hackers@FreeBSD.org In-Reply-To: <9505181800.AA03902@sonic.nmti.com.nmti.com> from "Peter da Silva" at May 18, 95 01:00:24 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 1360 Sender: hackers-owner@FreeBSD.org Precedence: bulk > > Suppose you do the following: > > int fd; > int *ptr; > fd = open("something", 2); > ptr = mmap(0, 8192, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); > > *ptr = 1; > > Then you do either: > msync(ptr, sizeof(*ptr), MS_INVALIDATE) -or- fsync(fd); > > On SunOS and many systems, you will see the same result when watching > over the net: an nfs write at the point of the msync OR the fsync, for > the "dirty" pages only. It's pretty much what you want: sync the > modified pieces of the file back to their home. > > On FreeBSD, you don't get the same things at all: fsync and msync are > very different in freebsd. They are concerned with totally different > pieces of the kernel and if you depend on the "right thing" happening > you're in for a surprise. Specifically, if you use an fsync in the > above sequence there can still be (lots) of dirty pages for that file > in you machine, if they apply to mmap'ed files. This is not a problem on UFS on FreeBSD, and we found out about the bug very recently. The fix is minor and not a major problem in the FreeBSD merged VM buffer cache scheme. The only reason that it hasn't been fixed is that it is too close to release. It'll sure be fixed soon. So, this is NOT an architecture flaw as much as a programming booboo. If you are using mmap with NFS -- make sure that you msync! John dyson@root.com