Subject: nfs mapped files
To: None <davidg@Root.COM>
From: None <rick@snowhite.cis.uoguelph.ca>
List: netbsd-bugs
Date: 02/08/1995 15:55:55
Hi,

It seems that there is a problem with mapped nfs files, since some nfs buffers
in the buffer cache are only partially valid (the b_validoff and b_validend).
If a file that has been recently written is read back, you can get garbage
out of the non-valid regions of the buffers. This only shows up for NQNFS and
NFS v3, since all buffers are invalidated upon close for NFS v2, after a file
is written.

Now, it seems that VOP_MMAP() exists, but is never called, in 4.4BSD-Lite and
I am wondering what can be done to fix this?

One though is to implement an nfs_mmap(), where it invalidates all partially
valid blocks and marks the nfsnode as mmap'd. Then nfs_write() checks for the
mmap'd flag on the node and if it is set, does an old style "read the block in
first for writes to partial blocks not at eof" so that the blocks remain
contiguously valid up to end of file. Does this sound along the right track,
assuming that a VOP_MMAP() call is added to the mmap() syscall?
(I am guessing that I could safely clear the mmap'd flag in nfs_inactive().)

Any ideas and suggestions w.r.t. this would be appreciated, rick
ps: If there is a particular person that I should be emailing w.r.t. nfs/vfs
    stuff in each 4.4BSD-Lite descendant group, just let me know and I will
    use that instead of the bugs mailing list.