Subject: Re: NFS bug?
To: Arne Jansen <a.jansen@biodata.de>
From: Bill Studenmund <wrstuden@zembu.com>
List: current-users
Date: 05/04/2001 13:13:13
On Fri, 4 May 2001, Arne Jansen wrote:

> Hi,
> I'm currently porting NetBSD to an MPC860 (embedded PowerPC). It's
> runnning in multiuser mode now, booting as a diskless client.
> At first, all seemed fine with NFS, but I was unable to build
> a new pwd.db: each time I called pwd_mkdb, the first 4096 bytes
> in the pwd.db were zero.
> Writing a little test program, I figured out that 
>      fd = open("testfile", O_WRONLY | O_TRUNC | O_CREAT, 0666);
>      memset(buf, 1, 4096);
>      pwrite(fd, buf, 1024, 4096);
>      pwrite(fd, buf, 1024, 0);
>      close(fd);
> didn't render the expected result: the first 4096 were zero.
> Using lseek() didn't change anything. If I write the file sequentially,
> all went fine.
> A million printfs later (I don't know anything about NFS and uvm),
> I found out that the first page has not been marked unclean and thus
> not been written back to disk.
> Another million printfs later I inserted 2 lines into nfs_bio.c, near
> the end where allocated pages are unfaked:
>         pgs[i]->flags &= ~(PG_FAKE);
> +       if (ap->a_access_type & VM_PROT_WRITE)
> +               pgs[i]->flags &= ~PG_CLEAN;
>     }
> Now it's working correctly for me, but I know this is only a dirty
> hack, but I don't have no more energy left to track down the problem
> to its root, thus seeking your help.
> Maybe the problem is that the last page is not yet commited, so the
> file on the server is truncated to 0 and reading the hole from 0-4095
> fail.
> I can't figure how this bug can have anything to do with my port, but
> I can't exclude the possibility. My port is based on work done by
> Tsubai Masanari in March, so maybe I have to update some parts.

I think this bug was fixed in -current in April. Check the tech-kern
archives. Also, see if you can update your tree to something more current.

Take care,

Bill