Subject: Re: NFS problems with LAN adapter
To: David Brownlee <abs@netbsd.org>
From: Harold Gutch <logix@foobar.franken.de>
List: port-dreamcast
Date: 09/01/2002 23:23:02
On Sun, Sep 01, 2002 at 09:46:25PM +0100, David Brownlee wrote:
> On Sun, 1 Sep 2002, Harold Gutch wrote:
> 
> > Hi,
> >
> > I'm experiencing file corruption when WRITING files via NFS with
> > a LAN adapter.  Reading works fine, as does copying the files
> > from and to the Dreamcast via scp.  The corruption occurs after
> > exactly 8192 bytes.  I found this in sys/nfs/nfs.h:
> >
> > #define  NFS_WSIZE       8192            /* Def. write data size */
> >
> > and this in sys/nfs/nfsproto.h:
> >
> > #define NFS_V2MAXDATA       8192
> >
> > I could just modify those values, but I don't have the insight to
> > know how to modify them to debug my problem.  Does anybody
> > (Christian?) have enough clue of this to help me debug this and
> > track down this bug?
> 
> 	Have you tried setting options NFS_BOOT_RWSIZE=1024 in the kernel
> 	config, and mounting any additional nfs partitions with
> 	-r=1024,-w=1024 ?


Yes, NFS_BOOT_RWSIZE is set to 1024 in my kernel.

This is weird - after adding -r=1024,-w=1024 to the line for my
root-directory in /etc/fstab, I get the corruption after 4096
bytes already:

  $ cp /netbsd /tmp/netbsd
  $ dd if=/netbsd bs=4096 count=1 | md5
  1+0 records in
  1+0 records out
  4096 bytes transferred in 0.001 secs (4096000 bytes/sec)
  fcbd92b184bebf1e7c7a2220d362aba1
  $ dd if=/tmp/netbsd bs=4096 count=1 | md5
  1+0 records in
  1+0 records out
  4096 bytes transferred in 0.001 secs (4096000 bytes/sec)
  fcbd92b184bebf1e7c7a2220d362aba1

but:

  $ dd if=/netbsd bs=4097 count=1 | md5
  1+0 records in
  1+0 records out
  4097 bytes transferred in 0.010 secs (409700 bytes/sec)
  63f023be8e2f8a3c212484f4d8ff8104
  $ dd if=/tmp/netbsd bs=4097 count=1 | md5
  1+0 records in
  1+0 records out
  4097 bytes transferred in 0.029 secs (141275 bytes/sec)
  70634370db332a87292bd40f8ef7334e

I now also compared around byte 4096 in /netbsd and /tmp/netbsd
with hexdump:

/netbsd:
0001000 51d2 1a1c 6fe3 4f26 6ef6 6df6 6cf6 6bf6
0001010 6af6 69f6 000b 68f6 0400 4000 1000 0200
0001020 0100 0080 0000 0800 0006 0010 0003 0010
0001030 2fe6 6ef3 e001 6fe3 000b 6ef6 2f86 2f96
0001040 2fa6 2fb6 2fc6 2fd6 2fe6 4f22 7ffc 6ef3


/tmp/netbsd:
0001000 0000 0000 0000 0000 0000 0000 0000 0000
*
0001020 0100 0080 0000 0800 0006 0010 0003 0010
0001030 2fe6 6ef3 e001 6fe3 000b 6ef6 2f86 2f96
0001040 2fa6 2fb6 2fc6 2fd6 2fe6 4f22 7ffc 6ef3


The first 32 bytes of every 4096 byte block (except for the first
one) seem to be corrupted.


bye,
  Harold