linux 2.0.31 , mmap, sync

Carrer yuri (
Thu, 25 Feb 1999 17:05:54 +0100 (MET)

What happen to data that should be written on disk (an mmapped file)?

I've linux 2.0.31 and the power went off. I've loose all the data I've
inserted until the last time I shut down the msql server. I've asked
to who has written the db and here is the various posts:

Date: Mon, 22 Feb 1999 19:16:20 -0500 (EST)
From: Peter 'Marcus' Krause <>
To: Multiple recipients of list <>
Subject: Re: little angry

There is a problem with Linux and the msql auto-install. It seems to not
default to msync, so a power failure does cause the data to be lost
(however, a graceful shutdown of the msql daemon does save everything
correctly). I solved it on my system by adding this line to
in the source code and recompiling:

#define HAVE_MSYNC 1

You could also put -DHAVE_MSYNC in the Makefile compile options and get
same result.

I sent this fix to the bugs email address months ago, so I hope it made it
into later versions, but I haven't upgraded yet so I can't confirm it.


Date: Thu, 25 Feb 1999 08:58:28 +1000 (EST)
From: "David J. Hughes" <>
To: RHS Linux User <>
Subject: Re: little angry

On Wed, 24 Feb 1999, RHS Linux User wrote:

> > That's wierd. If an OS has a unified VM and file subsystem then
> > should write out any dirty pages from the buffer cache (a dirty page
is a
> > dirty page etc). Did you remove "update" from your boot scripts or
> > doesn't Linux have a sane VM / file subsystem?
> no no :) mSQL data was the only thing I get lost. All the other things
> (webpages, files, and so on) are on disk.

You didn't understand my comment. In the kernel of a modern UNIX based
system there is a single set of buffer cache blocks used for disk IO
buffering. mmap() is really disk based IO so the kernels VM should be
maintaining the cached pages properly so that they are flagged as "dirty"
in the buffer cache. If they were flagged as dirty then a normal sync
would keep the disk image up to date.



Date: Wed, 24 Feb 1999 18:02:52 -0500 (EST) From: "David J. Hughes" <> To: Multiple recipients of list <> Subject: Re: little angry/loss of data

On Wed, 24 Feb 1999, Peter 'Marcus' Krause wrote:

> I had the same problems on a vanilla Red Hat Linux 2.0.34 right out of the > box. Someone on a Linux newsgroup said some hard drives cache during a sync > into their internal cache on the hard drive cache chip itself, but an msync > flushes the data out better.

OK. We can now assume that Linux doesn't use a properly integrated VM / File subsystem. Shame, that sort of technology has been around for ages.

> However, as soon as I put in that '#define > HAVE_MSYNC 1' and recompiled, the .dat files changed regularly (according to > the Msync_timer option) and power failures lost only the last few seconds of > data.

Next step is to work out why the setup routines didn't determine that Linux supports msync() by itself. This should all be automatic. We'll look into it.

Bambi ..


So, what is the problem ? :) Is 2.0.36 or 37 better or what ?:)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at