Subject: bin/1697: vi bug (mmap() of remote file is not consistent)
To: None <davide@PIPER.NECTAR.CS.CMU.EDU>
From: Gordon W. Ross <gwr@mc.com>
List: netbsd-bugs
Date: 10/27/1995 10:02:43
> Date: Thu, 26 Oct 95 17:50:18 EDT
> From: davide@PIPER.NECTAR.CS.CMU.EDU
> >Number: 1697
> >Category: bin
> >Synopsis: vi uses mmap() instead of read(); can corrupt remote files
> >Description:
> vi seems to use mmap() instead of read() on files being edited. This
> is bad because mmap() of a file from a remote file system (in this case
> AFS 3.0 1.6, but also NFS) is not consistent. That is, while metadata
> such as modification time and length are obtained correctly from the
> filesystem, the data pages in memory objects are NOT updated when the
> remote file changes. I have just repeated this with two NetBSD/i386
> laptops (-current) running NFS but not AFS, so it is NOT an AFS problem.
> >Fix:
> Either (1) get vi to stop using mmap() or (2) get mmap() to do the
> right thing. Since this problem can result in file corruption (if
> you don't notice the wrong part you will write it out and it will
> become the "correct" file contents, which actually happened to me),
> I think this is severe.
This is really a problem with the VM system, of course.
I've been thinking about a better design for the VM code,
but it would take quite a while to implement...
Gordon Ross